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
60fc45ac
Commit
60fc45ac
authored
Oct 23, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:预览应用,多模型聊天
parent
82b99f01
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
AgentApplicationPreviewDto.java
...poc/agent_application/dto/AgentApplicationPreviewDto.java
+30
-0
AgentApplicationInfoRestImpl.java
...t_application/rest/impl/AgentApplicationInfoRestImpl.java
+7
-4
No files found.
src/main/java/cn/com/poc/agent_application/dto/AgentApplicationPreviewDto.java
View file @
60fc45ac
...
@@ -9,10 +9,40 @@ public class AgentApplicationPreviewDto implements Serializable {
...
@@ -9,10 +9,40 @@ public class AgentApplicationPreviewDto implements Serializable {
private
String
modelNickName
;
private
String
modelNickName
;
private
Float
topP
;
private
Float
temperature
;
private
String
agentSystem
;
private
String
agentId
;
private
String
agentId
;
private
List
<
Message
>
messages
;
private
List
<
Message
>
messages
;
public
Float
getTopP
()
{
return
topP
;
}
public
void
setTopP
(
Float
topP
)
{
this
.
topP
=
topP
;
}
public
Float
getTemperature
()
{
return
temperature
;
}
public
void
setTemperature
(
Float
temperature
)
{
this
.
temperature
=
temperature
;
}
public
String
getAgentSystem
()
{
return
agentSystem
;
}
public
void
setAgentSystem
(
String
agentSystem
)
{
this
.
agentSystem
=
agentSystem
;
}
public
String
getModelNickName
()
{
public
String
getModelNickName
()
{
return
modelNickName
;
return
modelNickName
;
}
}
...
...
src/main/java/cn/com/poc/agent_application/rest/impl/AgentApplicationInfoRestImpl.java
View file @
60fc45ac
...
@@ -149,25 +149,28 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -149,25 +149,28 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
List
<
Tool
>
tools
=
new
ArrayList
<>();
List
<
Tool
>
tools
=
new
ArrayList
<>();
//开启对话变量
//开启对话变量
if
(
ArrayUtils
.
isNotEmpty
(
infoEntity
.
getVariableStructure
()))
{
if
(
ArrayUtils
.
isNotEmpty
(
infoEntity
.
getVariableStructure
()))
{
String
functionName
=
"set_value_memory"
;
String
functionName
=
LargeModelFunctionEnum
.
set_value_memory
.
name
()
;
String
llmConfig
=
LargeModelFunctionEnum
.
valueOf
(
functionName
).
getFunction
().
getVariableStructureLLMConfig
(
infoEntity
.
getVariableStructure
()).
get
(
0
);
String
llmConfig
=
LargeModelFunctionEnum
.
valueOf
(
functionName
).
getFunction
().
getVariableStructureLLMConfig
(
infoEntity
.
getVariableStructure
()).
get
(
0
);
Tool
tool
=
JsonUtils
.
deSerialize
(
llmConfig
,
Tool
.
class
);
Tool
tool
=
JsonUtils
.
deSerialize
(
llmConfig
,
Tool
.
class
);
tools
.
add
(
tool
);
tools
.
add
(
tool
);
}
}
//开启长期记忆
//开启长期记忆
if
(
CommonConstant
.
YOrN
.
Y
.
equals
(
infoEntity
.
getIsLongMemory
()))
{
if
(
CommonConstant
.
YOrN
.
Y
.
equals
(
infoEntity
.
getIsLongMemory
()))
{
String
functionName
=
"set_long_memory"
;
String
functionName
=
LargeModelFunctionEnum
.
set_long_memory
.
name
()
;
String
llmConfig
=
LargeModelFunctionEnum
.
valueOf
(
functionName
).
getFunction
().
getLLMConfig
().
get
(
0
);
String
llmConfig
=
LargeModelFunctionEnum
.
valueOf
(
functionName
).
getFunction
().
getLLMConfig
().
get
(
0
);
Tool
tool
=
JsonUtils
.
deSerialize
(
llmConfig
,
Tool
.
class
);
Tool
tool
=
JsonUtils
.
deSerialize
(
llmConfig
,
Tool
.
class
);
tools
.
add
(
tool
);
tools
.
add
(
tool
);
}
}
//
获取模型
//
对话大模型配置
String
model
=
StringUtils
.
isNotBlank
(
dto
.
getModelNickName
())
?
dto
.
getModelNickName
()
:
infoEntity
.
getLargeModel
();
String
model
=
StringUtils
.
isNotBlank
(
dto
.
getModelNickName
())
?
dto
.
getModelNickName
()
:
infoEntity
.
getLargeModel
();
Float
topP
=
dto
.
getTopP
()
==
null
?
infoEntity
.
getTopP
()
:
dto
.
getTopP
();
Float
temperature
=
dto
.
getTemperature
()
==
null
?
infoEntity
.
getTemperature
()
:
dto
.
getTemperature
();
String
agentSystem
=
StringUtils
.
isBlank
(
dto
.
getAgentSystem
())
?
infoEntity
.
getAgentSystem
()
:
dto
.
getAgentSystem
();
//调用应用服务
//调用应用服务
agentApplicationInfoService
.
callAgentApplication
(
agentId
,
model
,
infoEntity
.
getUnitIds
()
agentApplicationInfoService
.
callAgentApplication
(
agentId
,
model
,
infoEntity
.
getUnitIds
()
,
infoEntity
.
getAgentSystem
(),
kdIds
.
toArray
(
new
Integer
[
0
]),
infoEntity
.
getCommunicationTurn
(),
infoEntity
.
getTopP
(),
infoEntity
.
getTemperature
()
,
agentSystem
,
kdIds
.
toArray
(
new
Integer
[
0
]),
infoEntity
.
getCommunicationTurn
(),
topP
,
temperature
,
dto
.
getMessages
(),
tools
,
httpServletResponse
);
,
dto
.
getMessages
(),
tools
,
httpServletResponse
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
httpServletResponse
.
setContentType
(
"text/event-stream"
);
httpServletResponse
.
setContentType
(
"text/event-stream"
);
...
...
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