Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
c22b5381
Commit
c22b5381
authored
Oct 27, 2023
by
王祖波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openAi
parent
01fa3118
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
6 deletions
+47
-6
pom.xml
haoban-manage3-wx/pom.xml
+25
-0
ContentThirdController.java
...manage/web/controller/content/ContentThirdController.java
+15
-4
spring-servlet.xml
haoban-manage3-wx/src/main/webapp/WEB-INF/spring-servlet.xml
+2
-0
web.xml
haoban-manage3-wx/src/main/webapp/WEB-INF/web.xml
+5
-2
No files found.
haoban-manage3-wx/pom.xml
View file @
c22b5381
...
...
@@ -37,6 +37,31 @@
</dependencyManagement>
<dependencies>
<dependency>
<groupId>
com.azure
</groupId>
<artifactId>
azure-ai-openai
</artifactId>
<version>
1.0.0-beta.5
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-core
</artifactId>
<version>
2.10.0
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-annotations
</artifactId>
<version>
2.10.0
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<version>
2.10.0
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
open-ai-sdk
</artifactId>
<version>
3.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/content/ContentThirdController.java
View file @
c22b5381
...
...
@@ -7,13 +7,12 @@ import com.gic.content.api.dto.aigc.AIGCContent;
import
com.gic.content.api.qdto.aigc.ContentAIGCQDTO
;
import
com.gic.content.api.service.common.ThirdApiService
;
import
com.gic.haoban.manage.web.qo.content.ContentAIGCQO
;
import
com.open.ai.OpenAIUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.servlet.mvc.method.annotation.SseEmitter
;
/**
* 好办-三方接口
...
...
@@ -43,4 +42,16 @@ public class ContentThirdController {
}
return
RestResponse
.
successResult
(
response
.
getResult
());
}
/**
* openAI会话
* @param question
* @return
*/
@RequestMapping
(
value
=
"/ai/chat"
,
method
=
RequestMethod
.
GET
,
produces
=
"text/event-stream;charset=UTF-8"
)
public
SseEmitter
openAiChat
(
String
question
,
String
userId
,
String
enterpriseId
)
{
SseEmitter
emitter
=
new
SseEmitter
(
30000L
);
OpenAIUtil
.
chat
(
emitter
,
question
,
userId
,
enterpriseId
);
return
emitter
;
}
}
haoban-manage3-wx/src/main/webapp/WEB-INF/spring-servlet.xml
View file @
c22b5381
...
...
@@ -37,6 +37,7 @@
<list>
<value>
text/html;charset=UTF-8
</value>
<value>
application/x-www-form-urlencoded;charset=UTF-8
</value>
<value>
text/plain;charset=UTF-8
</value>
<!--默认是 iso-8859-1 -->
</list>
</property>
...
...
@@ -54,6 +55,7 @@
<list>
<value>
text/html;charset=UTF-8
</value>
<value>
application/x-www-form-urlencoded;charset=UTF-8
</value>
<value>
text/plain;charset=UTF-8
</value>
<!--默认是 iso-8859-1 -->
</list>
</property>
...
...
haoban-manage3-wx/src/main/webapp/WEB-INF/web.xml
View file @
c22b5381
<?xml version="1.0" encoding="UTF-8"?>
<web-app
version=
"
2.5
"
xmlns=
"http://java.sun.com/xml/ns/javaee"
<web-app
version=
"
3.0
"
xmlns=
"http://java.sun.com/xml/ns/javaee"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_
2_5
.xsd"
>
xsi:schemaLocation=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_
3_0
.xsd"
>
<display-name>
Archetype Created Web Application
</display-name>
<context-param>
...
...
@@ -23,6 +23,7 @@
<param-value>
/WEB-INF/spring-*.xml
</param-value>
</init-param>
<load-on-startup>
2
</load-on-startup>
<async-supported>
true
</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>
spring
</servlet-name>
...
...
@@ -39,6 +40,7 @@
<filter-mapping>
<filter-name>
encodingFilter
</filter-name>
<url-pattern>
/*
</url-pattern>
<dispatcher>
ASYNC
</dispatcher>
</filter-mapping>
<filter>
...
...
@@ -48,5 +50,6 @@
<filter-mapping>
<filter-name>
springSessionRepositoryFilter
</filter-name>
<url-pattern>
/*
</url-pattern>
<dispatcher>
ASYNC
</dispatcher>
</filter-mapping>
</web-app>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment