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
b9bc3a01
Commit
b9bc3a01
authored
Jan 22, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 【【POE】-【应用】web端和移动端使用提取文字插件报“null”】 --bug=1009892
parent
7f9c9ab0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
9 deletions
+20
-9
AgentApplicationInfoRestImpl.java
...t_application/rest/impl/AgentApplicationInfoRestImpl.java
+1
-1
AgentApplicationTools.java
...om/poc/agent_application/utils/AgentApplicationTools.java
+17
-6
AgentApplicationApiServiceImpl.java
...expose/aggregate/impl/AgentApplicationApiServiceImpl.java
+1
-1
AgentApplicationServiceImpl.java
...oc/expose/aggregate/impl/AgentApplicationServiceImpl.java
+1
-1
No files found.
src/main/java/cn/com/poc/agent_application/rest/impl/AgentApplicationInfoRestImpl.java
View file @
b9bc3a01
...
@@ -259,7 +259,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -259,7 +259,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
// 判断是否调用function
// 判断是否调用function
//计算扣分数
//计算扣分数
CheckPluginUseEntity
checkPluginUseEntity
=
AgentApplicationTools
.
checkPluginUse
(
dto
.
getMessages
(),
tools
);
CheckPluginUseEntity
checkPluginUseEntity
=
AgentApplicationTools
.
checkPluginUse
(
dto
.
getMessages
(),
tools
,
fileUrls
,
imageUrls
);
Long
pointDeductionNum
=
pointDeductionRulesService
.
calculatePointDeductionNum
(
model
,
infoEntity
.
getCommunicationTurn
(),
checkPluginUseEntity
.
getDeductionTools
());
Long
pointDeductionNum
=
pointDeductionRulesService
.
calculatePointDeductionNum
(
model
,
infoEntity
.
getCommunicationTurn
(),
checkPluginUseEntity
.
getDeductionTools
());
AgentUseModifyEventInfo
agentUseModifyEventInfo
=
new
AgentUseModifyEventInfo
();
AgentUseModifyEventInfo
agentUseModifyEventInfo
=
new
AgentUseModifyEventInfo
();
agentUseModifyEventInfo
.
setAgentId
(
agentId
);
agentUseModifyEventInfo
.
setAgentId
(
agentId
);
...
...
src/main/java/cn/com/poc/agent_application/utils/AgentApplicationTools.java
View file @
b9bc3a01
...
@@ -22,10 +22,7 @@ import org.apache.commons.lang.ArrayUtils;
...
@@ -22,10 +22,7 @@ import org.apache.commons.lang.ArrayUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.File
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author alex.yao
* @author alex.yao
...
@@ -162,13 +159,27 @@ public class AgentApplicationTools {
...
@@ -162,13 +159,27 @@ public class AgentApplicationTools {
/**
/**
* 判断将会调用的插件-用于扣减积分
* 判断将会调用的插件-用于扣减积分
*/
*/
public
static
CheckPluginUseEntity
checkPluginUse
(
List
<
Message
>
messages
,
List
<
Tool
>
tools
)
{
public
static
CheckPluginUseEntity
checkPluginUse
(
List
<
Message
>
messages
,
List
<
Tool
>
tools
,
List
<
String
>
fileUrls
,
List
<
String
>
imageUrls
)
{
CheckPluginUseEntity
checkPluginUseEntity
=
new
CheckPluginUseEntity
();
CheckPluginUseEntity
checkPluginUseEntity
=
new
CheckPluginUseEntity
();
if
(
CollectionUtils
.
isEmpty
(
messages
)
||
CollectionUtils
.
isEmpty
(
tools
))
{
if
(
CollectionUtils
.
isEmpty
(
messages
)
||
CollectionUtils
.
isEmpty
(
tools
))
{
return
checkPluginUseEntity
;
return
checkPluginUseEntity
;
}
}
LLMService
llmService
=
SpringUtils
.
getBean
(
LLMService
.
class
);
LLMService
llmService
=
SpringUtils
.
getBean
(
LLMService
.
class
);
String
query
=
messages
.
get
(
messages
.
size
()
-
1
).
getContent
().
toString
();
Object
content
=
messages
.
get
(
messages
.
size
()
-
1
).
getContent
();
String
query
;
if
(
content
instanceof
List
)
{
query
=
((
List
<
HashMap
>)
content
).
get
(
0
).
get
(
"text"
).
toString
();
}
else
{
query
=
content
.
toString
();
}
query
=
"用户输入:"
+
query
+
"\n"
;
if
(
CollectionUtils
.
isNotEmpty
(
fileUrls
))
{
query
=
query
+
"用户上传文件地址:"
+
JsonUtils
.
serialize
(
fileUrls
)
+
"\n"
;
}
if
(
CollectionUtils
.
isNotEmpty
(
imageUrls
))
{
query
=
query
+
"用户上传图片地址:"
+
JsonUtils
.
serialize
(
imageUrls
);
}
List
<
Tool
>
deductionTools
=
new
ArrayList
<>();
List
<
Tool
>
deductionTools
=
new
ArrayList
<>();
FunctionCallResult
functionCallResult
=
llmService
.
functionCall
(
query
,
tools
.
toArray
(
new
Tool
[
0
]));
FunctionCallResult
functionCallResult
=
llmService
.
functionCall
(
query
,
tools
.
toArray
(
new
Tool
[
0
]));
if
(
functionCallResult
!=
null
&&
functionCallResult
.
isNeed
())
{
if
(
functionCallResult
!=
null
&&
functionCallResult
.
isNeed
())
{
...
...
src/main/java/cn/com/poc/expose/aggregate/impl/AgentApplicationApiServiceImpl.java
View file @
b9bc3a01
...
@@ -143,7 +143,7 @@ public class AgentApplicationApiServiceImpl implements AgentApplicationApiServic
...
@@ -143,7 +143,7 @@ public class AgentApplicationApiServiceImpl implements AgentApplicationApiServic
//计算扣分数
//计算扣分数
// 判断是否调用function
// 判断是否调用function
CheckPluginUseEntity
checkPluginUseEntity
=
AgentApplicationTools
.
checkPluginUse
(
messages
,
tools
);
CheckPluginUseEntity
checkPluginUseEntity
=
AgentApplicationTools
.
checkPluginUse
(
messages
,
tools
,
fileUrls
,
imageUrls
);
Long
pointDeductionNum
=
pointDeductionRulesService
.
calculatePointDeductionNum
(
infoEntity
.
getLargeModel
(),
infoEntity
.
getCommunicationTurn
(),
checkPluginUseEntity
.
getDeductionTools
());
Long
pointDeductionNum
=
pointDeductionRulesService
.
calculatePointDeductionNum
(
infoEntity
.
getLargeModel
(),
infoEntity
.
getCommunicationTurn
(),
checkPluginUseEntity
.
getDeductionTools
());
AgentUseModifyEventInfo
agentUseModifyEventInfo
=
new
AgentUseModifyEventInfo
();
AgentUseModifyEventInfo
agentUseModifyEventInfo
=
new
AgentUseModifyEventInfo
();
agentUseModifyEventInfo
.
setAgentId
(
agentId
);
agentUseModifyEventInfo
.
setAgentId
(
agentId
);
...
...
src/main/java/cn/com/poc/expose/aggregate/impl/AgentApplicationServiceImpl.java
View file @
b9bc3a01
...
@@ -166,7 +166,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
...
@@ -166,7 +166,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
//计算扣分数
//计算扣分数
// 判断是否调用function
// 判断是否调用function
CheckPluginUseEntity
checkPluginUseEntity
=
AgentApplicationTools
.
checkPluginUse
(
messages
,
tools
);
CheckPluginUseEntity
checkPluginUseEntity
=
AgentApplicationTools
.
checkPluginUse
(
messages
,
tools
,
fileUrls
,
imageUrls
);
Long
pointDeductionNum
=
pointDeductionRulesService
.
calculatePointDeductionNum
(
infoEntity
.
getLargeModel
(),
infoEntity
.
getCommunicationTurn
(),
checkPluginUseEntity
.
getDeductionTools
());
Long
pointDeductionNum
=
pointDeductionRulesService
.
calculatePointDeductionNum
(
infoEntity
.
getLargeModel
(),
infoEntity
.
getCommunicationTurn
(),
checkPluginUseEntity
.
getDeductionTools
());
AgentUseModifyEventInfo
agentUseModifyEventInfo
=
new
AgentUseModifyEventInfo
();
AgentUseModifyEventInfo
agentUseModifyEventInfo
=
new
AgentUseModifyEventInfo
();
agentUseModifyEventInfo
.
setAgentId
(
agentId
);
agentUseModifyEventInfo
.
setAgentId
(
agentId
);
...
...
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