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
8f2a35c7
Commit
8f2a35c7
authored
Nov 13, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:getVariableList排序
parent
07c311c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
AgentApplicationInfoRestImpl.java
...t_application/rest/impl/AgentApplicationInfoRestImpl.java
+11
-14
No files found.
src/main/java/cn/com/poc/agent_application/rest/impl/AgentApplicationInfoRestImpl.java
View file @
8f2a35c7
...
@@ -18,7 +18,6 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.Tool;
...
@@ -18,7 +18,6 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.Tool;
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.SetLongMemoryConstants
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.long_memory.SetLongMemoryConstants
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.value_memory.GetValueMemory
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.value_memory.GetValueMemory
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.value_memory.SetValueMemoryConstants
;
import
cn.com.yict.framemax.core.i18n.I18nMessageException
;
import
cn.com.yict.framemax.core.i18n.I18nMessageException
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.collection.ListUtil
;
...
@@ -40,8 +39,6 @@ import java.util.stream.Collectors;
...
@@ -40,8 +39,6 @@ import java.util.stream.Collectors;
@Component
@Component
public
class
AgentApplicationInfoRestImpl
implements
AgentApplicationInfoRest
{
public
class
AgentApplicationInfoRestImpl
implements
AgentApplicationInfoRest
{
private
final
Collator
collator
=
Collator
.
getInstance
(
Locale
.
CHINA
);
@Resource
@Resource
private
BizAgentApplicationInfoService
bizAgentApplicationInfoService
;
private
BizAgentApplicationInfoService
bizAgentApplicationInfoService
;
...
@@ -209,6 +206,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -209,6 +206,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
Assert
.
notEmpty
(
dto
.
getMessages
());
Assert
.
notEmpty
(
dto
.
getMessages
());
try
{
try
{
String
agentId
=
dto
.
getAgentId
();
String
agentId
=
dto
.
getAgentId
();
String
dialogueId
=
agentId
;
BizAgentApplicationInfoEntity
infoEntity
=
bizAgentApplicationInfoService
.
getByAgentId
(
agentId
);
BizAgentApplicationInfoEntity
infoEntity
=
bizAgentApplicationInfoService
.
getByAgentId
(
agentId
);
if
(
infoEntity
==
null
)
{
if
(
infoEntity
==
null
)
{
throw
new
I18nMessageException
(
"exception/application.does.not.exist"
);
throw
new
I18nMessageException
(
"exception/application.does.not.exist"
);
...
@@ -255,9 +253,9 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -255,9 +253,9 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
String
agentSystem
=
StringUtils
.
isBlank
(
dto
.
getAgentSystem
())
?
infoEntity
.
getAgentSystem
()
:
dto
.
getAgentSystem
();
String
agentSystem
=
StringUtils
.
isBlank
(
dto
.
getAgentSystem
())
?
infoEntity
.
getAgentSystem
()
:
dto
.
getAgentSystem
();
//调用应用服务
//调用应用服务
agentApplicationInfoService
.
callAgentApplication
(
agentId
,
model
,
infoEntity
.
getUnitIds
()
agentApplicationInfoService
.
callAgentApplication
(
agentId
,
dialogueId
,
model
,
,
agentSystem
,
kdIds
.
toArray
(
new
Integer
[
0
]),
infoEntity
.
getCommunicationTurn
(),
topP
,
temperature
infoEntity
.
getUnitIds
(),
agentSystem
,
kdIds
.
toArray
(
new
Integer
[
0
]),
infoEntity
.
getCommunicationTurn
(),
topP
,
,
dto
.
getMessages
(),
tools
,
httpServletResponse
);
temperature
,
dto
.
getMessages
(),
tools
,
httpServletResponse
);
}
catch
(
}
catch
(
Exception
e
)
{
Exception
e
)
{
httpServletResponse
.
setContentType
(
"text/event-stream"
);
httpServletResponse
.
setContentType
(
"text/event-stream"
);
...
@@ -347,11 +345,11 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -347,11 +345,11 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
@Override
@Override
public
List
<
AgentApplicationValueMemoryDto
>
getVariableList
(
String
agentId
)
{
public
List
<
AgentApplicationValueMemoryDto
>
getVariableList
(
String
agentId
)
{
Map
<
Object
,
Object
>
map
=
GetValueMemory
.
get
(
agentId
);
List
<
AgentApplicationValueMemoryDto
>
result
=
new
ArrayList
<>();
List
<
AgentApplicationValueMemoryDto
>
result
=
new
ArrayList
<>();
BizAgentApplicationInfoEntity
infoEntity
=
bizAgentApplicationInfoService
.
getByAgentId
(
agentId
);
Map
<
Object
,
Object
>
map
=
GetValueMemory
.
get
(
agentId
);
List
<
Variable
>
variableStructure
=
infoEntity
.
getVariableStructure
();
if
(
MapUtils
.
isEmpty
(
map
))
{
if
(
MapUtils
.
isEmpty
(
map
))
{
BizAgentApplicationInfoEntity
infoEntity
=
bizAgentApplicationInfoService
.
getByAgentId
(
agentId
);
List
<
Variable
>
variableStructure
=
infoEntity
.
getVariableStructure
();
if
(
CollectionUtils
.
isEmpty
(
variableStructure
))
{
if
(
CollectionUtils
.
isEmpty
(
variableStructure
))
{
return
result
;
return
result
;
}
}
...
@@ -362,15 +360,14 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -362,15 +360,14 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
result
.
add
(
valueMemoryDto
);
result
.
add
(
valueMemoryDto
);
}
}
}
else
{
}
else
{
Set
<
Object
>
keySet
=
map
.
keySet
();
for
(
Variable
variable
:
variableStructure
)
{
for
(
Object
key
:
keySet
)
{
AgentApplicationValueMemoryDto
valueMemoryDto
=
new
AgentApplicationValueMemoryDto
();
AgentApplicationValueMemoryDto
valueMemoryDto
=
new
AgentApplicationValueMemoryDto
();
valueMemoryDto
.
setKey
(
key
.
toString
());
valueMemoryDto
.
setKey
(
variable
.
getKey
());
valueMemoryDto
.
setValue
(
map
.
get
(
key
).
toString
());
valueMemoryDto
.
setValue
(
map
.
containsKey
(
variable
.
getKey
())
?
map
.
get
(
variable
.
getKey
()).
toString
()
:
variable
.
getVariableDefault
());
result
.
add
(
valueMemoryDto
);
result
.
add
(
valueMemoryDto
);
}
}
}
}
return
result
.
stream
().
sorted
(
Comparator
.
comparing
(
AgentApplicationValueMemoryDto:
:
getKey
,
collator
)).
collect
(
Collectors
.
toList
())
;
return
result
;
}
}
@Override
@Override
...
...
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