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
87555dfb
Commit
87555dfb
authored
Nov 26, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 应用发布-新增音色配置
parent
6a12e005
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
470 additions
and
275 deletions
+470
-275
BizAgentApplicationPublishConvert.java
...pplication/convert/BizAgentApplicationPublishConvert.java
+30
-4
BizAgentApplicationPublishEntity.java
..._application/entity/BizAgentApplicationPublishEntity.java
+12
-0
BizAgentApplicationInfoModel.java
...agent_application/model/BizAgentApplicationInfoModel.java
+1
-1
BizAgentApplicationPublishModel.java
...nt_application/model/BizAgentApplicationPublishModel.java
+295
-249
AgentApplicationInfoTest.java
src/test/java/cn/com/poc/AgentApplicationInfoTest.java
+132
-21
No files found.
src/main/java/cn/com/poc/agent_application/convert/BizAgentApplicationPublishConvert.java
View file @
87555dfb
package
cn
.
com
.
poc
.
agent_application
.
convert
;
import
cn.com.poc.agent_application.domain.AgentApplicationBaseInfo
;
import
cn.com.poc.agent_application.domain.AgentApplicationCommConfig
;
import
cn.com.poc.agent_application.domain.AgentApplicationCommModelConfig
;
import
cn.com.poc.agent_application.domain.AgentApplicationKnowledgeConfig
;
import
cn.com.poc.agent_application.domain.*
;
import
cn.com.poc.agent_application.dto.BizAgentApplicationPublishDto
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity
;
import
cn.com.poc.agent_application.entity.Variable
;
import
cn.com.poc.agent_application.entity.VoiceConfig
;
import
cn.com.poc.agent_application.model.BizAgentApplicationPublishModel
;
import
cn.com.poc.common.constant.CommonConstant
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.fasterxml.jackson.core.type.TypeReference
;
...
...
@@ -58,6 +57,10 @@ public class BizAgentApplicationPublishConvert {
if
(
StringUtils
.
isNotBlank
(
model
.
getUnitIds
()))
{
entity
.
setUnitIds
(
JsonUtils
.
deSerialize
(
model
.
getUnitIds
(),
String
[].
class
));
}
if
(
StringUtils
.
isNotBlank
(
model
.
getVoiceConfig
()))
{
VoiceConfig
voiceConfig
=
JsonUtils
.
deSerialize
(
model
.
getVoiceConfig
(),
VoiceConfig
.
class
);
entity
.
setVoiceConfig
(
voiceConfig
);
}
entity
.
setIsDeleted
(
model
.
getIsDeleted
());
entity
.
setCreator
(
model
.
getCreator
());
entity
.
setCreatedTime
(
model
.
getCreatedTime
());
...
...
@@ -97,6 +100,10 @@ public class BizAgentApplicationPublishConvert {
if
(
ArrayUtils
.
isNotEmpty
(
entity
.
getUnitIds
()))
{
model
.
setUnitIds
(
JsonUtil
.
toJson
(
entity
.
getUnitIds
()));
}
if
(
ObjectUtil
.
isNotEmpty
(
entity
.
getVoiceConfig
()))
{
model
.
setVoiceConfig
(
JsonUtils
.
serialize
(
entity
.
getVoiceConfig
()));
}
model
.
setIsDeleted
(
entity
.
getIsDeleted
());
model
.
setCreator
(
entity
.
getCreator
());
model
.
setCreatedTime
(
entity
.
getCreatedTime
());
...
...
@@ -136,10 +143,21 @@ public class BizAgentApplicationPublishConvert {
commModelConfig
.
setTemperature
(
entity
.
getTemperature
());
commModelConfig
.
setCommunicationTurn
(
entity
.
getCommunicationTurn
());
AgentApplicationVoiceConfig
voiceConfig
=
new
AgentApplicationVoiceConfig
();
if
(
ObjectUtil
.
isNotEmpty
(
entity
.
getVoiceConfig
()))
{
voiceConfig
.
setDefaultOpen
(
entity
.
getVoiceConfig
().
getDefaultOpen
());
voiceConfig
.
setTimbreId
(
entity
.
getVoiceConfig
().
getTimbreId
());
}
else
{
voiceConfig
.
setDefaultOpen
(
CommonConstant
.
YOrN
.
N
);
voiceConfig
.
setTimbreId
(
StringUtils
.
EMPTY
);
}
dto
.
setBaseInfo
(
baseInfo
);
dto
.
setCommConfig
(
commConfig
);
dto
.
setKnowledgeConfig
(
knowledgeConfig
);
dto
.
setCommModelConfig
(
commModelConfig
);
dto
.
setVoiceConfig
(
voiceConfig
);
dto
.
setUnitIds
(
entity
.
getUnitIds
());
dto
.
setCreator
(
entity
.
getCreator
());
dto
.
setCreatedTime
(
entity
.
getCreatedTime
());
...
...
@@ -185,6 +203,14 @@ public class BizAgentApplicationPublishConvert {
entity
.
setTemperature
(
dto
.
getCommModelConfig
().
getTemperature
());
}
VoiceConfig
voiceConfig
=
new
VoiceConfig
();
if
(
ObjectUtil
.
isNotEmpty
(
dto
.
getVoiceConfig
()))
{
voiceConfig
.
setDefaultOpen
(
dto
.
getVoiceConfig
().
getDefaultOpen
());
voiceConfig
.
setTimbreId
(
dto
.
getVoiceConfig
().
getTimbreId
());
}
else
{
voiceConfig
.
setDefaultOpen
(
CommonConstant
.
YOrN
.
N
);
voiceConfig
.
setTimbreId
(
StringUtils
.
EMPTY
);
}
entity
.
setUnitIds
(
dto
.
getUnitIds
());
entity
.
setCreator
(
dto
.
getCreator
());
entity
.
setCreatedTime
(
dto
.
getCreatedTime
());
...
...
src/main/java/cn/com/poc/agent_application/entity/BizAgentApplicationPublishEntity.java
View file @
87555dfb
...
...
@@ -330,6 +330,18 @@ public class BizAgentApplicationPublishEntity {
this
.
isDocumentParsing
=
isDocumentParsing
;
}
/**
* voice_config
*/
private
VoiceConfig
voiceConfig
;
public
VoiceConfig
getVoiceConfig
()
{
return
voiceConfig
;
}
public
void
setVoiceConfig
(
VoiceConfig
voiceConfig
)
{
this
.
voiceConfig
=
voiceConfig
;
}
/**
* is_deleted
...
...
src/main/java/cn/com/poc/agent_application/model/BizAgentApplicationInfoModel.java
View file @
87555dfb
...
...
@@ -421,7 +421,7 @@ public class BizAgentApplicationInfoModel extends BaseModelClass implements Seri
/**
* voice_config
* 声音配置 default
_open-是否默认开启 timbre_i
d-音色
* 声音配置 default
Open-是否默认开启 timbreI
d-音色
*/
private
java
.
lang
.
String
voiceConfig
;
...
...
src/main/java/cn/com/poc/agent_application/model/BizAgentApplicationPublishModel.java
View file @
87555dfb
package
cn
.
com
.
poc
.
agent_application
.
model
;
package
cn
.
com
.
poc
.
agent_application
.
model
;
import
java.io.Serializable
;
import
cn.com.yict.framemax.data.model.BaseModelClass
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
javax.persistence.Id
;
import
org.hibernate.annotations.DynamicInsert
;
import
org.hibernate.annotations.DynamicUpdate
;
import
javax.persistence.Version
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
...
...
@@ -23,435 +27,477 @@ import javax.persistence.GenerationType;
public
class
BizAgentApplicationPublishModel
extends
BaseModelClass
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** id
*自增ID
*/
/**
* id
* 自增ID
*/
private
java
.
lang
.
Integer
id
;
@Column
(
name
=
"id"
,
length
=
10
)
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
public
java
.
lang
.
Integer
getId
(){
@Column
(
name
=
"id"
,
length
=
10
)
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
public
java
.
lang
.
Integer
getId
()
{
return
this
.
id
;
}
public
void
setId
(
java
.
lang
.
Integer
id
){
public
void
setId
(
java
.
lang
.
Integer
id
)
{
this
.
id
=
id
;
super
.
addValidField
(
"id"
);
}
/** member_id
*创建应用的用户ID
*/
/**
* member_id
* 创建应用的用户ID
*/
private
java
.
lang
.
Integer
memberId
;
@Column
(
name
=
"member_id"
,
length
=
10
)
public
java
.
lang
.
Integer
getMemberId
(){
@Column
(
name
=
"member_id"
,
length
=
10
)
public
java
.
lang
.
Integer
getMemberId
()
{
return
this
.
memberId
;
}
public
void
setMemberId
(
java
.
lang
.
Integer
memberId
){
public
void
setMemberId
(
java
.
lang
.
Integer
memberId
)
{
this
.
memberId
=
memberId
;
super
.
addValidField
(
"memberId"
);
}
/** agent_id
*agent应用ID
*/
/**
* agent_id
* agent应用ID
*/
private
java
.
lang
.
String
agentId
;
@Column
(
name
=
"agent_id"
,
length
=
200
)
public
java
.
lang
.
String
getAgentId
(){
@Column
(
name
=
"agent_id"
,
length
=
200
)
public
java
.
lang
.
String
getAgentId
()
{
return
this
.
agentId
;
}
public
void
setAgentId
(
java
.
lang
.
String
agentId
){
public
void
setAgentId
(
java
.
lang
.
String
agentId
)
{
this
.
agentId
=
agentId
;
super
.
addValidField
(
"agentId"
);
}
/** agent_avatar
*应用头像ICON地址
*/
/**
* agent_avatar
* 应用头像ICON地址
*/
private
java
.
lang
.
String
agentAvatar
;
@Column
(
name
=
"agent_avatar"
,
length
=
200
)
public
java
.
lang
.
String
getAgentAvatar
(){
@Column
(
name
=
"agent_avatar"
,
length
=
200
)
public
java
.
lang
.
String
getAgentAvatar
()
{
return
this
.
agentAvatar
;
}
public
void
setAgentAvatar
(
java
.
lang
.
String
agentAvatar
){
public
void
setAgentAvatar
(
java
.
lang
.
String
agentAvatar
)
{
this
.
agentAvatar
=
agentAvatar
;
super
.
addValidField
(
"agentAvatar"
);
}
/** agent_title
*应用标题
*/
/**
* agent_title
* 应用标题
*/
private
java
.
lang
.
String
agentTitle
;
@Column
(
name
=
"agent_title"
,
length
=
50
)
public
java
.
lang
.
String
getAgentTitle
(){
@Column
(
name
=
"agent_title"
,
length
=
50
)
public
java
.
lang
.
String
getAgentTitle
()
{
return
this
.
agentTitle
;
}
public
void
setAgentTitle
(
java
.
lang
.
String
agentTitle
){
public
void
setAgentTitle
(
java
.
lang
.
String
agentTitle
)
{
this
.
agentTitle
=
agentTitle
;
super
.
addValidField
(
"agentTitle"
);
}
/** agent_desc
*应用描述
*/
/**
* agent_desc
* 应用描述
*/
private
java
.
lang
.
String
agentDesc
;
@Column
(
name
=
"agent_desc"
,
length
=
100
)
public
java
.
lang
.
String
getAgentDesc
(){
@Column
(
name
=
"agent_desc"
,
length
=
100
)
public
java
.
lang
.
String
getAgentDesc
()
{
return
this
.
agentDesc
;
}
public
void
setAgentDesc
(
java
.
lang
.
String
agentDesc
){
public
void
setAgentDesc
(
java
.
lang
.
String
agentDesc
)
{
this
.
agentDesc
=
agentDesc
;
super
.
addValidField
(
"agentDesc"
);
}
/** agent_system
*角色指令
*/
/**
* agent_system
* 角色指令
*/
private
java
.
lang
.
String
agentSystem
;
@Column
(
name
=
"agent_system"
,
length
=
2147483647
)
public
java
.
lang
.
String
getAgentSystem
(){
@Column
(
name
=
"agent_system"
,
length
=
2147483647
)
public
java
.
lang
.
String
getAgentSystem
()
{
return
this
.
agentSystem
;
}
public
void
setAgentSystem
(
java
.
lang
.
String
agentSystem
){
public
void
setAgentSystem
(
java
.
lang
.
String
agentSystem
)
{
this
.
agentSystem
=
agentSystem
;
super
.
addValidField
(
"agentSystem"
);
}
/** preamble
*开场白
*/
/**
* preamble
* 开场白
*/
private
java
.
lang
.
String
preamble
;
@Column
(
name
=
"preamble"
,
length
=
2147483647
)
public
java
.
lang
.
String
getPreamble
(){
@Column
(
name
=
"preamble"
,
length
=
2147483647
)
public
java
.
lang
.
String
getPreamble
()
{
return
this
.
preamble
;
}
public
void
setPreamble
(
java
.
lang
.
String
preamble
){
public
void
setPreamble
(
java
.
lang
.
String
preamble
)
{
this
.
preamble
=
preamble
;
super
.
addValidField
(
"preamble"
);
}
/** variable_structure
*变量结构
/**
* variable_structure
* 变量结构
*/
private
java
.
lang
.
String
variableStructure
;
@Column
(
name
=
"variable_structure"
,
length
=
2147483647
)
public
java
.
lang
.
String
getVariableStructure
(){
@Column
(
name
=
"variable_structure"
,
length
=
2147483647
)
public
java
.
lang
.
String
getVariableStructure
()
{
return
this
.
variableStructure
;
}
public
void
setVariableStructure
(
java
.
lang
.
String
variableStructure
){
public
void
setVariableStructure
(
java
.
lang
.
String
variableStructure
)
{
this
.
variableStructure
=
variableStructure
;
super
.
addValidField
(
"variableStructure"
);
}
/** featured_questions
*推荐问
*/
/**
* featured_questions
* 推荐问
*/
private
java
.
lang
.
String
featuredQuestions
;
@Column
(
name
=
"featured_questions"
,
length
=
1073741824
)
public
java
.
lang
.
String
getFeaturedQuestions
(){
@Column
(
name
=
"featured_questions"
,
length
=
1073741824
)
public
java
.
lang
.
String
getFeaturedQuestions
()
{
return
this
.
featuredQuestions
;
}
public
void
setFeaturedQuestions
(
java
.
lang
.
String
featuredQuestions
){
public
void
setFeaturedQuestions
(
java
.
lang
.
String
featuredQuestions
)
{
this
.
featuredQuestions
=
featuredQuestions
;
super
.
addValidField
(
"featuredQuestions"
);
}
/** communication_turn
*对话上下文保存轮次 0-100
*/
/**
* communication_turn
* 对话上下文保存轮次 0-100
*/
private
java
.
lang
.
Integer
communicationTurn
;
@Column
(
name
=
"communication_turn"
,
length
=
10
)
public
java
.
lang
.
Integer
getCommunicationTurn
(){
@Column
(
name
=
"communication_turn"
,
length
=
10
)
public
java
.
lang
.
Integer
getCommunicationTurn
()
{
return
this
.
communicationTurn
;
}
public
void
setCommunicationTurn
(
java
.
lang
.
Integer
communicationTurn
){
public
void
setCommunicationTurn
(
java
.
lang
.
Integer
communicationTurn
)
{
this
.
communicationTurn
=
communicationTurn
;
super
.
addValidField
(
"communicationTurn"
);
}
/** continuous_question_status
*追问状态 默认-default 自定义-customizable 关闭-close
*/
/**
* continuous_question_status
* 追问状态 默认-default 自定义-customizable 关闭-close
*/
private
java
.
lang
.
String
continuousQuestionStatus
;
@Column
(
name
=
"continuous_question_status"
,
length
=
15
)
public
java
.
lang
.
String
getContinuousQuestionStatus
(){
@Column
(
name
=
"continuous_question_status"
,
length
=
15
)
public
java
.
lang
.
String
getContinuousQuestionStatus
()
{
return
this
.
continuousQuestionStatus
;
}
public
void
setContinuousQuestionStatus
(
java
.
lang
.
String
continuousQuestionStatus
){
public
void
setContinuousQuestionStatus
(
java
.
lang
.
String
continuousQuestionStatus
)
{
this
.
continuousQuestionStatus
=
continuousQuestionStatus
;
super
.
addValidField
(
"continuousQuestionStatus"
);
}
/** continuous_question_system
*追问prompt
*/
/**
* continuous_question_system
* 追问prompt
*/
private
java
.
lang
.
String
continuousQuestionSystem
;
@Column
(
name
=
"continuous_question_system"
,
length
=
2147483647
)
public
java
.
lang
.
String
getContinuousQuestionSystem
(){
@Column
(
name
=
"continuous_question_system"
,
length
=
2147483647
)
public
java
.
lang
.
String
getContinuousQuestionSystem
()
{
return
this
.
continuousQuestionSystem
;
}
public
void
setContinuousQuestionSystem
(
java
.
lang
.
String
continuousQuestionSystem
){
public
void
setContinuousQuestionSystem
(
java
.
lang
.
String
continuousQuestionSystem
)
{
this
.
continuousQuestionSystem
=
continuousQuestionSystem
;
super
.
addValidField
(
"continuousQuestionSystem"
);
}
/** continuous_question_turn
*追问轮次 1-5
*/
/**
* continuous_question_turn
* 追问轮次 1-5
*/
private
java
.
lang
.
Integer
continuousQuestionTurn
;
@Column
(
name
=
"continuous_question_turn"
,
length
=
10
)
public
java
.
lang
.
Integer
getContinuousQuestionTurn
(){
@Column
(
name
=
"continuous_question_turn"
,
length
=
10
)
public
java
.
lang
.
Integer
getContinuousQuestionTurn
()
{
return
this
.
continuousQuestionTurn
;
}
public
void
setContinuousQuestionTurn
(
java
.
lang
.
Integer
continuousQuestionTurn
){
public
void
setContinuousQuestionTurn
(
java
.
lang
.
Integer
continuousQuestionTurn
)
{
this
.
continuousQuestionTurn
=
continuousQuestionTurn
;
super
.
addValidField
(
"continuousQuestionTurn"
);
}
/** knowledge_ids
*知识库ID
*/
/**
* knowledge_ids
* 知识库ID
*/
private
java
.
lang
.
String
knowledgeIds
;
@Column
(
name
=
"knowledge_ids"
,
length
=
1073741824
)
public
java
.
lang
.
String
getKnowledgeIds
(){
@Column
(
name
=
"knowledge_ids"
,
length
=
1073741824
)
public
java
.
lang
.
String
getKnowledgeIds
()
{
return
this
.
knowledgeIds
;
}
public
void
setKnowledgeIds
(
java
.
lang
.
String
knowledgeIds
){
public
void
setKnowledgeIds
(
java
.
lang
.
String
knowledgeIds
)
{
this
.
knowledgeIds
=
knowledgeIds
;
super
.
addValidField
(
"knowledgeIds"
);
}
/** large_model
*问答模型
*/
/**
* large_model
* 问答模型
*/
private
java
.
lang
.
String
largeModel
;
@Column
(
name
=
"large_model"
,
length
=
25
)
public
java
.
lang
.
String
getLargeModel
(){
@Column
(
name
=
"large_model"
,
length
=
25
)
public
java
.
lang
.
String
getLargeModel
()
{
return
this
.
largeModel
;
}
public
void
setLargeModel
(
java
.
lang
.
String
largeModel
){
public
void
setLargeModel
(
java
.
lang
.
String
largeModel
)
{
this
.
largeModel
=
largeModel
;
super
.
addValidField
(
"largeModel"
);
}
/** top_p
*对话模型 多样性 [0-1.00]
*/
/**
* top_p
* 对话模型 多样性 [0-1.00]
*/
private
java
.
lang
.
Float
topP
;
@Column
(
name
=
"top_p"
,
length
=
12
)
public
java
.
lang
.
Float
getTopP
(){
@Column
(
name
=
"top_p"
,
length
=
12
)
public
java
.
lang
.
Float
getTopP
()
{
return
this
.
topP
;
}
public
void
setTopP
(
java
.
lang
.
Float
topP
){
public
void
setTopP
(
java
.
lang
.
Float
topP
)
{
this
.
topP
=
topP
;
super
.
addValidField
(
"topP"
);
}
/** temperature
*对话模型 温度 [0-1.00]
/**
* temperature
* 对话模型 温度 [0-1.00]
*/
private
java
.
lang
.
Float
temperature
;
@Column
(
name
=
"temperature"
,
length
=
12
)
public
java
.
lang
.
Float
getTemperature
(){
@Column
(
name
=
"temperature"
,
length
=
12
)
public
java
.
lang
.
Float
getTemperature
()
{
return
this
.
temperature
;
}
public
void
setTemperature
(
java
.
lang
.
Float
temperature
){
public
void
setTemperature
(
java
.
lang
.
Float
temperature
)
{
this
.
temperature
=
temperature
;
super
.
addValidField
(
"temperature"
);
}
/*
* unit_ids
*
组件ID
*/
/**
* unit_ids
*
组件ID
*/
private
java
.
lang
.
String
unitIds
;
@Column
(
name
=
"unit_ids"
,
length
=
1073741824
)
public
java
.
lang
.
String
getUnitIds
(){
@Column
(
name
=
"unit_ids"
,
length
=
1073741824
)
public
java
.
lang
.
String
getUnitIds
()
{
return
this
.
unitIds
;
}
public
void
setUnitIds
(
java
.
lang
.
String
unitIds
){
public
void
setUnitIds
(
java
.
lang
.
String
unitIds
)
{
this
.
unitIds
=
unitIds
;
super
.
addValidField
(
"unitIds"
);
}
/** is_long_memory
*是否开启长期记忆 1、Y 是 2、N 否
/**
* is_long_memory
* 是否开启长期记忆 1、Y 是 2、N 否
*/
private
java
.
lang
.
String
isLongMemory
;
@Column
(
name
=
"is_long_memory"
,
length
=
1
)
public
java
.
lang
.
String
getIsLongMemory
(){
@Column
(
name
=
"is_long_memory"
,
length
=
1
)
public
java
.
lang
.
String
getIsLongMemory
()
{
return
this
.
isLongMemory
;
}
public
void
setIsLongMemory
(
java
.
lang
.
String
isLongMemory
){
public
void
setIsLongMemory
(
java
.
lang
.
String
isLongMemory
)
{
this
.
isLongMemory
=
isLongMemory
;
super
.
addValidField
(
"isLongMemory"
);
}
private
java
.
lang
.
String
isDocumentParsing
;
@Column
(
name
=
"is_document_parsing"
,
length
=
1
)
public
java
.
lang
.
String
getIsDocumentParsing
(){
@Column
(
name
=
"is_document_parsing"
,
length
=
1
)
public
java
.
lang
.
String
getIsDocumentParsing
()
{
return
this
.
isDocumentParsing
;
}
public
void
setIsDocumentParsing
(
java
.
lang
.
String
isDocumentParsing
){
public
void
setIsDocumentParsing
(
java
.
lang
.
String
isDocumentParsing
)
{
this
.
isDocumentParsing
=
isDocumentParsing
;
super
.
addValidField
(
"isDocumentParsing"
);
}
/**
* voice_config
* 声音配置 default_open-是否默认开启 timbre_id-音色
*/
private
java
.
lang
.
String
voiceConfig
;
@Column
(
name
=
"voice_config"
,
length
=
2147483647
)
public
java
.
lang
.
String
getVoiceConfig
()
{
return
this
.
voiceConfig
;
}
public
void
setVoiceConfig
(
String
voiceConfig
)
{
this
.
voiceConfig
=
voiceConfig
;
super
.
addValidField
(
"voiceConfig"
);
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
/**
* is_deleted
* 是否删除 1、Y 是 2、N 否
*/
private
java
.
lang
.
String
isDeleted
;
@Column
(
name
=
"is_deleted"
,
length
=
1
)
public
java
.
lang
.
String
getIsDeleted
(){
@Column
(
name
=
"is_deleted"
,
length
=
1
)
public
java
.
lang
.
String
getIsDeleted
()
{
return
this
.
isDeleted
;
}
public
void
setIsDeleted
(
java
.
lang
.
String
isDeleted
){
public
void
setIsDeleted
(
java
.
lang
.
String
isDeleted
)
{
this
.
isDeleted
=
isDeleted
;
super
.
addValidField
(
"isDeleted"
);
}
/** CREATOR
*创建人
*/
/**
* CREATOR
* 创建人
*/
private
java
.
lang
.
String
creator
;
@Column
(
name
=
"CREATOR"
,
length
=
225
)
public
java
.
lang
.
String
getCreator
(){
@Column
(
name
=
"CREATOR"
,
length
=
225
)
public
java
.
lang
.
String
getCreator
()
{
return
this
.
creator
;
}
public
void
setCreator
(
java
.
lang
.
String
creator
){
public
void
setCreator
(
java
.
lang
.
String
creator
)
{
this
.
creator
=
creator
;
super
.
addValidField
(
"creator"
);
}
/** CREATED_TIME
*创建时间
*/
/**
* CREATED_TIME
* 创建时间
*/
private
java
.
util
.
Date
createdTime
;
@Column
(
name
=
"CREATED_TIME"
,
length
=
19
)
public
java
.
util
.
Date
getCreatedTime
(){
@Column
(
name
=
"CREATED_TIME"
,
length
=
19
)
public
java
.
util
.
Date
getCreatedTime
()
{
return
this
.
createdTime
;
}
public
void
setCreatedTime
(
java
.
util
.
Date
createdTime
){
public
void
setCreatedTime
(
java
.
util
.
Date
createdTime
)
{
this
.
createdTime
=
createdTime
;
super
.
addValidField
(
"createdTime"
);
}
/** MODIFIER
*修改人
*/
/**
* MODIFIER
* 修改人
*/
private
java
.
lang
.
String
modifier
;
@Column
(
name
=
"MODIFIER"
,
length
=
225
)
public
java
.
lang
.
String
getModifier
(){
@Column
(
name
=
"MODIFIER"
,
length
=
225
)
public
java
.
lang
.
String
getModifier
()
{
return
this
.
modifier
;
}
public
void
setModifier
(
java
.
lang
.
String
modifier
){
public
void
setModifier
(
java
.
lang
.
String
modifier
)
{
this
.
modifier
=
modifier
;
super
.
addValidField
(
"modifier"
);
}
/** MODIFIED_TIME
*修改时间
*/
/**
* MODIFIED_TIME
* 修改时间
*/
private
java
.
util
.
Date
modifiedTime
;
@Column
(
name
=
"MODIFIED_TIME"
,
length
=
19
)
public
java
.
util
.
Date
getModifiedTime
(){
@Column
(
name
=
"MODIFIED_TIME"
,
length
=
19
)
public
java
.
util
.
Date
getModifiedTime
()
{
return
this
.
modifiedTime
;
}
public
void
setModifiedTime
(
java
.
util
.
Date
modifiedTime
){
public
void
setModifiedTime
(
java
.
util
.
Date
modifiedTime
)
{
this
.
modifiedTime
=
modifiedTime
;
super
.
addValidField
(
"modifiedTime"
);
}
/** SYS_VERSION
*乐观锁,版本号
*/
/**
* SYS_VERSION
* 乐观锁,版本号
*/
private
java
.
lang
.
Integer
sysVersion
;
@Column
(
name
=
"SYS_VERSION"
,
length
=
10
)
@Version
public
java
.
lang
.
Integer
getSysVersion
(){
@Column
(
name
=
"SYS_VERSION"
,
length
=
10
)
@Version
public
java
.
lang
.
Integer
getSysVersion
()
{
return
this
.
sysVersion
;
}
public
void
setSysVersion
(
java
.
lang
.
Integer
sysVersion
){
public
void
setSysVersion
(
java
.
lang
.
Integer
sysVersion
)
{
this
.
sysVersion
=
sysVersion
;
super
.
addValidField
(
"sysVersion"
);
}
}
\ No newline at end of file
src/test/java/cn/com/poc/AgentApplicationInfoTest.java
View file @
87555dfb
...
...
@@ -2,29 +2,31 @@ package cn.com.poc;
import
cn.com.poc.agent_application.aggregate.AgentApplicationInfoService
;
import
cn.com.poc.agent_application.entity.Variable
;
import
cn.com.poc.agent_application.utils.AgentApplicationTools
;
import
cn.com.poc.common.service.RedisService
;
import
cn.com.poc.common.utils.BlContext
;
import
cn.com.poc.expose.aggregate.AgentApplicationService
;
import
cn.com.poc.thirdparty.resource.demand.ai.aggregate.DemandKnowledgeService
;
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.SetValueMemoryConstants
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.html_reader.HtmlReaderFunction
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.memory_variable_writer.MemoryVariableWriter
;
import
cn.com.yict.framemax.core.spring.SingleContextInitializer
;
import
cn.com.yict.framemax.security.oauth.support.UsernameOauthTokenAuthenticationToken
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.collections4.ListUtils
;
import
io.github.furstenheim.*
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.context.SecurityContextImpl
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
javax.annotation.Resource
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
initializers
=
SingleContextInitializer
.
class
)
...
...
@@ -43,8 +45,48 @@ public class AgentApplicationInfoTest {
@Test
public
void
del
()
{
String
contentKey
=
SetValueMemoryConstants
.
REDIS_PREFIX
;
redisService
.
del
(
contentKey
);
}
@Test
public
void
html2MD
()
throws
IOException
{
// 创建资源符对象
URL
url
=
new
URL
(
"https://blog.csdn.net/jxlhljh/article/details/124506103"
);
// 创建连接
URLConnection
conn
=
url
.
openConnection
();
// 获取输入流
InputStream
inputStream
=
conn
.
getInputStream
();
// 缓冲区,读取输入流内容,64KB
char
[]
buffer
=
new
char
[
1024
*
64
];
int
len
;
StringBuilder
sb
=
new
StringBuilder
();
// 转换为字符流
InputStreamReader
isr
=
new
InputStreamReader
(
inputStream
);
// 循环读取
while
((
len
=
isr
.
read
(
buffer
))
!=
-
1
)
{
sb
.
append
(
buffer
,
0
,
len
);
}
// System.out.println(sb.toString());
// 关闭资源
inputStream
.
close
();
isr
.
close
();
String
htmlStr
=
sb
.
toString
();
OptionsBuilder
optionsBuilder
=
OptionsBuilder
.
anOptions
();
Options
options
=
optionsBuilder
.
withBr
(
"-"
)
.
withLinkStyle
(
LinkStyle
.
REFERENCED
)
.
withLinkReferenceStyle
(
LinkReferenceStyle
.
SHORTCUT
)
// more options
.
build
();
CopyDown
converter
=
new
CopyDown
(
options
);
String
markdownText
=
converter
.
convert
(
htmlStr
);
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
"D:\\test.md"
);
fileOutputStream
.
write
(
markdownText
.
getBytes
());
fileOutputStream
.
flush
();
fileOutputStream
.
close
();
// System.out.println(markdownText);
}
...
...
@@ -80,14 +122,83 @@ public class AgentApplicationInfoTest {
@Test
public
void
getValueMemory
()
{
String
agentId
=
"d56d9a6a90ed435d831f84bc1af50547"
;
String
contentKey
=
SetValueMemoryConstants
.
REDIS_PREFIX
+
agentId
+
":"
+
"204"
;
System
.
out
.
println
(
redisService
.
hmget
(
contentKey
));
// Set<Object> keySet = result.keySet();
// for (Object key : keySet) {
// Object value = result.get(key);
// System.out.println("key:" + key + ",value:" + value);
// }
}
@Test
public
void
getFunctionConfig
()
{
System
.
out
.
println
(
new
HtmlReaderFunction
().
getLLMConfig
());
}
@Test
public
void
updateStructVariable
()
{
String
agentId
=
"1"
;
List
<
Variable
>
originals
=
null
;
List
<
Variable
>
transformed
=
null
;
String
identifier
=
AgentApplicationTools
.
identifier
(
agentId
,
agentId
);
if
(
CollectionUtils
.
isEmpty
(
transformed
))
{
// 清除所有字段
MemoryVariableWriter
.
clean
(
identifier
);
}
// 原【变量记忆】为空,则不需要处理
if
(
originals
==
null
)
{
return
;
}
// 1. 获取需要删除的字段集合
// 2. 获取需要更新值的字段集合
Set
<
String
>
delKeys
=
new
HashSet
<>();
Set
<
String
>
updateKeys
=
new
HashSet
<>();
for
(
Variable
variable
:
originals
)
{
String
key
=
variable
.
getKey
();
boolean
needDel
=
transformed
.
stream
().
noneMatch
(
v
->
v
.
getKey
().
equals
(
key
));
if
(
needDel
)
{
delKeys
.
add
(
key
);
}
boolean
needUpdate
=
transformed
.
stream
().
anyMatch
(
v
->
v
.
getKey
().
equals
(
key
));
if
(
needUpdate
)
{
Optional
<
Variable
>
target
=
transformed
.
stream
().
filter
(
v
->
v
.
getKey
().
equals
(
key
)).
findFirst
();
if
(
StringUtils
.
isBlank
(
target
.
get
().
getVariableDefault
()))
{
continue
;
}
Map
<
Object
,
Object
>
map
=
MemoryVariableWriter
.
get
(
identifier
);
String
value
=
map
.
get
(
key
).
toString
();
if
(
StringUtils
.
isBlank
(
value
))
{
updateKeys
.
add
(
key
);
}
}
}
// 3. 获取需要新增的字段集合
Set
<
String
>
addKeys
=
new
HashSet
<>();
for
(
Variable
variable
:
transformed
)
{
String
key
=
variable
.
getKey
();
boolean
needAdd
=
originals
.
stream
().
noneMatch
(
v
->
v
.
getKey
().
equals
(
key
));
if
(
needAdd
)
{
addKeys
.
add
(
key
);
}
}
// 删除
if
(!
delKeys
.
isEmpty
())
{
MemoryVariableWriter
.
delItem
(
identifier
,
delKeys
.
toArray
(
new
String
[
0
]));
}
if
(!
addKeys
.
isEmpty
())
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
for
(
String
key
:
addKeys
)
{
Variable
variable
=
transformed
.
stream
().
filter
(
v
->
v
.
getKey
().
equals
(
key
)).
findFirst
().
get
();
map
.
put
(
variable
.
getKey
(),
variable
.
getVariableDefault
());
}
MemoryVariableWriter
.
addItem
(
identifier
,
map
);
}
if
(!
updateKeys
.
isEmpty
())
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
for
(
String
key
:
updateKeys
)
{
Variable
variable
=
transformed
.
stream
().
filter
(
v
->
v
.
getKey
().
equals
(
key
)).
findFirst
().
get
();
map
.
put
(
variable
.
getKey
(),
variable
.
getVariableDefault
());
}
MemoryVariableWriter
.
addItem
(
identifier
,
map
);
}
}
}
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