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
6fc892b9
Commit
6fc892b9
authored
Oct 24, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: 大模型content 多模态
parent
4c3a3325
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
AgentApplicationInfoServiceImpl.java
...ation/aggregate/impl/AgentApplicationInfoServiceImpl.java
+9
-9
Message.java
.../thirdparty/resource/demand/ai/common/domain/Message.java
+12
-3
No files found.
src/main/java/cn/com/poc/agent_application/aggregate/impl/AgentApplicationInfoServiceImpl.java
View file @
6fc892b9
...
...
@@ -78,8 +78,6 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
@Resource
private
LLMService
llmService
;
@Resource
private
RedisService
redisService
;
@Override
public
boolean
updateAndPublish
(
BizAgentApplicationInfoEntity
bizAgentApplicationInfoEntity
)
throws
Exception
{
...
...
@@ -379,7 +377,14 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
}
knowledgeIds
.
add
(
knowledgeDocumentEntity
.
getKnowledgeId
());
}
List
<
String
>
knowledgeResults
=
demandKnowledgeService
.
searchKnowledge
(
messages
.
get
(
messages
.
size
()
-
1
).
getContent
().
get
(
0
).
getText
(),
knowledgeIds
,
3
);
Object
content
=
messages
.
get
(
messages
.
size
()
-
1
).
getContent
();
String
query
=
""
;
if
(
content
instanceof
List
)
{
query
=
((
List
<
MultiContent
>)
content
).
get
(
0
).
getText
();
}
else
{
query
=
content
.
toString
();
}
List
<
String
>
knowledgeResults
=
demandKnowledgeService
.
searchKnowledge
(
query
,
knowledgeIds
,
3
);
promptTemplate
=
promptTemplate
.
replace
(
"${knowledgeResults}"
,
knowledgeResults
.
toString
());
}
// 记忆
...
...
@@ -599,14 +604,9 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
}
if
(
StringUtils
.
isNotBlank
(
promptTemplate
))
{
List
<
MultiContent
>
content
=
new
ArrayList
<>();
MultiContent
multiContent
=
new
MultiContent
();
multiContent
.
setText
(
promptTemplate
);
multiContent
.
setType
(
"text"
);
content
.
add
(
multiContent
);
Message
systemMessage
=
new
Message
();
systemMessage
.
setRole
(
AgentApplicationDialoguesRecordConstants
.
ROLE
.
SYSTEM
);
systemMessage
.
setContent
(
content
);
systemMessage
.
setContent
(
promptTemplate
);
messages
.
add
(
0
,
systemMessage
);
}
return
messages
.
toArray
(
new
Message
[
0
]);
...
...
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/common/domain/Message.java
View file @
6fc892b9
...
...
@@ -12,19 +12,28 @@ import java.util.List;
public
class
Message
{
private
List
<
MultiContent
>
content
;
//
private List<MultiContent> content;
private
Object
content
;
private
String
role
;
private
List
<
FunctionCall
>
function_call
;
private
String
name
;
public
List
<
MultiContent
>
getContent
()
{
// public List<MultiContent> getContent() {
// return content;
// }
//
// public void setContent(List<MultiContent> content) {
// this.content = content;
// }
public
Object
getContent
()
{
return
content
;
}
public
void
setContent
(
List
<
MultiContent
>
content
)
{
public
void
setContent
(
Object
content
)
{
this
.
content
=
content
;
}
...
...
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