Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-api
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
poc
poc-api
Commits
e3f31de2
Commit
e3f31de2
authored
Dec 20, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Agent API 配置
parent
b082a584
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1519 additions
and
42 deletions
+1519
-42
pom.xml
pom.xml
+0
-8
AgentApplicationInfoService.java
...nt_application/aggregate/AgentApplicationInfoService.java
+2
-1
AgentApplicationInfoServiceImpl.java
...ation/aggregate/impl/AgentApplicationInfoServiceImpl.java
+66
-12
BizAgentApplicationApiConversationConvert.java
...on/convert/BizAgentApplicationApiConversationConvert.java
+39
-0
BizAgentApplicationApiFilesConvert.java
...plication/convert/BizAgentApplicationApiFilesConvert.java
+43
-0
BizAgentApplicationApiConversationEntity.java
...tion/entity/BizAgentApplicationApiConversationEntity.java
+127
-0
BizAgentApplicationApiFilesEntity.java
...application/entity/BizAgentApplicationApiFilesEntity.java
+151
-0
BizAgentApplicationApiConversationModel.java
...cation/model/BizAgentApplicationApiConversationModel.java
+190
-0
BizAgentApplicationApiFilesModel.java
...t_application/model/BizAgentApplicationApiFilesModel.java
+222
-0
BizAgentApplicationApiConversationRepository.java
...ository/BizAgentApplicationApiConversationRepository.java
+6
-0
BizAgentApplicationApiFilesRepository.java
...ion/repository/BizAgentApplicationApiFilesRepository.java
+6
-0
AgentApplicationInfoRestImpl.java
...t_application/rest/impl/AgentApplicationInfoRestImpl.java
+1
-1
BizAgentApplicationApiConversationService.java
...on/service/BizAgentApplicationApiConversationService.java
+24
-0
BizAgentApplicationApiFilesService.java
...plication/service/BizAgentApplicationApiFilesService.java
+21
-0
BizAgentApplicationApiProfileService.java
...ication/service/BizAgentApplicationApiProfileService.java
+2
-0
BizAgentApplicationApiConversationServiceImpl.java
...e/impl/BizAgentApplicationApiConversationServiceImpl.java
+123
-0
BizAgentApplicationApiFilesServiceImpl.java
.../service/impl/BizAgentApplicationApiFilesServiceImpl.java
+115
-0
BizAgentApplicationApiProfileServiceImpl.java
...ervice/impl/BizAgentApplicationApiProfileServiceImpl.java
+23
-19
AgentApplicationApiService.java
.../com/poc/expose/aggregate/AgentApplicationApiService.java
+51
-0
AgentApplicationApiServiceImpl.java
...expose/aggregate/impl/AgentApplicationApiServiceImpl.java
+306
-0
AgentApplicationServiceImpl.java
...oc/expose/aggregate/impl/AgentApplicationServiceImpl.java
+1
-1
No files found.
pom.xml
View file @
e3f31de2
...
@@ -23,8 +23,6 @@
...
@@ -23,8 +23,6 @@
</dependencyManagement>
</dependencyManagement>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
cn.com.yict.framemax
</groupId>
<groupId>
cn.com.yict.framemax
</groupId>
<artifactId>
framemax-core
</artifactId>
<artifactId>
framemax-core
</artifactId>
...
@@ -247,12 +245,6 @@
...
@@ -247,12 +245,6 @@
<dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<artifactId>
hutool-all
</artifactId>
<version>
5.3.10
</version>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-http
</artifactId>
<version>
5.7.3
</version>
<version>
5.7.3
</version>
</dependency>
</dependency>
...
...
src/main/java/cn/com/poc/agent_application/aggregate/AgentApplicationInfoService.java
View file @
e3f31de2
...
@@ -46,10 +46,11 @@ public interface AgentApplicationInfoService {
...
@@ -46,10 +46,11 @@ public interface AgentApplicationInfoService {
* @param messages 对话消息
* @param messages 对话消息
* @param tools 插件配置
* @param tools 插件配置
* @param fileUrls 文件URL
* @param fileUrls 文件URL
* @param stream 是否流式传输
*/
*/
String
callAgentApplication
(
String
agentId
,
String
identifier
,
String
largeModel
,
String
agentSystem
,
String
callAgentApplication
(
String
agentId
,
String
identifier
,
String
largeModel
,
String
agentSystem
,
Integer
[]
knowledgeIds
,
Integer
communicationTurn
,
Float
topP
,
Float
temperature
,
Integer
[]
knowledgeIds
,
Integer
communicationTurn
,
Float
topP
,
Float
temperature
,
List
<
Message
>
messages
,
List
<
Tool
>
tools
,
List
<
String
>
fileUrls
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
List
<
Message
>
messages
,
List
<
Tool
>
tools
,
List
<
String
>
fileUrls
,
boolean
stream
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
/**
/**
* 应用下架
* 应用下架
...
...
src/main/java/cn/com/poc/agent_application/aggregate/impl/AgentApplicationInfoServiceImpl.java
View file @
e3f31de2
...
@@ -13,8 +13,6 @@ import cn.com.poc.common.constant.CommonConstant;
...
@@ -13,8 +13,6 @@ import cn.com.poc.common.constant.CommonConstant;
import
cn.com.poc.common.utils.Assert
;
import
cn.com.poc.common.utils.Assert
;
import
cn.com.poc.common.utils.BlContext
;
import
cn.com.poc.common.utils.BlContext
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.equity.aggregate.MemberEquityService
;
import
cn.com.poc.equity.domain.MemberEquityInfo
;
import
cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity
;
import
cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity
;
import
cn.com.poc.knowledge.service.BizKnowledgeDocumentService
;
import
cn.com.poc.knowledge.service.BizKnowledgeDocumentService
;
import
cn.com.poc.support.security.oauth.entity.UserBaseEntity
;
import
cn.com.poc.support.security.oauth.entity.UserBaseEntity
;
...
@@ -30,8 +28,8 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.generations.BaiduAISailsT
...
@@ -30,8 +28,8 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.generations.BaiduAISailsT
import
cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDemandResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDemandResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.LargeModelFunctionEnum
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.LargeModelFunctionEnum
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.long_memory.LongMemory
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.long_memory.AgentLongMemoryEntity
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.long_memory.AgentLongMemoryEntity
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.long_memory.LongMemory
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.memory_variable_writer.MemoryVariableWriter
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.memory_variable_writer.MemoryVariableWriter
;
import
cn.com.poc.thirdparty.service.LLMService
;
import
cn.com.poc.thirdparty.service.LLMService
;
import
cn.com.yict.framemax.core.context.Context
;
import
cn.com.yict.framemax.core.context.Context
;
...
@@ -164,10 +162,11 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
...
@@ -164,10 +162,11 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
@Override
@Override
public
String
callAgentApplication
(
String
agentId
,
String
dialogueId
,
String
largeModel
,
public
String
callAgentApplication
(
String
agentId
,
String
dialogueId
,
String
largeModel
,
String
agentSystem
,
Integer
[]
kdIds
,
Integer
communicationTurn
,
Float
topP
,
Float
temperature
,
String
agentSystem
,
Integer
[]
kdIds
,
Integer
communicationTurn
,
Float
topP
,
Float
temperature
,
List
<
Message
>
messages
,
List
<
Tool
>
tools
,
List
<
String
>
fileUrls
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
List
<
Message
>
messages
,
List
<
Tool
>
tools
,
List
<
String
>
fileUrls
,
boolean
stream
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
logger
.
info
(
"Call Agent Application, agentId:{}, dialogueId:{},largeModel:{},agentSystem:{},kdIds:{},communicationTurn:{},topP:{},temperature:{},messages:{}, tools:{}"
logger
.
info
(
"Call Agent Application, agentId:{}, dialogueId:{},largeModel:{},agentSystem:{},kdIds:{},communicationTurn:{},topP:{},temperature:{},messages:{}, tools:{}"
,
agentId
,
dialogueId
,
largeModel
,
agentSystem
,
kdIds
,
communicationTurn
,
topP
,
temperature
,
messages
,
tools
);
,
agentId
,
dialogueId
,
largeModel
,
agentSystem
,
kdIds
,
communicationTurn
,
topP
,
temperature
,
messages
,
tools
);
String
model
=
modelConvert
(
largeModel
);
String
model
=
modelConvert
(
largeModel
);
Tool
[]
toolArray
=
tools
.
toArray
(
new
Tool
[
0
]);
Tool
[]
toolArray
=
tools
.
toArray
(
new
Tool
[
0
]);
...
@@ -178,9 +177,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
...
@@ -178,9 +177,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
Message
[]
messageArray
=
buildMessages
(
messages
,
communicationTurn
,
promptTemplate
);
Message
[]
messageArray
=
buildMessages
(
messages
,
communicationTurn
,
promptTemplate
);
BufferedReader
bufferedReader
=
invokeLLM
(
model
,
messageArray
,
topP
);
return
llmExecutorAndOutput
(
topP
,
stream
,
model
,
messageArray
,
httpServletResponse
);
return
textOutput
(
httpServletResponse
,
bufferedReader
);
}
}
...
@@ -209,7 +206,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
...
@@ -209,7 +206,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
largeModelResponse
.
setUser
(
"POC-CREATE-AGENT-SYSTEM"
);
largeModelResponse
.
setUser
(
"POC-CREATE-AGENT-SYSTEM"
);
BufferedReader
bufferedReader
=
llmService
.
chatChunk
(
largeModelResponse
);
BufferedReader
bufferedReader
=
llmService
.
chatChunk
(
largeModelResponse
);
textOutput
(
httpServletResponse
,
bufferedReader
);
textOutput
Stream
(
httpServletResponse
,
bufferedReader
);
}
}
@Override
@Override
...
@@ -486,6 +483,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
...
@@ -486,6 +483,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
}
}
@Override
public
boolean
hasPublishAgentPermission
(
String
agentId
,
Long
memberId
)
{
public
boolean
hasPublishAgentPermission
(
String
agentId
,
Long
memberId
)
{
BizAgentApplicationPublishEntity
publishEntity
=
bizAgentApplicationPublishService
.
getByAgentId
(
agentId
);
BizAgentApplicationPublishEntity
publishEntity
=
bizAgentApplicationPublishService
.
getByAgentId
(
agentId
);
if
(
publishEntity
!=
null
&&
publishEntity
.
getMemberId
().
equals
(
memberId
.
intValue
()))
{
if
(
publishEntity
!=
null
&&
publishEntity
.
getMemberId
().
equals
(
memberId
.
intValue
()))
{
...
@@ -494,6 +492,28 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
...
@@ -494,6 +492,28 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
return
false
;
return
false
;
}
}
/**
* 执行LLM,并输出结果
*
* @param topP topP
* @param stream 是否流式输出
* @param model 模型
* @param messageArray 消息
* @param httpServletResponse 响应
* @return 输出结果
* @throws Exception
*/
private
String
llmExecutorAndOutput
(
Float
topP
,
boolean
stream
,
String
model
,
Message
[]
messageArray
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
if
(
stream
)
{
BufferedReader
bufferedReader
=
invokeLLMStream
(
model
,
messageArray
,
topP
);
return
textOutputStream
(
httpServletResponse
,
bufferedReader
);
}
else
{
LargeModelDemandResult
largeModelDemandResult
=
invokeLLM
(
model
,
messageArray
,
topP
);
return
textOutput
(
httpServletResponse
,
largeModelDemandResult
);
}
}
/**
/**
* 构建应用信息提示词
* 构建应用信息提示词
*
*
...
@@ -652,7 +672,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
...
@@ -652,7 +672,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
}
}
/**
/**
* * 调用llm
* * 调用llm
-流
*
*
* @param largeModel
* @param largeModel
* @param messageArray
* @param messageArray
...
@@ -660,7 +680,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
...
@@ -660,7 +680,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
private
BufferedReader
invokeLLM
(
String
largeModel
,
Message
[]
messageArray
,
Float
topP
)
throws
Exception
{
private
BufferedReader
invokeLLM
Stream
(
String
largeModel
,
Message
[]
messageArray
,
Float
topP
)
throws
Exception
{
LargeModelResponse
largeModelResponse
=
new
LargeModelResponse
();
LargeModelResponse
largeModelResponse
=
new
LargeModelResponse
();
largeModelResponse
.
setModel
(
largeModel
);
largeModelResponse
.
setModel
(
largeModel
);
largeModelResponse
.
setMessages
(
messageArray
);
largeModelResponse
.
setMessages
(
messageArray
);
...
@@ -671,6 +691,41 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
...
@@ -671,6 +691,41 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
}
}
/**
* * 调用llm-非流
*
* @param largeModel
* @param messageArray
* @param topP
* @return
* @throws Exception
*/
private
LargeModelDemandResult
invokeLLM
(
String
largeModel
,
Message
[]
messageArray
,
Float
topP
)
throws
Exception
{
LargeModelResponse
largeModelResponse
=
new
LargeModelResponse
();
largeModelResponse
.
setModel
(
largeModel
);
largeModelResponse
.
setMessages
(
messageArray
);
largeModelResponse
.
setTopP
(
topP
);
largeModelResponse
.
setStream
(
false
);
largeModelResponse
.
setUser
(
"POE"
);
return
llmService
.
chat
(
largeModelResponse
);
}
/**
* 文本输出结果
*
* @param httpServletResponse
* @throws IOException
*/
private
String
textOutput
(
HttpServletResponse
httpServletResponse
,
LargeModelDemandResult
largeModelDemandResult
)
throws
IOException
{
PrintWriter
writer
=
httpServletResponse
.
getWriter
();
writer
.
write
(
JsonUtils
.
serialize
(
largeModelDemandResult
));
writer
.
flush
();
writer
.
close
();
return
largeModelDemandResult
.
getMessage
();
}
/**
/**
* 文本输出结果
* 文本输出结果
*
*
...
@@ -678,7 +733,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
...
@@ -678,7 +733,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
* @param bufferedReader
* @param bufferedReader
* @throws IOException
* @throws IOException
*/
*/
private
String
textOutput
(
HttpServletResponse
httpServletResponse
,
BufferedReader
bufferedReader
)
throws
private
String
textOutput
Stream
(
HttpServletResponse
httpServletResponse
,
BufferedReader
bufferedReader
)
throws
IOException
{
IOException
{
String
res
=
""
;
String
res
=
""
;
httpServletResponse
.
setContentType
(
TEXT_EVENT_STREAM_CHARSET_UTF_8
);
httpServletResponse
.
setContentType
(
TEXT_EVENT_STREAM_CHARSET_UTF_8
);
...
@@ -888,7 +943,6 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
...
@@ -888,7 +943,6 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
for
(
String
key
:
updateKeys
)
{
for
(
String
key
:
updateKeys
)
{
Variable
variable
=
transformed
.
stream
().
filter
(
v
->
v
.
getKey
().
equals
(
key
)).
findFirst
().
get
();
Variable
variable
=
transformed
.
stream
().
filter
(
v
->
v
.
getKey
().
equals
(
key
)).
findFirst
().
get
();
map
.
put
(
variable
.
getKey
(),
variable
.
getVariableDefault
());
}
}
MemoryVariableWriter
.
addItem
(
identifier
,
map
);
MemoryVariableWriter
.
addItem
(
identifier
,
map
);
}
}
...
...
src/main/java/cn/com/poc/agent_application/convert/BizAgentApplicationApiConversationConvert.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
convert
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationApiConversationEntity
;
import
cn.com.poc.agent_application.model.BizAgentApplicationApiConversationModel
;
public
class
BizAgentApplicationApiConversationConvert
{
public
static
BizAgentApplicationApiConversationEntity
modelToEntity
(
BizAgentApplicationApiConversationModel
model
)
{
BizAgentApplicationApiConversationEntity
entity
=
new
BizAgentApplicationApiConversationEntity
();
entity
.
setId
(
model
.
getId
());
entity
.
setAgentId
(
model
.
getAgentId
());
entity
.
setConversationId
(
model
.
getConversationId
());
entity
.
setExpiredTime
(
model
.
getExpiredTime
());
entity
.
setIsDeleted
(
model
.
getIsDeleted
());
entity
.
setCreator
(
model
.
getCreator
());
entity
.
setCreatedTime
(
model
.
getCreatedTime
());
entity
.
setModifier
(
model
.
getModifier
());
entity
.
setModifiedTime
(
model
.
getModifiedTime
());
entity
.
setSysVersion
(
model
.
getSysVersion
());
return
entity
;
}
public
static
BizAgentApplicationApiConversationModel
entityToModel
(
BizAgentApplicationApiConversationEntity
entity
)
{
BizAgentApplicationApiConversationModel
model
=
new
BizAgentApplicationApiConversationModel
();
model
.
setId
(
entity
.
getId
());
model
.
setAgentId
(
entity
.
getAgentId
());
model
.
setConversationId
(
entity
.
getConversationId
());
model
.
setExpiredTime
(
entity
.
getExpiredTime
());
model
.
setIsDeleted
(
entity
.
getIsDeleted
());
model
.
setCreator
(
entity
.
getCreator
());
model
.
setCreatedTime
(
entity
.
getCreatedTime
());
model
.
setModifier
(
entity
.
getModifier
());
model
.
setModifiedTime
(
entity
.
getModifiedTime
());
model
.
setSysVersion
(
entity
.
getSysVersion
());
return
model
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/convert/BizAgentApplicationApiFilesConvert.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
convert
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationApiFilesEntity
;
import
cn.com.poc.agent_application.model.BizAgentApplicationApiFilesModel
;
public
class
BizAgentApplicationApiFilesConvert
{
public
static
BizAgentApplicationApiFilesEntity
modelToEntity
(
BizAgentApplicationApiFilesModel
model
)
{
BizAgentApplicationApiFilesEntity
entity
=
new
BizAgentApplicationApiFilesEntity
();
entity
.
setId
(
model
.
getId
());
entity
.
setAgentId
(
model
.
getAgentId
());
entity
.
setConversationId
(
model
.
getConversationId
());
entity
.
setFileId
(
model
.
getFileId
());
entity
.
setFileUrl
(
model
.
getFileUrl
());
entity
.
setExpiredTime
(
model
.
getExpiredTime
());
entity
.
setIsDeleted
(
model
.
getIsDeleted
());
entity
.
setCreator
(
model
.
getCreator
());
entity
.
setCreatedTime
(
model
.
getCreatedTime
());
entity
.
setModifier
(
model
.
getModifier
());
entity
.
setModifiedTime
(
model
.
getModifiedTime
());
entity
.
setSysVersion
(
model
.
getSysVersion
());
return
entity
;
}
public
static
BizAgentApplicationApiFilesModel
entityToModel
(
BizAgentApplicationApiFilesEntity
entity
)
{
BizAgentApplicationApiFilesModel
model
=
new
BizAgentApplicationApiFilesModel
();
model
.
setId
(
entity
.
getId
());
model
.
setAgentId
(
entity
.
getAgentId
());
model
.
setConversationId
(
entity
.
getConversationId
());
model
.
setFileId
(
entity
.
getFileId
());
model
.
setFileUrl
(
entity
.
getFileUrl
());
model
.
setExpiredTime
(
entity
.
getExpiredTime
());
model
.
setIsDeleted
(
entity
.
getIsDeleted
());
model
.
setCreator
(
entity
.
getCreator
());
model
.
setCreatedTime
(
entity
.
getCreatedTime
());
model
.
setModifier
(
entity
.
getModifier
());
model
.
setModifiedTime
(
entity
.
getModifiedTime
());
model
.
setSysVersion
(
entity
.
getSysVersion
());
return
model
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/entity/BizAgentApplicationApiConversationEntity.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
entity
;
public
class
BizAgentApplicationApiConversationEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** id
*
*/
private
java
.
lang
.
Long
id
;
public
java
.
lang
.
Long
getId
(){
return
this
.
id
;
}
public
void
setId
(
java
.
lang
.
Long
id
){
this
.
id
=
id
;
}
/** agent_id
*应用id
*/
private
java
.
lang
.
String
agentId
;
public
java
.
lang
.
String
getAgentId
(){
return
this
.
agentId
;
}
public
void
setAgentId
(
java
.
lang
.
String
agentId
){
this
.
agentId
=
agentId
;
}
/** conversation_id
*对话id
*/
private
java
.
lang
.
String
conversationId
;
public
java
.
lang
.
String
getConversationId
(){
return
this
.
conversationId
;
}
public
void
setConversationId
(
java
.
lang
.
String
conversationId
){
this
.
conversationId
=
conversationId
;
}
/** expired_time
*过期时间,有效期7天
*/
private
java
.
util
.
Date
expiredTime
;
public
java
.
util
.
Date
getExpiredTime
(){
return
this
.
expiredTime
;
}
public
void
setExpiredTime
(
java
.
util
.
Date
expiredTime
){
this
.
expiredTime
=
expiredTime
;
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
private
java
.
lang
.
String
isDeleted
;
public
java
.
lang
.
String
getIsDeleted
(){
return
this
.
isDeleted
;
}
public
void
setIsDeleted
(
java
.
lang
.
String
isDeleted
){
this
.
isDeleted
=
isDeleted
;
}
/** CREATOR
*创建人
*/
private
java
.
lang
.
String
creator
;
public
java
.
lang
.
String
getCreator
(){
return
this
.
creator
;
}
public
void
setCreator
(
java
.
lang
.
String
creator
){
this
.
creator
=
creator
;
}
/** CREATED_TIME
*创建时间
*/
private
java
.
util
.
Date
createdTime
;
public
java
.
util
.
Date
getCreatedTime
(){
return
this
.
createdTime
;
}
public
void
setCreatedTime
(
java
.
util
.
Date
createdTime
){
this
.
createdTime
=
createdTime
;
}
/** MODIFIER
*修改人
*/
private
java
.
lang
.
String
modifier
;
public
java
.
lang
.
String
getModifier
(){
return
this
.
modifier
;
}
public
void
setModifier
(
java
.
lang
.
String
modifier
){
this
.
modifier
=
modifier
;
}
/** MODIFIED_TIME
*修改时间
*/
private
java
.
util
.
Date
modifiedTime
;
public
java
.
util
.
Date
getModifiedTime
(){
return
this
.
modifiedTime
;
}
public
void
setModifiedTime
(
java
.
util
.
Date
modifiedTime
){
this
.
modifiedTime
=
modifiedTime
;
}
/** SYS_VERSION
*乐观锁,版本号
*/
private
java
.
lang
.
Integer
sysVersion
;
public
java
.
lang
.
Integer
getSysVersion
(){
return
this
.
sysVersion
;
}
public
void
setSysVersion
(
java
.
lang
.
Integer
sysVersion
){
this
.
sysVersion
=
sysVersion
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/entity/BizAgentApplicationApiFilesEntity.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
entity
;
public
class
BizAgentApplicationApiFilesEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** id
*
*/
private
java
.
lang
.
Long
id
;
public
java
.
lang
.
Long
getId
(){
return
this
.
id
;
}
public
void
setId
(
java
.
lang
.
Long
id
){
this
.
id
=
id
;
}
/** agent_id
*应用id
*/
private
java
.
lang
.
String
agentId
;
public
java
.
lang
.
String
getAgentId
(){
return
this
.
agentId
;
}
public
void
setAgentId
(
java
.
lang
.
String
agentId
){
this
.
agentId
=
agentId
;
}
/** conversation_id
*对话id
*/
private
java
.
lang
.
String
conversationId
;
public
java
.
lang
.
String
getConversationId
(){
return
this
.
conversationId
;
}
public
void
setConversationId
(
java
.
lang
.
String
conversationId
){
this
.
conversationId
=
conversationId
;
}
/** file_id
*文件id
*/
private
java
.
lang
.
String
fileId
;
public
java
.
lang
.
String
getFileId
(){
return
this
.
fileId
;
}
public
void
setFileId
(
java
.
lang
.
String
fileId
){
this
.
fileId
=
fileId
;
}
/** file_url
*文件地址
*/
private
java
.
lang
.
String
fileUrl
;
public
java
.
lang
.
String
getFileUrl
(){
return
this
.
fileUrl
;
}
public
void
setFileUrl
(
java
.
lang
.
String
fileUrl
){
this
.
fileUrl
=
fileUrl
;
}
/** expired_time
*过期时间,有效期7天
*/
private
java
.
util
.
Date
expiredTime
;
public
java
.
util
.
Date
getExpiredTime
(){
return
this
.
expiredTime
;
}
public
void
setExpiredTime
(
java
.
util
.
Date
expiredTime
){
this
.
expiredTime
=
expiredTime
;
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
private
java
.
lang
.
String
isDeleted
;
public
java
.
lang
.
String
getIsDeleted
(){
return
this
.
isDeleted
;
}
public
void
setIsDeleted
(
java
.
lang
.
String
isDeleted
){
this
.
isDeleted
=
isDeleted
;
}
/** CREATOR
*创建人
*/
private
java
.
lang
.
String
creator
;
public
java
.
lang
.
String
getCreator
(){
return
this
.
creator
;
}
public
void
setCreator
(
java
.
lang
.
String
creator
){
this
.
creator
=
creator
;
}
/** CREATED_TIME
*创建时间
*/
private
java
.
util
.
Date
createdTime
;
public
java
.
util
.
Date
getCreatedTime
(){
return
this
.
createdTime
;
}
public
void
setCreatedTime
(
java
.
util
.
Date
createdTime
){
this
.
createdTime
=
createdTime
;
}
/** MODIFIER
*修改人
*/
private
java
.
lang
.
String
modifier
;
public
java
.
lang
.
String
getModifier
(){
return
this
.
modifier
;
}
public
void
setModifier
(
java
.
lang
.
String
modifier
){
this
.
modifier
=
modifier
;
}
/** MODIFIED_TIME
*修改时间
*/
private
java
.
util
.
Date
modifiedTime
;
public
java
.
util
.
Date
getModifiedTime
(){
return
this
.
modifiedTime
;
}
public
void
setModifiedTime
(
java
.
util
.
Date
modifiedTime
){
this
.
modifiedTime
=
modifiedTime
;
}
/** SYS_VERSION
*乐观锁,版本号
*/
private
java
.
lang
.
Integer
sysVersion
;
public
java
.
lang
.
Integer
getSysVersion
(){
return
this
.
sysVersion
;
}
public
void
setSysVersion
(
java
.
lang
.
Integer
sysVersion
){
this
.
sysVersion
=
sysVersion
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/model/BizAgentApplicationApiConversationModel.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
model
;
import
java.io.Serializable
;
import
cn.com.yict.framemax.data.model.BaseModelClass
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
javax.persistence.Id
;
import
org.hibernate.annotations.DynamicInsert
;
import
org.hibernate.annotations.DynamicUpdate
;
import
javax.persistence.Version
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
/**
* Model class for biz_agent_application_api_conversation
* api对话创建记录
*/
@Entity
@Table
(
name
=
"biz_agent_application_api_conversation"
)
@DynamicInsert
@DynamicUpdate
public
class
BizAgentApplicationApiConversationModel
extends
BaseModelClass
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** id
*
*/
private
java
.
lang
.
Long
id
;
@Column
(
name
=
"id"
,
length
=
19
)
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
public
java
.
lang
.
Long
getId
(){
return
this
.
id
;
}
public
void
setId
(
java
.
lang
.
Long
id
){
this
.
id
=
id
;
super
.
addValidField
(
"id"
);
}
/** agent_id
*应用id
*/
private
java
.
lang
.
String
agentId
;
@Column
(
name
=
"agent_id"
,
length
=
120
)
public
java
.
lang
.
String
getAgentId
(){
return
this
.
agentId
;
}
public
void
setAgentId
(
java
.
lang
.
String
agentId
){
this
.
agentId
=
agentId
;
super
.
addValidField
(
"agentId"
);
}
/** conversation_id
*对话id
*/
private
java
.
lang
.
String
conversationId
;
@Column
(
name
=
"conversation_id"
,
length
=
120
)
public
java
.
lang
.
String
getConversationId
(){
return
this
.
conversationId
;
}
public
void
setConversationId
(
java
.
lang
.
String
conversationId
){
this
.
conversationId
=
conversationId
;
super
.
addValidField
(
"conversationId"
);
}
/** expired_time
*过期时间,有效期7天
*/
private
java
.
util
.
Date
expiredTime
;
@Column
(
name
=
"expired_time"
,
length
=
19
)
public
java
.
util
.
Date
getExpiredTime
(){
return
this
.
expiredTime
;
}
public
void
setExpiredTime
(
java
.
util
.
Date
expiredTime
){
this
.
expiredTime
=
expiredTime
;
super
.
addValidField
(
"expiredTime"
);
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
private
java
.
lang
.
String
isDeleted
;
@Column
(
name
=
"is_deleted"
,
length
=
1
)
public
java
.
lang
.
String
getIsDeleted
(){
return
this
.
isDeleted
;
}
public
void
setIsDeleted
(
java
.
lang
.
String
isDeleted
){
this
.
isDeleted
=
isDeleted
;
super
.
addValidField
(
"isDeleted"
);
}
/** CREATOR
*创建人
*/
private
java
.
lang
.
String
creator
;
@Column
(
name
=
"CREATOR"
,
length
=
225
)
public
java
.
lang
.
String
getCreator
(){
return
this
.
creator
;
}
public
void
setCreator
(
java
.
lang
.
String
creator
){
this
.
creator
=
creator
;
super
.
addValidField
(
"creator"
);
}
/** CREATED_TIME
*创建时间
*/
private
java
.
util
.
Date
createdTime
;
@Column
(
name
=
"CREATED_TIME"
,
length
=
19
)
public
java
.
util
.
Date
getCreatedTime
(){
return
this
.
createdTime
;
}
public
void
setCreatedTime
(
java
.
util
.
Date
createdTime
){
this
.
createdTime
=
createdTime
;
super
.
addValidField
(
"createdTime"
);
}
/** MODIFIER
*修改人
*/
private
java
.
lang
.
String
modifier
;
@Column
(
name
=
"MODIFIER"
,
length
=
225
)
public
java
.
lang
.
String
getModifier
(){
return
this
.
modifier
;
}
public
void
setModifier
(
java
.
lang
.
String
modifier
){
this
.
modifier
=
modifier
;
super
.
addValidField
(
"modifier"
);
}
/** MODIFIED_TIME
*修改时间
*/
private
java
.
util
.
Date
modifiedTime
;
@Column
(
name
=
"MODIFIED_TIME"
,
length
=
19
)
public
java
.
util
.
Date
getModifiedTime
(){
return
this
.
modifiedTime
;
}
public
void
setModifiedTime
(
java
.
util
.
Date
modifiedTime
){
this
.
modifiedTime
=
modifiedTime
;
super
.
addValidField
(
"modifiedTime"
);
}
/** SYS_VERSION
*乐观锁,版本号
*/
private
java
.
lang
.
Integer
sysVersion
;
@Column
(
name
=
"SYS_VERSION"
,
length
=
10
)
@Version
public
java
.
lang
.
Integer
getSysVersion
(){
return
this
.
sysVersion
;
}
public
void
setSysVersion
(
java
.
lang
.
Integer
sysVersion
){
this
.
sysVersion
=
sysVersion
;
super
.
addValidField
(
"sysVersion"
);
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/model/BizAgentApplicationApiFilesModel.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
model
;
import
java.io.Serializable
;
import
cn.com.yict.framemax.data.model.BaseModelClass
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
javax.persistence.Id
;
import
org.hibernate.annotations.DynamicInsert
;
import
org.hibernate.annotations.DynamicUpdate
;
import
javax.persistence.Version
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
/**
* Model class for biz_agent_application_api_files
* api对话文件记录
*/
@Entity
@Table
(
name
=
"biz_agent_application_api_files"
)
@DynamicInsert
@DynamicUpdate
public
class
BizAgentApplicationApiFilesModel
extends
BaseModelClass
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** id
*
*/
private
java
.
lang
.
Long
id
;
@Column
(
name
=
"id"
,
length
=
19
)
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
public
java
.
lang
.
Long
getId
(){
return
this
.
id
;
}
public
void
setId
(
java
.
lang
.
Long
id
){
this
.
id
=
id
;
super
.
addValidField
(
"id"
);
}
/** agent_id
*应用id
*/
private
java
.
lang
.
String
agentId
;
@Column
(
name
=
"agent_id"
,
length
=
120
)
public
java
.
lang
.
String
getAgentId
(){
return
this
.
agentId
;
}
public
void
setAgentId
(
java
.
lang
.
String
agentId
){
this
.
agentId
=
agentId
;
super
.
addValidField
(
"agentId"
);
}
/** conversation_id
*对话id
*/
private
java
.
lang
.
String
conversationId
;
@Column
(
name
=
"conversation_id"
,
length
=
120
)
public
java
.
lang
.
String
getConversationId
(){
return
this
.
conversationId
;
}
public
void
setConversationId
(
java
.
lang
.
String
conversationId
){
this
.
conversationId
=
conversationId
;
super
.
addValidField
(
"conversationId"
);
}
/** file_id
*文件id
*/
private
java
.
lang
.
String
fileId
;
@Column
(
name
=
"file_id"
,
length
=
120
)
public
java
.
lang
.
String
getFileId
(){
return
this
.
fileId
;
}
public
void
setFileId
(
java
.
lang
.
String
fileId
){
this
.
fileId
=
fileId
;
super
.
addValidField
(
"fileId"
);
}
/** file_url
*文件地址
*/
private
java
.
lang
.
String
fileUrl
;
@Column
(
name
=
"file_url"
,
length
=
200
)
public
java
.
lang
.
String
getFileUrl
(){
return
this
.
fileUrl
;
}
public
void
setFileUrl
(
java
.
lang
.
String
fileUrl
){
this
.
fileUrl
=
fileUrl
;
super
.
addValidField
(
"fileUrl"
);
}
/** expired_time
*过期时间,有效期7天
*/
private
java
.
util
.
Date
expiredTime
;
@Column
(
name
=
"expired_time"
,
length
=
19
)
public
java
.
util
.
Date
getExpiredTime
(){
return
this
.
expiredTime
;
}
public
void
setExpiredTime
(
java
.
util
.
Date
expiredTime
){
this
.
expiredTime
=
expiredTime
;
super
.
addValidField
(
"expiredTime"
);
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
private
java
.
lang
.
String
isDeleted
;
@Column
(
name
=
"is_deleted"
,
length
=
1
)
public
java
.
lang
.
String
getIsDeleted
(){
return
this
.
isDeleted
;
}
public
void
setIsDeleted
(
java
.
lang
.
String
isDeleted
){
this
.
isDeleted
=
isDeleted
;
super
.
addValidField
(
"isDeleted"
);
}
/** CREATOR
*创建人
*/
private
java
.
lang
.
String
creator
;
@Column
(
name
=
"CREATOR"
,
length
=
225
)
public
java
.
lang
.
String
getCreator
(){
return
this
.
creator
;
}
public
void
setCreator
(
java
.
lang
.
String
creator
){
this
.
creator
=
creator
;
super
.
addValidField
(
"creator"
);
}
/** CREATED_TIME
*创建时间
*/
private
java
.
util
.
Date
createdTime
;
@Column
(
name
=
"CREATED_TIME"
,
length
=
19
)
public
java
.
util
.
Date
getCreatedTime
(){
return
this
.
createdTime
;
}
public
void
setCreatedTime
(
java
.
util
.
Date
createdTime
){
this
.
createdTime
=
createdTime
;
super
.
addValidField
(
"createdTime"
);
}
/** MODIFIER
*修改人
*/
private
java
.
lang
.
String
modifier
;
@Column
(
name
=
"MODIFIER"
,
length
=
225
)
public
java
.
lang
.
String
getModifier
(){
return
this
.
modifier
;
}
public
void
setModifier
(
java
.
lang
.
String
modifier
){
this
.
modifier
=
modifier
;
super
.
addValidField
(
"modifier"
);
}
/** MODIFIED_TIME
*修改时间
*/
private
java
.
util
.
Date
modifiedTime
;
@Column
(
name
=
"MODIFIED_TIME"
,
length
=
19
)
public
java
.
util
.
Date
getModifiedTime
(){
return
this
.
modifiedTime
;
}
public
void
setModifiedTime
(
java
.
util
.
Date
modifiedTime
){
this
.
modifiedTime
=
modifiedTime
;
super
.
addValidField
(
"modifiedTime"
);
}
/** SYS_VERSION
*乐观锁,版本号
*/
private
java
.
lang
.
Integer
sysVersion
;
@Column
(
name
=
"SYS_VERSION"
,
length
=
10
)
@Version
public
java
.
lang
.
Integer
getSysVersion
(){
return
this
.
sysVersion
;
}
public
void
setSysVersion
(
java
.
lang
.
Integer
sysVersion
){
this
.
sysVersion
=
sysVersion
;
super
.
addValidField
(
"sysVersion"
);
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/repository/BizAgentApplicationApiConversationRepository.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
repository
;
import
cn.com.yict.framemax.data.repository.Repository
;
import
cn.com.poc.agent_application.model.BizAgentApplicationApiConversationModel
;
public
interface
BizAgentApplicationApiConversationRepository
extends
Repository
<
BizAgentApplicationApiConversationModel
,
java
.
lang
.
Long
>
{
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/repository/BizAgentApplicationApiFilesRepository.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
repository
;
import
cn.com.yict.framemax.data.repository.Repository
;
import
cn.com.poc.agent_application.model.BizAgentApplicationApiFilesModel
;
public
interface
BizAgentApplicationApiFilesRepository
extends
Repository
<
BizAgentApplicationApiFilesModel
,
java
.
lang
.
Long
>
{
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/rest/impl/AgentApplicationInfoRestImpl.java
View file @
e3f31de2
...
@@ -264,7 +264,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -264,7 +264,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
//调用应用服务
//调用应用服务
agentApplicationInfoService
.
callAgentApplication
(
agentId
,
dialogueId
,
model
,
agentApplicationInfoService
.
callAgentApplication
(
agentId
,
dialogueId
,
model
,
agentSystem
,
kdIds
.
toArray
(
new
Integer
[
0
]),
infoEntity
.
getCommunicationTurn
(),
topP
,
agentSystem
,
kdIds
.
toArray
(
new
Integer
[
0
]),
infoEntity
.
getCommunicationTurn
(),
topP
,
temperature
,
dto
.
getMessages
(),
tools
,
dto
.
getFileUrls
(),
httpServletResponse
);
temperature
,
dto
.
getMessages
(),
tools
,
dto
.
getFileUrls
(),
true
,
httpServletResponse
);
//数据采集
//数据采集
dataReport
(
dto
,
userBaseEntity
,
agentId
,
pointDeductionNum
);
dataReport
(
dto
,
userBaseEntity
,
agentId
,
pointDeductionNum
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/main/java/cn/com/poc/agent_application/service/BizAgentApplicationApiConversationService.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
service
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationApiConversationEntity
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
BizAgentApplicationApiConversationService
extends
BaseService
{
BizAgentApplicationApiConversationEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
;
BizAgentApplicationApiConversationEntity
getByConversationId
(
String
conversationId
);
List
<
BizAgentApplicationApiConversationEntity
>
findByExample
(
BizAgentApplicationApiConversationEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
BizAgentApplicationApiConversationEntity
save
(
BizAgentApplicationApiConversationEntity
entity
)
throws
Exception
;
BizAgentApplicationApiConversationEntity
update
(
BizAgentApplicationApiConversationEntity
entity
)
throws
Exception
;
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/service/BizAgentApplicationApiFilesService.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
service
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationApiFilesEntity
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
BizAgentApplicationApiFilesService
extends
BaseService
{
BizAgentApplicationApiFilesEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
;
List
<
BizAgentApplicationApiFilesEntity
>
findByExample
(
BizAgentApplicationApiFilesEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
BizAgentApplicationApiFilesEntity
save
(
BizAgentApplicationApiFilesEntity
entity
)
throws
Exception
;
BizAgentApplicationApiFilesEntity
update
(
BizAgentApplicationApiFilesEntity
entity
)
throws
Exception
;
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/service/BizAgentApplicationApiProfileService.java
View file @
e3f31de2
...
@@ -12,6 +12,8 @@ public interface BizAgentApplicationApiProfileService extends BaseService {
...
@@ -12,6 +12,8 @@ public interface BizAgentApplicationApiProfileService extends BaseService {
BizAgentApplicationApiProfileEntity
initProfile
(
Long
memberId
);
BizAgentApplicationApiProfileEntity
initProfile
(
Long
memberId
);
BizAgentApplicationApiProfileEntity
getByKeyAndSecret
(
String
key
,
String
secret
);
List
<
BizAgentApplicationApiProfileEntity
>
findByExample
(
BizAgentApplicationApiProfileEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
List
<
BizAgentApplicationApiProfileEntity
>
findByExample
(
BizAgentApplicationApiProfileEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
BizAgentApplicationApiProfileEntity
save
(
BizAgentApplicationApiProfileEntity
entity
)
throws
Exception
;
BizAgentApplicationApiProfileEntity
save
(
BizAgentApplicationApiProfileEntity
entity
)
throws
Exception
;
...
...
src/main/java/cn/com/poc/agent_application/service/impl/BizAgentApplicationApiConversationServiceImpl.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
service
.
impl
;
import
cn.com.poc.common.constant.CommonConstant
;
import
cn.com.yict.framemax.core.service.impl.BaseServiceImpl
;
import
cn.com.poc.agent_application.service.BizAgentApplicationApiConversationService
;
import
cn.com.poc.agent_application.model.BizAgentApplicationApiConversationModel
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationApiConversationEntity
;
import
cn.com.poc.agent_application.convert.BizAgentApplicationApiConversationConvert
;
import
cn.com.poc.agent_application.repository.BizAgentApplicationApiConversationRepository
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
org.springframework.stereotype.Service
;
import
org.apache.commons.collections4.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.stream.Collectors
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
org.springframework.util.Assert
;
@Service
public
class
BizAgentApplicationApiConversationServiceImpl
extends
BaseServiceImpl
implements
BizAgentApplicationApiConversationService
{
@Resource
private
BizAgentApplicationApiConversationRepository
repository
;
public
BizAgentApplicationApiConversationEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizAgentApplicationApiConversationModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
==
null
)
{
return
null
;
}
if
(
"Y"
.
equals
(
model
.
getIsDeleted
()))
{
return
null
;
}
return
BizAgentApplicationApiConversationConvert
.
modelToEntity
(
model
);
}
@Override
public
BizAgentApplicationApiConversationEntity
getByConversationId
(
String
conversationId
)
{
BizAgentApplicationApiConversationModel
model
=
new
BizAgentApplicationApiConversationModel
();
model
.
setConversationId
(
conversationId
);
model
.
setIsDeleted
(
CommonConstant
.
IsDeleted
.
N
);
List
<
BizAgentApplicationApiConversationModel
>
models
=
this
.
repository
.
findByExample
(
model
,
null
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
return
BizAgentApplicationApiConversationConvert
.
modelToEntity
(
models
.
get
(
0
));
}
return
null
;
}
public
List
<
BizAgentApplicationApiConversationEntity
>
findByExample
(
BizAgentApplicationApiConversationEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizAgentApplicationApiConversationEntity
>
result
=
new
ArrayList
<
BizAgentApplicationApiConversationEntity
>();
BizAgentApplicationApiConversationModel
model
=
new
BizAgentApplicationApiConversationModel
();
if
(
example
!=
null
)
{
model
=
BizAgentApplicationApiConversationConvert
.
entityToModel
(
example
);
}
model
.
setIsDeleted
(
"N"
);
List
<
BizAgentApplicationApiConversationModel
>
models
=
this
.
repository
.
findByExample
(
model
,
pagingInfo
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
result
=
models
.
stream
().
map
(
BizAgentApplicationApiConversationConvert:
:
modelToEntity
).
collect
(
Collectors
.
toList
());
}
return
result
;
}
public
BizAgentApplicationApiConversationEntity
save
(
BizAgentApplicationApiConversationEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
entity
.
setId
(
null
);
entity
.
setIsDeleted
(
"N"
);
BizAgentApplicationApiConversationModel
model
=
BizAgentApplicationApiConversationConvert
.
entityToModel
(
entity
);
BizAgentApplicationApiConversationModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAgentApplicationApiConversationConvert
.
modelToEntity
(
saveModel
);
}
public
BizAgentApplicationApiConversationEntity
update
(
BizAgentApplicationApiConversationEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
.
getId
(),
"update pk can not be null"
);
BizAgentApplicationApiConversationModel
model
=
this
.
repository
.
get
(
entity
.
getId
());
if
(
entity
.
getAgentId
()
!=
null
)
{
model
.
setAgentId
(
entity
.
getAgentId
());
}
if
(
entity
.
getConversationId
()
!=
null
)
{
model
.
setConversationId
(
entity
.
getConversationId
());
}
if
(
entity
.
getExpiredTime
()
!=
null
)
{
model
.
setExpiredTime
(
entity
.
getExpiredTime
());
}
if
(
entity
.
getIsDeleted
()
!=
null
)
{
model
.
setIsDeleted
(
entity
.
getIsDeleted
());
}
if
(
entity
.
getCreator
()
!=
null
)
{
model
.
setCreator
(
entity
.
getCreator
());
}
if
(
entity
.
getCreatedTime
()
!=
null
)
{
model
.
setCreatedTime
(
entity
.
getCreatedTime
());
}
if
(
entity
.
getModifier
()
!=
null
)
{
model
.
setModifier
(
entity
.
getModifier
());
}
if
(
entity
.
getModifiedTime
()
!=
null
)
{
model
.
setModifiedTime
(
entity
.
getModifiedTime
());
}
if
(
entity
.
getSysVersion
()
!=
null
)
{
model
.
setSysVersion
(
entity
.
getSysVersion
());
}
BizAgentApplicationApiConversationModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAgentApplicationApiConversationConvert
.
modelToEntity
(
saveModel
);
}
public
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizAgentApplicationApiConversationModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
!=
null
)
{
if
(
"N"
.
equals
(
model
.
getIsDeleted
()))
{
model
.
setIsDeleted
(
"Y"
);
this
.
repository
.
save
(
model
);
}
}
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/service/impl/BizAgentApplicationApiFilesServiceImpl.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
agent_application
.
service
.
impl
;
import
cn.com.yict.framemax.core.service.impl.BaseServiceImpl
;
import
cn.com.poc.agent_application.service.BizAgentApplicationApiFilesService
;
import
cn.com.poc.agent_application.model.BizAgentApplicationApiFilesModel
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationApiFilesEntity
;
import
cn.com.poc.agent_application.convert.BizAgentApplicationApiFilesConvert
;
import
cn.com.poc.agent_application.repository.BizAgentApplicationApiFilesRepository
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
org.springframework.stereotype.Service
;
import
org.apache.commons.collections4.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.stream.Collectors
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
org.springframework.util.Assert
;
@Service
public
class
BizAgentApplicationApiFilesServiceImpl
extends
BaseServiceImpl
implements
BizAgentApplicationApiFilesService
{
@Resource
private
BizAgentApplicationApiFilesRepository
repository
;
public
BizAgentApplicationApiFilesEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizAgentApplicationApiFilesModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
==
null
){
return
null
;
}
if
(
"Y"
.
equals
(
model
.
getIsDeleted
())){
return
null
;
}
return
BizAgentApplicationApiFilesConvert
.
modelToEntity
(
model
);
}
public
List
<
BizAgentApplicationApiFilesEntity
>
findByExample
(
BizAgentApplicationApiFilesEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizAgentApplicationApiFilesEntity
>
result
=
new
ArrayList
<
BizAgentApplicationApiFilesEntity
>();
BizAgentApplicationApiFilesModel
model
=
new
BizAgentApplicationApiFilesModel
();
if
(
example
!=
null
){
model
=
BizAgentApplicationApiFilesConvert
.
entityToModel
(
example
);
}
model
.
setIsDeleted
(
"N"
);
List
<
BizAgentApplicationApiFilesModel
>
models
=
this
.
repository
.
findByExample
(
model
,
pagingInfo
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
result
=
models
.
stream
().
map
(
BizAgentApplicationApiFilesConvert:
:
modelToEntity
).
collect
(
Collectors
.
toList
());
}
return
result
;
}
public
BizAgentApplicationApiFilesEntity
save
(
BizAgentApplicationApiFilesEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
entity
.
setId
(
null
);
entity
.
setIsDeleted
(
"N"
);
BizAgentApplicationApiFilesModel
model
=
BizAgentApplicationApiFilesConvert
.
entityToModel
(
entity
);
BizAgentApplicationApiFilesModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAgentApplicationApiFilesConvert
.
modelToEntity
(
saveModel
);
}
public
BizAgentApplicationApiFilesEntity
update
(
BizAgentApplicationApiFilesEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
.
getId
(),
"update pk can not be null"
);
BizAgentApplicationApiFilesModel
model
=
this
.
repository
.
get
(
entity
.
getId
());
if
(
entity
.
getAgentId
()
!=
null
){
model
.
setAgentId
(
entity
.
getAgentId
());
}
if
(
entity
.
getConversationId
()
!=
null
){
model
.
setConversationId
(
entity
.
getConversationId
());
}
if
(
entity
.
getFileId
()
!=
null
){
model
.
setFileId
(
entity
.
getFileId
());
}
if
(
entity
.
getFileUrl
()
!=
null
){
model
.
setFileUrl
(
entity
.
getFileUrl
());
}
if
(
entity
.
getExpiredTime
()
!=
null
){
model
.
setExpiredTime
(
entity
.
getExpiredTime
());
}
if
(
entity
.
getIsDeleted
()
!=
null
){
model
.
setIsDeleted
(
entity
.
getIsDeleted
());
}
if
(
entity
.
getCreator
()
!=
null
){
model
.
setCreator
(
entity
.
getCreator
());
}
if
(
entity
.
getCreatedTime
()
!=
null
){
model
.
setCreatedTime
(
entity
.
getCreatedTime
());
}
if
(
entity
.
getModifier
()
!=
null
){
model
.
setModifier
(
entity
.
getModifier
());
}
if
(
entity
.
getModifiedTime
()
!=
null
){
model
.
setModifiedTime
(
entity
.
getModifiedTime
());
}
if
(
entity
.
getSysVersion
()
!=
null
){
model
.
setSysVersion
(
entity
.
getSysVersion
());
}
BizAgentApplicationApiFilesModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAgentApplicationApiFilesConvert
.
modelToEntity
(
saveModel
);
}
public
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizAgentApplicationApiFilesModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
!=
null
){
if
(
"N"
.
equals
(
model
.
getIsDeleted
())){
model
.
setIsDeleted
(
"Y"
);
this
.
repository
.
save
(
model
);
}
}
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/service/impl/BizAgentApplicationApiProfileServiceImpl.java
View file @
e3f31de2
...
@@ -25,9 +25,8 @@ import java.util.stream.Collectors;
...
@@ -25,9 +25,8 @@ import java.util.stream.Collectors;
@Service
@Service
public
class
BizAgentApplicationApiProfileServiceImpl
extends
BaseServiceImpl
public
class
BizAgentApplicationApiProfileServiceImpl
extends
BaseServiceImpl
implements
BizAgentApplicationApiProfileService
{
implements
BizAgentApplicationApiProfileService
{
private
SnowflakeGenerator
snowflakeGenerator
=
new
SnowflakeGenerator
();
// 存储agentId到锁对象的映射
private
final
ConcurrentHashMap
<
Long
,
Lock
>
initProfileLocks
=
new
ConcurrentHashMap
<>();
@Resource
@Resource
private
BizAgentApplicationApiProfileRepository
repository
;
private
BizAgentApplicationApiProfileRepository
repository
;
...
@@ -45,14 +44,10 @@ public class BizAgentApplicationApiProfileServiceImpl extends BaseServiceImpl
...
@@ -45,14 +44,10 @@ public class BizAgentApplicationApiProfileServiceImpl extends BaseServiceImpl
@Override
@Override
public
BizAgentApplicationApiProfileEntity
initProfile
(
Long
memberId
)
{
public
BizAgentApplicationApiProfileEntity
initProfile
(
Long
memberId
)
{
Lock
lock
=
initProfileLocks
.
computeIfAbsent
(
memberId
,
k
->
new
ReentrantLock
());
lock
.
lock
();
// 获取锁
try
{
BizAgentApplicationApiProfileEntity
entity
=
this
.
getByMemberId
(
memberId
);
BizAgentApplicationApiProfileEntity
entity
=
this
.
getByMemberId
(
memberId
);
if
(
entity
==
null
)
{
if
(
entity
==
null
)
{
BizAgentApplicationApiProfileModel
model
=
new
BizAgentApplicationApiProfileModel
();
BizAgentApplicationApiProfileModel
model
=
new
BizAgentApplicationApiProfileModel
();
model
.
setMemberId
(
memberId
);
model
.
setMemberId
(
memberId
);
SnowflakeGenerator
snowflakeGenerator
=
new
SnowflakeGenerator
();
model
.
setApiKey
(
snowflakeGenerator
.
next
().
toString
());
model
.
setApiKey
(
snowflakeGenerator
.
next
().
toString
());
model
.
setApiSecret
(
UUIDTool
.
getUUID
());
model
.
setApiSecret
(
UUIDTool
.
getUUID
());
model
.
setIsDeleted
(
CommonConstant
.
IsDeleted
.
N
);
model
.
setIsDeleted
(
CommonConstant
.
IsDeleted
.
N
);
...
@@ -60,10 +55,19 @@ public class BizAgentApplicationApiProfileServiceImpl extends BaseServiceImpl
...
@@ -60,10 +55,19 @@ public class BizAgentApplicationApiProfileServiceImpl extends BaseServiceImpl
entity
=
BizAgentApplicationApiProfileConvert
.
modelToEntity
(
saveModel
);
entity
=
BizAgentApplicationApiProfileConvert
.
modelToEntity
(
saveModel
);
}
}
return
entity
;
return
entity
;
}
finally
{
lock
.
unlock
();
}
}
@Override
public
BizAgentApplicationApiProfileEntity
getByKeyAndSecret
(
String
key
,
String
secret
)
{
BizAgentApplicationApiProfileModel
model
=
new
BizAgentApplicationApiProfileModel
();
model
.
setApiKey
(
key
);
model
.
setApiSecret
(
secret
);
model
.
setIsDeleted
(
CommonConstant
.
IsDeleted
.
N
);
List
<
BizAgentApplicationApiProfileModel
>
models
=
this
.
repository
.
findByExample
(
model
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
return
BizAgentApplicationApiProfileConvert
.
modelToEntity
(
models
.
get
(
0
));
}
return
null
;
}
}
public
List
<
BizAgentApplicationApiProfileEntity
>
findByExample
(
BizAgentApplicationApiProfileEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
public
List
<
BizAgentApplicationApiProfileEntity
>
findByExample
(
BizAgentApplicationApiProfileEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
...
...
src/main/java/cn/com/poc/expose/aggregate/AgentApplicationApiService.java
0 → 100644
View file @
e3f31de2
package
cn
.
com
.
poc
.
expose
.
aggregate
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* Agent应用-API服务接口
*
* @author alex.yao
* @date 2024/12/19
*/
public
interface
AgentApplicationApiService
{
/**
* 新建对话ID
* 有效期为7天,过期后将无法使用。
*
* @param apiKey API密钥
* @param apiSecret API密钥
* @return 对话ID
*/
String
conversation
(
String
apiKey
,
String
apiSecret
,
String
agentId
)
throws
Exception
;
/**
* API-对话
*
* @param apiKey API密钥
* @param apiSecret API密钥
* @param conversationId 对话ID
* @param fileIds 文件ID列表
* @param query 消息
* @param stream 是否流式输出
* @param httpServletResponse
*/
void
completions
(
String
apiKey
,
String
apiSecret
,
String
conversationId
,
List
<
String
>
fileIds
,
String
query
,
boolean
stream
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
/**
* 上传文件
* 该接口用于在对话中上传文件供大模型处理,文件的有效期为7天并且不超过对话的有效期。一次只能上传一个文件。
*
* @param apiKey API密钥
* @param apiSecret API密钥
* @param agentId Agent ID
* @param conversationId 对话ID
* @param file 文件
* @return 文件ID
*/
String
uploadFile
(
String
apiKey
,
String
apiSecret
,
String
agentId
,
String
conversationId
,
MultipartFile
file
)
throws
Exception
;
}
src/main/java/cn/com/poc/expose/aggregate/impl/AgentApplicationApiServiceImpl.java
0 → 100644
View file @
e3f31de2
This diff is collapsed.
Click to expand it.
src/main/java/cn/com/poc/expose/aggregate/impl/AgentApplicationServiceImpl.java
View file @
e3f31de2
...
@@ -179,7 +179,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
...
@@ -179,7 +179,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
//对话
//对话
String
output
=
agentApplicationInfoService
.
callAgentApplication
(
agentId
,
dialogsId
,
infoEntity
.
getLargeModel
(),
String
output
=
agentApplicationInfoService
.
callAgentApplication
(
agentId
,
dialogsId
,
infoEntity
.
getLargeModel
(),
infoEntity
.
getAgentSystem
(),
kdIdList
.
toArray
(
new
Integer
[
0
]),
infoEntity
.
getCommunicationTurn
(),
infoEntity
.
getAgentSystem
(),
kdIdList
.
toArray
(
new
Integer
[
0
]),
infoEntity
.
getCommunicationTurn
(),
infoEntity
.
getTopP
(),
infoEntity
.
getTemperature
(),
messages
,
tools
,
fileUrls
,
httpServletResponse
);
infoEntity
.
getTopP
(),
infoEntity
.
getTemperature
(),
messages
,
tools
,
fileUrls
,
true
,
httpServletResponse
);
//保存对话记录
//保存对话记录
outputRecord
.
setContent
(
output
);
outputRecord
.
setContent
(
output
);
...
...
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