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
88ca063e
Commit
88ca063e
authored
Jun 26, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:AI+财务 记录function记录
parent
b899682f
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
89 additions
and
4 deletions
+89
-4
AgentApplicationServiceImpl.java
...plication/aggregate/impl/AgentApplicationServiceImpl.java
+7
-4
BizAgentApplicationDialoguesRecordConvert.java
...on/convert/BizAgentApplicationDialoguesRecordConvert.java
+2
-0
AgentResultEntity.java
...n/com/poc/agent_application/entity/AgentResultEntity.java
+12
-0
BizAgentApplicationDialoguesRecordEntity.java
...tion/entity/BizAgentApplicationDialoguesRecordEntity.java
+13
-0
BizAgentApplicationDialoguesRecordModel.java
...cation/model/BizAgentApplicationDialoguesRecordModel.java
+16
-0
AgentApplicationDialoguesRecordQuery.sql
...pplication/query/AgentApplicationDialoguesRecordQuery.sql
+1
-0
AgentApplicationDialoguesRecordQueryItem.java
...ation/query/AgentApplicationDialoguesRecordQueryItem.java
+14
-0
AiDialoguesServiceImpl.java
...c/ai_dialogues/aggregate/impl/AiDialoguesServiceImpl.java
+5
-0
AiFinanceServiceImpl.java
...m/poc/ai_finance/aggregate/impl/AiFinanceServiceImpl.java
+4
-0
DialoguesContextDto.java
src/main/java/cn/com/poc/expose/dto/DialoguesContextDto.java
+15
-0
No files found.
src/main/java/cn/com/poc/agent_application/aggregate/impl/AgentApplicationServiceImpl.java
View file @
88ca063e
...
...
@@ -621,7 +621,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
BufferedReader
bufferedReader
=
llmService
.
chatChunk
(
largeModelResponse
);
SSEUtil
sseUtil
=
new
SSEUtil
(
httpServletResponse
);
textOutputStream
(
sseUtil
,
bufferedReader
);
textOutputStream
(
sseUtil
,
bufferedReader
,
null
);
return
null
;
}
...
...
@@ -642,6 +642,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
private
AgentResultEntity
llmExecutorAndOutput
(
Float
topP
,
boolean
stream
,
String
model
,
Message
[]
messageArray
,
FunctionResult
functionResult
,
List
<
KnowledgeContentResult
>
knowledgeResult
,
List
<
DBChainResult
>
dbChainResults
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
if
(
stream
)
{
SSEUtil
sseUtil
=
new
SSEUtil
(
httpServletResponse
);
ToolFunction
toolFunction
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
dbChainResults
))
{
LargeModelDemandResult
result
=
new
LargeModelDemandResult
();
result
.
setCode
(
"0"
);
...
...
@@ -661,14 +662,14 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
if
(
ObjectUtil
.
isNotNull
(
functionResult
)
&&
StringUtils
.
isNotBlank
(
functionResult
.
getFunctionName
()))
{
LargeModelDemandResult
result
=
new
LargeModelDemandResult
();
result
.
setCode
(
"0"
);
ToolFunction
toolFunction
=
functionResultConvertToolFunction
(
functionResult
);
toolFunction
=
functionResultConvertToolFunction
(
functionResult
);
result
.
setFunction
(
toolFunction
);
result
.
setDbChainResult
(
null
);
result
.
setKnowledgeContentResult
(
null
);
sseUtil
.
send
(
JsonUtils
.
serialize
(
result
));
}
BufferedReader
bufferedReader
=
invokeLLMStream
(
model
,
messageArray
,
topP
);
return
textOutputStream
(
sseUtil
,
bufferedReader
);
return
textOutputStream
(
sseUtil
,
bufferedReader
,
toolFunction
);
}
else
{
LargeModelDemandResult
largeModelDemandResult
=
invokeLLM
(
model
,
messageArray
,
topP
);
if
(
ObjectUtil
.
isNotNull
(
functionResult
)
&&
StringUtils
.
isNotBlank
(
functionResult
.
getFunctionName
()))
{
...
...
@@ -882,6 +883,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
AgentResultEntity
agentResultEntity
=
new
AgentResultEntity
();
agentResultEntity
.
setMessage
(
largeModelDemandResult
.
getMessage
());
agentResultEntity
.
setReasoningContent
(
largeModelDemandResult
.
getReasoningContent
());
agentResultEntity
.
setFunction
(
largeModelDemandResult
.
getFunction
());
return
agentResultEntity
;
}
...
...
@@ -892,7 +894,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
* @param bufferedReader
* @throws IOException
*/
private
AgentResultEntity
textOutputStream
(
SSEUtil
sseUtil
,
BufferedReader
bufferedReader
)
{
private
AgentResultEntity
textOutputStream
(
SSEUtil
sseUtil
,
BufferedReader
bufferedReader
,
ToolFunction
toolFunction
)
{
String
res
=
""
;
StringBuilder
output
=
new
StringBuilder
();
StringBuilder
reasoningContent
=
new
StringBuilder
();
...
...
@@ -934,6 +936,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
AgentResultEntity
agentResultEntity
=
new
AgentResultEntity
();
agentResultEntity
.
setMessage
(
output
.
toString
());
agentResultEntity
.
setReasoningContent
(
reasoningContent
.
toString
());
agentResultEntity
.
setFunction
(
toolFunction
);
return
agentResultEntity
;
}
}
...
...
src/main/java/cn/com/poc/agent_application/convert/BizAgentApplicationDialoguesRecordConvert.java
View file @
88ca063e
...
...
@@ -17,6 +17,7 @@ public class BizAgentApplicationDialoguesRecordConvert {
entity
.
setReasoningContent
(
model
.
getReasoningContent
());
entity
.
setImageUrl
(
model
.
getImageUrl
());
entity
.
setFileUrl
(
model
.
getFileUrl
());
entity
.
setFunction
(
model
.
getFunction
());
entity
.
setDialogsId
(
model
.
getDialogsId
());
entity
.
setTimestamp
(
model
.
getTimestamp
());
entity
.
setIsDeleted
(
model
.
getIsDeleted
());
...
...
@@ -37,6 +38,7 @@ public class BizAgentApplicationDialoguesRecordConvert {
model
.
setDialogsId
(
entity
.
getDialogsId
());
model
.
setContent
(
entity
.
getContent
());
model
.
setReasoningContent
(
entity
.
getReasoningContent
());
model
.
setFunction
(
entity
.
getFunction
());
model
.
setImageUrl
(
entity
.
getImageUrl
());
model
.
setFileUrl
(
entity
.
getFileUrl
());
model
.
setTimestamp
(
entity
.
getTimestamp
());
...
...
src/main/java/cn/com/poc/agent_application/entity/AgentResultEntity.java
View file @
88ca063e
package
cn
.
com
.
poc
.
agent_application
.
entity
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.ToolFunction
;
/**
* @author alex.yao
* @date 2025/2/27
...
...
@@ -10,6 +12,16 @@ public class AgentResultEntity {
private
String
reasoningContent
;
private
ToolFunction
function
;
public
ToolFunction
getFunction
()
{
return
function
;
}
public
void
setFunction
(
ToolFunction
function
)
{
this
.
function
=
function
;
}
public
String
getMessage
()
{
return
message
;
}
...
...
src/main/java/cn/com/poc/agent_application/entity/BizAgentApplicationDialoguesRecordEntity.java
View file @
88ca063e
...
...
@@ -116,6 +116,19 @@ public class BizAgentApplicationDialoguesRecordEntity {
this
.
fileUrl
=
fileUrl
;
}
/**
* 插件响应数据
*/
private
java
.
lang
.
String
function
;
public
String
getFunction
()
{
return
function
;
}
public
void
setFunction
(
String
function
)
{
this
.
function
=
function
;
}
/**
* dialogsId
* 对话ID
...
...
src/main/java/cn/com/poc/agent_application/model/BizAgentApplicationDialoguesRecordModel.java
View file @
88ca063e
...
...
@@ -176,6 +176,22 @@ public class BizAgentApplicationDialoguesRecordModel extends BaseModelClass impl
this
.
fileUrl
=
fileUrl
;
}
/**
* function_result
* 插件响应数据
*/
private
java
.
lang
.
String
function
;
@Column
(
name
=
"function_result"
,
length
=
2147483647
)
public
java
.
lang
.
String
getFunction
()
{
return
this
.
function
;
}
public
void
setFunction
(
java
.
lang
.
String
function
)
{
this
.
function
=
function
;
super
.
addValidField
(
"function"
);
}
/**
* timestamp
* 时间戳
...
...
src/main/java/cn/com/poc/agent_application/query/AgentApplicationDialoguesRecordQuery.sql
View file @
88ca063e
...
...
@@ -5,6 +5,7 @@ select
baadr
.
member_id
,
baadr
.
content
,
baadr
.
reasoning_content
,
baadr
.
function_result
,
baadr
.
image_url
,
baadr
.
`timestamp`
,
baap
.
agent_avatar
,
...
...
src/main/java/cn/com/poc/agent_application/query/AgentApplicationDialoguesRecordQueryItem.java
View file @
88ca063e
...
...
@@ -103,6 +103,20 @@ public class AgentApplicationDialoguesRecordQueryItem extends BaseItemClass impl
this
.
reasoningContent
=
reasoningContent
;
}
/**
* function
*/
private
java
.
lang
.
String
function
;
@Column
(
name
=
"function_result"
)
public
String
getFunction
()
{
return
function
;
}
public
void
setFunction
(
String
function
)
{
this
.
function
=
function
;
}
/**
* image_url
* 图片链接
...
...
src/main/java/cn/com/poc/ai_dialogues/aggregate/impl/AiDialoguesServiceImpl.java
View file @
88ca063e
...
...
@@ -13,8 +13,10 @@ import cn.com.poc.ai_dialogues.service.BizAiDialoguesProblemAssociationService;
import
cn.com.poc.ai_dialogues.service.BizAiDialoguesService
;
import
cn.com.poc.common.constant.CommonConstant
;
import
cn.com.poc.common.service.BizFileUploadRecordService
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.common.utils.StringUtils
;
import
cn.com.poc.expose.dto.DialoguesContextDto
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.ToolFunction
;
import
cn.com.yict.framemax.core.exception.BusinessException
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.slf4j.Logger
;
...
...
@@ -147,6 +149,9 @@ public class AiDialoguesServiceImpl implements AiDialoguesService {
dto
.
setRole
(
value
.
getRole
());
dto
.
setAgentId
(
value
.
getAgentId
());
dto
.
setContent
(
value
.
getContent
());
if
(
StringUtils
.
isNotBlank
(
value
.
getFunction
()))
{
dto
.
setFunction
(
JsonUtils
.
deSerialize
(
value
.
getFunction
(),
ToolFunction
.
class
));
}
dto
.
setReasoningContent
(
value
.
getReasoningContent
());
dto
.
setImageUrl
(
value
.
getImageUrl
());
dto
.
setTimestamp
(
value
.
getTimestamp
());
...
...
src/main/java/cn/com/poc/ai_finance/aggregate/impl/AiFinanceServiceImpl.java
View file @
88ca063e
...
...
@@ -10,6 +10,7 @@ import cn.com.poc.ai_dialogues.entity.BizAiDialoguesEntity;
import
cn.com.poc.ai_dialogues.service.BizAiDialoguesService
;
import
cn.com.poc.ai_finance.aggregate.AiFinanceService
;
import
cn.com.poc.common.constant.CommonConstant
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.common.utils.StringUtils
;
import
cn.com.poc.knowledge.aggregate.KnowledgeService
;
import
cn.com.poc.thirdparty.resource.demand.ai.constants.KnowledgeSearchTypeEnum
;
...
...
@@ -155,6 +156,9 @@ public class AiFinanceServiceImpl implements AiFinanceService {
outputRecord
.
setAgentId
(
infoEntity
.
getAgentId
());
outputRecord
.
setDialogsId
(
dialoguesId
);
outputRecord
.
setMemberId
(
userId
);
if
(
agentResultEntity
.
getFunction
()
!=
null
)
{
outputRecord
.
setFunction
(
JsonUtils
.
serialize
(
agentResultEntity
.
getFunction
()));
}
outputRecord
.
setTimestamp
(
System
.
currentTimeMillis
());
outputRecord
.
setContent
(
agentResultEntity
.
getMessage
());
outputRecord
.
setReasoningContent
(
agentResultEntity
.
getReasoningContent
());
...
...
src/main/java/cn/com/poc/expose/dto/DialoguesContextDto.java
View file @
88ca063e
package
cn
.
com
.
poc
.
expose
.
dto
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.ToolFunction
;
import
java.io.Serializable
;
public
class
DialoguesContextDto
implements
Serializable
{
...
...
@@ -60,6 +62,19 @@ public class DialoguesContextDto implements Serializable {
this
.
reasoningContent
=
reasoningContent
;
}
/**
* function 响应数据
*/
private
ToolFunction
function
;
public
ToolFunction
getFunction
()
{
return
function
;
}
public
void
setFunction
(
ToolFunction
function
)
{
this
.
function
=
function
;
}
/**
* timestamp
* 时间戳
...
...
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