[improvement][launcher]Clean code structure of system demos.

This commit is contained in:
jerryjzhang
2024-10-09 19:47:18 +08:00
parent 5cbe3a2f2a
commit 809898e786
9 changed files with 90 additions and 100 deletions

View File

@@ -24,9 +24,8 @@ public class ChatModelParameters {
new Parameter("modelName", ModelProvider.DEMO_CHAT_MODEL.getModelName(), "ModelName", new Parameter("modelName", ModelProvider.DEMO_CHAT_MODEL.getModelName(), "ModelName",
"", "string", MODULE_NAME, null, getModelNameDependency()); "", "string", MODULE_NAME, null, getModelNameDependency());
public static final Parameter CHAT_MODEL_API_KEY = public static final Parameter CHAT_MODEL_API_KEY = new Parameter("apiKey", "", "ApiKey", "",
new Parameter("apiKey", "", "ApiKey", "", "password", MODULE_NAME, null, getApiKeyDependency());
"password", MODULE_NAME, null, getApiKeyDependency());
public static final Parameter CHAT_MODEL_ENDPOINT = new Parameter("endpoint", "llama_2_70b", public static final Parameter CHAT_MODEL_ENDPOINT = new Parameter("endpoint", "llama_2_70b",
"Endpoint", "", "string", MODULE_NAME, null, getEndpointDependency()); "Endpoint", "", "string", MODULE_NAME, null, getEndpointDependency());

View File

@@ -122,8 +122,9 @@ public class AgentServiceImpl extends ServiceImpl<AgentDOMapper, AgentDO> implem
continue; continue;
} }
try { try {
chatQueryService.parseAndExecute(ChatParseReq.builder().chatId(-1) chatQueryService
.agentId(agent.getId()).queryText(example).user(User.getDefaultUser()).build()); .parseAndExecute(ChatParseReq.builder().chatId(-1).agentId(agent.getId())
.queryText(example).user(User.getDefaultUser()).build());
} catch (Exception e) { } catch (Exception e) {
log.warn("agent:{} example execute failed:{}", agent.getName(), example); log.warn("agent:{} example execute failed:{}", agent.getName(), example);
} }

View File

@@ -38,8 +38,7 @@ public class MemoryServiceImpl implements MemoryService {
public void createMemory(ChatMemoryDO memory) { public void createMemory(ChatMemoryDO memory) {
// do not save duplicate memory for exactly the same question // do not save duplicate memory for exactly the same question
List<ChatMemoryDO> memories = getMemories(ChatMemoryFilter.builder() List<ChatMemoryDO> memories = getMemories(ChatMemoryFilter.builder()
.agentId(memory.getAgentId()) .agentId(memory.getAgentId()).question(memory.getQuestion()).build());
.question(memory.getQuestion()).build());
if (memories.size() == 0) { if (memories.size() == 0) {
chatMemoryRepository.createMemory(memory); chatMemoryRepository.createMemory(memory);
} }

View File

@@ -1,7 +1,6 @@
package com.tencent.supersonic.demo; package com.tencent.supersonic.demo;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.common.pojo.JoinCondition; import com.tencent.supersonic.common.pojo.JoinCondition;
import com.tencent.supersonic.common.pojo.ModelRela; import com.tencent.supersonic.common.pojo.ModelRela;
import com.tencent.supersonic.common.pojo.enums.AggOperatorEnum; import com.tencent.supersonic.common.pojo.enums.AggOperatorEnum;
@@ -33,10 +32,10 @@ public class CspiderDemo extends S2BaseDemo {
public void doRun() { public void doRun() {
try { try {
DomainResp s2Domain = addDomain(); DomainResp s2Domain = addDomain();
ModelResp genreModelResp = addModel_1(s2Domain, demoDatabaseResp); ModelResp genreModelResp = addModel_1(s2Domain, demoDatabase);
ModelResp artistModelResp = addModel_2(s2Domain, demoDatabaseResp); ModelResp artistModelResp = addModel_2(s2Domain, demoDatabase);
ModelResp filesModelResp = addModel_3(s2Domain, demoDatabaseResp); ModelResp filesModelResp = addModel_3(s2Domain, demoDatabase);
ModelResp songModelResp = addModel_4(s2Domain, demoDatabaseResp); ModelResp songModelResp = addModel_4(s2Domain, demoDatabase);
addDataSet_1(s2Domain); addDataSet_1(s2Domain);
addModelRela_1(s2Domain, genreModelResp, artistModelResp); addModelRela_1(s2Domain, genreModelResp, artistModelResp);
addModelRela_2(s2Domain, filesModelResp, artistModelResp); addModelRela_2(s2Domain, filesModelResp, artistModelResp);
@@ -63,7 +62,7 @@ public class CspiderDemo extends S2BaseDemo {
domainReq.setViewOrgs(Collections.singletonList("1")); domainReq.setViewOrgs(Collections.singletonList("1"));
domainReq.setAdmins(Collections.singletonList("admin")); domainReq.setAdmins(Collections.singletonList("admin"));
domainReq.setAdminOrgs(Collections.emptyList()); domainReq.setAdminOrgs(Collections.emptyList());
return domainService.createDomain(domainReq, user); return domainService.createDomain(domainReq, defaultUser);
} }
public ModelResp addModel_1(DomainResp s2Domain, DatabaseResp s2Database) throws Exception { public ModelResp addModel_1(DomainResp s2Domain, DatabaseResp s2Database) throws Exception {
@@ -98,7 +97,7 @@ public class CspiderDemo extends S2BaseDemo {
modelDetail.setQueryType("sql_query"); modelDetail.setQueryType("sql_query");
modelDetail.setSqlQuery("SELECT g_name, rating, most_popular_in FROM genre"); modelDetail.setSqlQuery("SELECT g_name, rating, most_popular_in FROM genre");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
return modelService.createModel(modelReq, user); return modelService.createModel(modelReq, defaultUser);
} }
public ModelResp addModel_2(DomainResp s2Domain, DatabaseResp s2Database) throws Exception { public ModelResp addModel_2(DomainResp s2Domain, DatabaseResp s2Database) throws Exception {
@@ -125,7 +124,7 @@ public class CspiderDemo extends S2BaseDemo {
modelDetail.setQueryType("sql_query"); modelDetail.setQueryType("sql_query");
modelDetail.setSqlQuery("SELECT artist_name, citizenship, gender, g_name FROM artist"); modelDetail.setSqlQuery("SELECT artist_name, citizenship, gender, g_name FROM artist");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
return modelService.createModel(modelReq, user); return modelService.createModel(modelReq, defaultUser);
} }
public ModelResp addModel_3(DomainResp s2Domain, DatabaseResp s2Database) throws Exception { public ModelResp addModel_3(DomainResp s2Domain, DatabaseResp s2Database) throws Exception {
@@ -153,7 +152,7 @@ public class CspiderDemo extends S2BaseDemo {
modelDetail modelDetail
.setSqlQuery("SELECT f_id, artist_name, file_size, duration, formats FROM files"); .setSqlQuery("SELECT f_id, artist_name, file_size, duration, formats FROM files");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
return modelService.createModel(modelReq, user); return modelService.createModel(modelReq, defaultUser);
} }
public ModelResp addModel_4(DomainResp s2Domain, DatabaseResp s2Database) throws Exception { public ModelResp addModel_4(DomainResp s2Domain, DatabaseResp s2Database) throws Exception {
@@ -191,7 +190,7 @@ public class CspiderDemo extends S2BaseDemo {
modelDetail.setSqlQuery("SELECT imp_date, song_name, artist_name, country, f_id, g_name, " modelDetail.setSqlQuery("SELECT imp_date, song_name, artist_name, country, f_id, g_name, "
+ " rating, languages, releasedate, resolution FROM song"); + " rating, languages, releasedate, resolution FROM song");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
return modelService.createModel(modelReq, user); return modelService.createModel(modelReq, defaultUser);
} }
public void addDataSet_1(DomainResp s2Domain) { public void addDataSet_1(DomainResp s2Domain) {
@@ -224,7 +223,7 @@ public class CspiderDemo extends S2BaseDemo {
queryConfig.setDetailTypeDefaultConfig(detailTypeDefaultConfig); queryConfig.setDetailTypeDefaultConfig(detailTypeDefaultConfig);
queryConfig.setAggregateTypeDefaultConfig(aggregateTypeDefaultConfig); queryConfig.setAggregateTypeDefaultConfig(aggregateTypeDefaultConfig);
dataSetReq.setQueryConfig(queryConfig); dataSetReq.setQueryConfig(queryConfig);
dataSetService.save(dataSetReq, User.getDefaultUser()); dataSetService.save(dataSetReq, defaultUser);
} }
public void addModelRela_1(DomainResp s2Domain, ModelResp genreModelResp, public void addModelRela_1(DomainResp s2Domain, ModelResp genreModelResp,
@@ -237,7 +236,7 @@ public class CspiderDemo extends S2BaseDemo {
modelRelaReq.setToModelId(genreModelResp.getId()); modelRelaReq.setToModelId(genreModelResp.getId());
modelRelaReq.setJoinType("left join"); modelRelaReq.setJoinType("left join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
public void addModelRela_2(DomainResp s2Domain, ModelResp filesModelResp, public void addModelRela_2(DomainResp s2Domain, ModelResp filesModelResp,
@@ -251,7 +250,7 @@ public class CspiderDemo extends S2BaseDemo {
modelRelaReq.setToModelId(artistModelResp.getId()); modelRelaReq.setToModelId(artistModelResp.getId());
modelRelaReq.setJoinType("left join"); modelRelaReq.setJoinType("left join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
public void addModelRela_3(DomainResp s2Domain, ModelResp songModelResp, public void addModelRela_3(DomainResp s2Domain, ModelResp songModelResp,
@@ -265,7 +264,7 @@ public class CspiderDemo extends S2BaseDemo {
modelRelaReq.setToModelId(artistModelResp.getId()); modelRelaReq.setToModelId(artistModelResp.getId());
modelRelaReq.setJoinType("left join"); modelRelaReq.setJoinType("left join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
public void addModelRela_4(DomainResp s2Domain, ModelResp songModelResp, public void addModelRela_4(DomainResp s2Domain, ModelResp songModelResp,
@@ -278,7 +277,7 @@ public class CspiderDemo extends S2BaseDemo {
modelRelaReq.setToModelId(genreModelResp.getId()); modelRelaReq.setToModelId(genreModelResp.getId());
modelRelaReq.setJoinType("left join"); modelRelaReq.setJoinType("left join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
public void addModelRela_5(DomainResp s2Domain, ModelResp songModelResp, public void addModelRela_5(DomainResp s2Domain, ModelResp songModelResp,
@@ -291,11 +290,11 @@ public class CspiderDemo extends S2BaseDemo {
modelRelaReq.setToModelId(filesModelResp.getId()); modelRelaReq.setToModelId(filesModelResp.getId());
modelRelaReq.setJoinType("left join"); modelRelaReq.setJoinType("left join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
private void batchPushlishMetric() { private void batchPushlishMetric() {
List<Long> ids = Lists.newArrayList(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L); List<Long> ids = Lists.newArrayList(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L);
metricService.batchPublish(ids, User.getDefaultUser()); metricService.batchPublish(ids, defaultUser);
} }
} }

View File

@@ -2,7 +2,6 @@ package com.tencent.supersonic.demo;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.chat.server.agent.Agent; import com.tencent.supersonic.chat.server.agent.Agent;
import com.tencent.supersonic.chat.server.agent.AgentToolType; import com.tencent.supersonic.chat.server.agent.AgentToolType;
import com.tencent.supersonic.chat.server.agent.LLMParserTool; import com.tencent.supersonic.chat.server.agent.LLMParserTool;
@@ -68,7 +67,7 @@ public class DuSQLDemo extends S2BaseDemo {
domainReq.setViewOrgs(Collections.singletonList("1")); domainReq.setViewOrgs(Collections.singletonList("1"));
domainReq.setAdmins(Collections.singletonList("admin")); domainReq.setAdmins(Collections.singletonList("admin"));
domainReq.setAdminOrgs(Collections.emptyList()); domainReq.setAdminOrgs(Collections.emptyList());
domainService.createDomain(domainReq, user); domainService.createDomain(domainReq, defaultUser);
} }
// 9 // 9
@@ -112,7 +111,7 @@ public class DuSQLDemo extends S2BaseDemo {
modelDetail.setSqlQuery("SELECT imp_date,company_id,company_name,headquarter_address," modelDetail.setSqlQuery("SELECT imp_date,company_id,company_name,headquarter_address,"
+ "company_established_time,founder,ceo,annual_turnover,employee_count FROM company"); + "company_established_time,founder,ceo,annual_turnover,employee_count FROM company");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
modelService.createModel(modelReq, user); modelService.createModel(modelReq, defaultUser);
} }
// 10 // 10
@@ -154,7 +153,7 @@ public class DuSQLDemo extends S2BaseDemo {
modelDetail.setSqlQuery("SELECT imp_date,brand_id,brand_name,brand_established_time," modelDetail.setSqlQuery("SELECT imp_date,brand_id,brand_name,brand_established_time,"
+ "company_id,legal_representative,registered_capital FROM brand"); + "company_id,legal_representative,registered_capital FROM brand");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
modelService.createModel(modelReq, user); modelService.createModel(modelReq, defaultUser);
} }
// 11 // 11
@@ -194,13 +193,13 @@ public class DuSQLDemo extends S2BaseDemo {
modelDetail.setSqlQuery("SELECT imp_date,company_id,brand_id,revenue_proportion," modelDetail.setSqlQuery("SELECT imp_date,company_id,brand_id,revenue_proportion,"
+ "profit_proportion,expenditure_proportion FROM company_revenue"); + "profit_proportion,expenditure_proportion FROM company_revenue");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
modelService.createModel(modelReq, user); modelService.createModel(modelReq, defaultUser);
MetricResp metricResp = metricService.getMetric(13L, user); MetricResp metricResp = metricService.getMetric(13L, defaultUser);
MetricReq metricReq = new MetricReq(); MetricReq metricReq = new MetricReq();
BeanUtils.copyProperties(metricResp, metricReq); BeanUtils.copyProperties(metricResp, metricReq);
metricReq.setAlias("收入比例"); metricReq.setAlias("收入比例");
metricService.updateMetric(metricReq, user); metricService.updateMetric(metricReq, defaultUser);
} }
// 12 // 12
@@ -242,7 +241,7 @@ public class DuSQLDemo extends S2BaseDemo {
modelDetail.setSqlQuery("SELECT imp_date,year_time,brand_id,revenue,profit," modelDetail.setSqlQuery("SELECT imp_date,year_time,brand_id,revenue,profit,"
+ "revenue_growth_year_on_year,profit_growth_year_on_year FROM company_brand_revenue"); + "revenue_growth_year_on_year,profit_growth_year_on_year FROM company_brand_revenue");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
modelService.createModel(modelReq, user); modelService.createModel(modelReq, defaultUser);
} }
public void addDataSet_1() { public void addDataSet_1() {
@@ -274,7 +273,7 @@ public class DuSQLDemo extends S2BaseDemo {
aggregateTypeDefaultConfig.setTimeDefaultConfig(timeDefaultConfig); aggregateTypeDefaultConfig.setTimeDefaultConfig(timeDefaultConfig);
queryConfig.setAggregateTypeDefaultConfig(aggregateTypeDefaultConfig); queryConfig.setAggregateTypeDefaultConfig(aggregateTypeDefaultConfig);
dataSetReq.setQueryConfig(queryConfig); dataSetReq.setQueryConfig(queryConfig);
dataSetService.save(dataSetReq, User.getDefaultUser()); dataSetService.save(dataSetReq, defaultUser);
} }
public void addModelRela_1() { public void addModelRela_1() {
@@ -287,7 +286,7 @@ public class DuSQLDemo extends S2BaseDemo {
modelRelaReq.setToModelId(10L); modelRelaReq.setToModelId(10L);
modelRelaReq.setJoinType("inner join"); modelRelaReq.setJoinType("inner join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
public void addModelRela_2() { public void addModelRela_2() {
@@ -300,7 +299,7 @@ public class DuSQLDemo extends S2BaseDemo {
modelRelaReq.setToModelId(11L); modelRelaReq.setToModelId(11L);
modelRelaReq.setJoinType("inner join"); modelRelaReq.setJoinType("inner join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
public void addModelRela_3() { public void addModelRela_3() {
@@ -312,7 +311,7 @@ public class DuSQLDemo extends S2BaseDemo {
modelRelaReq.setToModelId(11L); modelRelaReq.setToModelId(11L);
modelRelaReq.setJoinType("inner join"); modelRelaReq.setJoinType("inner join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
public void addModelRela_4() { public void addModelRela_4() {
@@ -324,7 +323,7 @@ public class DuSQLDemo extends S2BaseDemo {
modelRelaReq.setToModelId(12L); modelRelaReq.setToModelId(12L);
modelRelaReq.setJoinType("inner join"); modelRelaReq.setJoinType("inner join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
private void addAgent() { private void addAgent() {
@@ -344,6 +343,6 @@ public class DuSQLDemo extends S2BaseDemo {
agent.setToolConfig(JSONObject.toJSONString(toolConfig)); agent.setToolConfig(JSONObject.toJSONString(toolConfig));
log.info("agent:{}", JsonUtil.toString(agent)); log.info("agent:{}", JsonUtil.toString(agent));
agentService.createAgent(agent, User.getDefaultUser()); agentService.createAgent(agent, defaultUser);
} }
} }

View File

@@ -2,7 +2,6 @@ package com.tencent.supersonic.demo;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.chat.server.agent.Agent; import com.tencent.supersonic.chat.server.agent.Agent;
import com.tencent.supersonic.chat.server.agent.AgentToolType; import com.tencent.supersonic.chat.server.agent.AgentToolType;
import com.tencent.supersonic.chat.server.agent.LLMParserTool; import com.tencent.supersonic.chat.server.agent.LLMParserTool;
@@ -43,7 +42,7 @@ public class S2ArtistDemo extends S2BaseDemo {
try { try {
DomainResp singerDomain = addDomain(); DomainResp singerDomain = addDomain();
TagObjectResp singerTagObject = addTagObjectSinger(singerDomain); TagObjectResp singerTagObject = addTagObjectSinger(singerDomain);
ModelResp singerModel = addModel(singerDomain, demoDatabaseResp, singerTagObject); ModelResp singerModel = addModel(singerDomain, demoDatabase, singerTagObject);
addTags(singerModel); addTags(singerModel);
long dataSetId = addDataSet(singerDomain, singerModel); long dataSetId = addDataSet(singerDomain, singerModel);
addAgent(dataSetId); addAgent(dataSetId);
@@ -69,8 +68,7 @@ public class S2ArtistDemo extends S2BaseDemo {
tagObjectReq.setDomainId(singerDomain.getId()); tagObjectReq.setDomainId(singerDomain.getId());
tagObjectReq.setName("歌手"); tagObjectReq.setName("歌手");
tagObjectReq.setBizName("singer"); tagObjectReq.setBizName("singer");
User user = User.getDefaultUser(); return tagObjectService.create(tagObjectReq, defaultUser);
return tagObjectService.create(tagObjectReq, user);
} }
public DomainResp addDomain() { public DomainResp addDomain() {
@@ -84,7 +82,7 @@ public class S2ArtistDemo extends S2BaseDemo {
domainReq.setAdmins(Arrays.asList("admin", "alice")); domainReq.setAdmins(Arrays.asList("admin", "alice"));
domainReq.setAdminOrgs(Collections.emptyList()); domainReq.setAdminOrgs(Collections.emptyList());
domainReq.setIsOpen(1); domainReq.setIsOpen(1);
return domainService.createDomain(domainReq, user); return domainService.createDomain(domainReq, defaultUser);
} }
public ModelResp addModel(DomainResp singerDomain, DatabaseResp s2Database, public ModelResp addModel(DomainResp singerDomain, DatabaseResp s2Database,
@@ -121,7 +119,7 @@ public class S2ArtistDemo extends S2BaseDemo {
modelDetail.setSqlQuery("select singer_name, act_area, song_name, genre, " modelDetail.setSqlQuery("select singer_name, act_area, song_name, genre, "
+ "js_play_cnt, down_cnt, favor_cnt from singer"); + "js_play_cnt, down_cnt, favor_cnt from singer");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
return modelService.createModel(modelReq, user); return modelService.createModel(modelReq, defaultUser);
} }
private void addTags(ModelResp model) { private void addTags(ModelResp model) {
@@ -159,7 +157,7 @@ public class S2ArtistDemo extends S2BaseDemo {
queryConfig.setDetailTypeDefaultConfig(detailTypeDefaultConfig); queryConfig.setDetailTypeDefaultConfig(detailTypeDefaultConfig);
queryConfig.setAggregateTypeDefaultConfig(aggregateTypeDefaultConfig); queryConfig.setAggregateTypeDefaultConfig(aggregateTypeDefaultConfig);
dataSetReq.setQueryConfig(queryConfig); dataSetReq.setQueryConfig(queryConfig);
DataSetResp dataSetResp = dataSetService.save(dataSetReq, User.getDefaultUser()); DataSetResp dataSetResp = dataSetService.save(dataSetReq, defaultUser);
return dataSetResp.getId(); return dataSetResp.getId();
} }
@@ -185,6 +183,6 @@ public class S2ArtistDemo extends S2BaseDemo {
toolConfig.getTools().add(llmParserTool); toolConfig.getTools().add(llmParserTool);
} }
agent.setToolConfig(JSONObject.toJSONString(toolConfig)); agent.setToolConfig(JSONObject.toJSONString(toolConfig));
agentService.createAgent(agent, User.getDefaultUser()); agentService.createAgent(agent, defaultUser);
} }
} }

View File

@@ -5,7 +5,6 @@ import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.auth.api.authorization.service.AuthService; import com.tencent.supersonic.auth.api.authorization.service.AuthService;
import com.tencent.supersonic.chat.server.pojo.ChatModel; import com.tencent.supersonic.chat.server.pojo.ChatModel;
import com.tencent.supersonic.chat.server.service.*; import com.tencent.supersonic.chat.server.service.*;
import com.tencent.supersonic.common.service.SystemConfigService;
import com.tencent.supersonic.common.util.AESEncryptionUtil; import com.tencent.supersonic.common.util.AESEncryptionUtil;
import com.tencent.supersonic.headless.api.pojo.DataSetModelConfig; import com.tencent.supersonic.headless.api.pojo.DataSetModelConfig;
import com.tencent.supersonic.headless.api.pojo.DrillDownDimension; import com.tencent.supersonic.headless.api.pojo.DrillDownDimension;
@@ -19,7 +18,6 @@ import com.tencent.supersonic.headless.api.pojo.response.DatabaseResp;
import com.tencent.supersonic.headless.api.pojo.response.DimensionResp; import com.tencent.supersonic.headless.api.pojo.response.DimensionResp;
import com.tencent.supersonic.headless.api.pojo.response.MetricResp; import com.tencent.supersonic.headless.api.pojo.response.MetricResp;
import com.tencent.supersonic.headless.api.pojo.response.ModelResp; import com.tencent.supersonic.headless.api.pojo.response.ModelResp;
import com.tencent.supersonic.headless.server.service.CanvasService;
import com.tencent.supersonic.headless.server.service.DataSetService; import com.tencent.supersonic.headless.server.service.DataSetService;
import com.tencent.supersonic.headless.server.service.DatabaseService; import com.tencent.supersonic.headless.server.service.DatabaseService;
import com.tencent.supersonic.headless.server.service.DimensionService; import com.tencent.supersonic.headless.server.service.DimensionService;
@@ -45,10 +43,11 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public abstract class S2BaseDemo implements CommandLineRunner { public abstract class S2BaseDemo implements CommandLineRunner {
protected DatabaseResp demoDatabaseResp;
protected ChatModel chatModel;
protected User user = User.getDefaultUser(); protected DatabaseResp demoDatabase;
protected ChatModel demoChatModel;
protected User defaultUser = User.getDefaultUser();
@Autowired @Autowired
protected DatabaseService databaseService; protected DatabaseService databaseService;
@Autowired @Autowired
@@ -82,10 +81,6 @@ public abstract class S2BaseDemo implements CommandLineRunner {
@Autowired @Autowired
protected AgentService agentService; protected AgentService agentService;
@Autowired @Autowired
protected SystemConfigService sysParameterService;
@Autowired
protected CanvasService canvasService;
@Autowired
protected DictWordService dictWordService; protected DictWordService dictWordService;
@Autowired @Autowired
protected ChatModelService chatModelService; protected ChatModelService chatModelService;
@@ -97,8 +92,8 @@ public abstract class S2BaseDemo implements CommandLineRunner {
protected boolean demoEnableLlm; protected boolean demoEnableLlm;
public void run(String... args) { public void run(String... args) {
demoDatabaseResp = addDatabaseIfNotExist(); demoDatabase = addDatabaseIfNotExist();
addChatModelIfNotExist(); demoChatModel = addChatModelIfNotExist();
if (demoList != null && demoList.contains(getClass().getSimpleName())) { if (demoList != null && demoList.contains(getClass().getSimpleName())) {
if (checkNeedToRun()) { if (checkNeedToRun()) {
doRun(); doRun();
@@ -111,14 +106,14 @@ public abstract class S2BaseDemo implements CommandLineRunner {
abstract boolean checkNeedToRun(); abstract boolean checkNeedToRun();
protected DatabaseResp addDatabaseIfNotExist() { protected DatabaseResp addDatabaseIfNotExist() {
List<DatabaseResp> databaseList = databaseService.getDatabaseList(User.getDefaultUser()); List<DatabaseResp> databaseList = databaseService.getDatabaseList(defaultUser);
if (!CollectionUtils.isEmpty(databaseList)) { if (!CollectionUtils.isEmpty(databaseList)) {
return databaseList.get(0); return databaseList.get(0);
} }
String url = dataSourceProperties.getUrl(); String url = dataSourceProperties.getUrl();
DatabaseReq databaseReq = new DatabaseReq(); DatabaseReq databaseReq = new DatabaseReq();
databaseReq.setName("数据实例"); databaseReq.setName("H2数据库DEMO");
databaseReq.setDescription("样例数据库实例"); databaseReq.setDescription("样例数据库实例仅用于体验,正式使用请切换持久化数据库");
if (StringUtils.isNotBlank(url) if (StringUtils.isNotBlank(url)
&& url.toLowerCase().contains(DataType.MYSQL.getFeature().toLowerCase())) { && url.toLowerCase().contains(DataType.MYSQL.getFeature().toLowerCase())) {
databaseReq.setType(DataType.MYSQL.getFeature()); databaseReq.setType(DataType.MYSQL.getFeature());
@@ -130,18 +125,21 @@ public abstract class S2BaseDemo implements CommandLineRunner {
databaseReq.setUsername(dataSourceProperties.getUsername()); databaseReq.setUsername(dataSourceProperties.getUsername());
databaseReq databaseReq
.setPassword(AESEncryptionUtil.aesEncryptECB(dataSourceProperties.getPassword())); .setPassword(AESEncryptionUtil.aesEncryptECB(dataSourceProperties.getPassword()));
return databaseService.createOrUpdateDatabase(databaseReq, user); return databaseService.createOrUpdateDatabase(databaseReq, defaultUser);
} }
protected void addChatModelIfNotExist() { protected ChatModel addChatModelIfNotExist() {
if (chatModelService.getChatModels().size() > 0) { List<ChatModel> chatModels = chatModelService.getChatModels();
return; if (chatModels.size() > 0) {
return chatModels.get(0);
} else {
ChatModel chatModel = new ChatModel();
chatModel.setName("OpenAI模型DEMO");
chatModel.setDescription("由langchain4j社区提供仅用于体验(单次请求最大token数1000), 正式使用请切换大模型");
chatModel.setConfig(ModelProvider.DEMO_CHAT_MODEL);
chatModel = chatModelService.createChatModel(chatModel, defaultUser);
return chatModel;
} }
chatModel = new ChatModel();
chatModel.setName("OpenAI模型DEMO");
chatModel.setDescription("由langchain4j社区提供仅用于体验单次请求最大token数1000");
chatModel.setConfig(ModelProvider.DEMO_CHAT_MODEL);
chatModel = chatModelService.createChatModel(chatModel, User.getDefaultUser());
} }
protected MetricResp getMetric(String bizName, ModelResp model) { protected MetricResp getMetric(String bizName, ModelResp model) {

View File

@@ -3,7 +3,6 @@ package com.tencent.supersonic.demo;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.auth.api.authorization.pojo.AuthGroup; import com.tencent.supersonic.auth.api.authorization.pojo.AuthGroup;
import com.tencent.supersonic.auth.api.authorization.pojo.AuthRule; import com.tencent.supersonic.auth.api.authorization.pojo.AuthRule;
import com.tencent.supersonic.chat.api.pojo.request.ChatParseReq; import com.tencent.supersonic.chat.api.pojo.request.ChatParseReq;
@@ -73,9 +72,9 @@ public class S2VisitsDemo extends S2BaseDemo {
TagObjectResp s2TagObject = addTagObjectUser(s2Domain); TagObjectResp s2TagObject = addTagObjectUser(s2Domain);
// create models // create models
ModelResp userModel = addModel_1(s2Domain, demoDatabaseResp, s2TagObject); ModelResp userModel = addModel_1(s2Domain, demoDatabase, s2TagObject);
ModelResp pvUvModel = addModel_2(s2Domain, demoDatabaseResp); ModelResp pvUvModel = addModel_2(s2Domain, demoDatabase);
ModelResp stayTimeModel = addModel_3(s2Domain, demoDatabaseResp); ModelResp stayTimeModel = addModel_3(s2Domain, demoDatabase);
addModelRela_1(s2Domain, userModel, pvUvModel); addModelRela_1(s2Domain, userModel, pvUvModel);
addModelRela_2(s2Domain, userModel, stayTimeModel); addModelRela_2(s2Domain, userModel, stayTimeModel);
addTags(userModel); addTags(userModel);
@@ -129,7 +128,7 @@ public class S2VisitsDemo extends S2BaseDemo {
} }
public void addSampleChats(Integer agentId) { public void addSampleChats(Integer agentId) {
Long chatId = chatManageService.addChat(user, "样例对话1", agentId); Long chatId = chatManageService.addChat(defaultUser, "样例对话1", agentId);
submitText(chatId.intValue(), agentId, "超音数 访问次数"); submitText(chatId.intValue(), agentId, "超音数 访问次数");
submitText(chatId.intValue(), agentId, "按部门统计"); submitText(chatId.intValue(), agentId, "按部门统计");
submitText(chatId.intValue(), agentId, "查询近30天"); submitText(chatId.intValue(), agentId, "查询近30天");
@@ -139,7 +138,7 @@ public class S2VisitsDemo extends S2BaseDemo {
private void submitText(int chatId, int agentId, String queryText) { private void submitText(int chatId, int agentId, String queryText) {
chatQueryService.parseAndExecute(ChatParseReq.builder().chatId(chatId).agentId(agentId) chatQueryService.parseAndExecute(ChatParseReq.builder().chatId(chatId).agentId(agentId)
.queryText(queryText).user(User.getDefaultUser()).disableLLM(true).build()); .queryText(queryText).user(defaultUser).disableLLM(true).build());
} }
private Integer addAgent(long dataSetId) { private Integer addAgent(long dataSetId) {
@@ -167,15 +166,15 @@ public class S2VisitsDemo extends S2BaseDemo {
agent.setToolConfig(JSONObject.toJSONString(toolConfig)); agent.setToolConfig(JSONObject.toJSONString(toolConfig));
// configure chat models // configure chat models
Map<ChatModelType, Integer> chatModelConfig = Maps.newHashMap(); Map<ChatModelType, Integer> chatModelConfig = Maps.newHashMap();
chatModelConfig.put(ChatModelType.TEXT_TO_SQL, chatModel.getId()); chatModelConfig.put(ChatModelType.TEXT_TO_SQL, demoChatModel.getId());
chatModelConfig.put(ChatModelType.MEMORY_REVIEW, chatModel.getId()); chatModelConfig.put(ChatModelType.MEMORY_REVIEW, demoChatModel.getId());
chatModelConfig.put(ChatModelType.RESPONSE_GENERATE, chatModel.getId()); chatModelConfig.put(ChatModelType.RESPONSE_GENERATE, demoChatModel.getId());
chatModelConfig.put(ChatModelType.MULTI_TURN_REWRITE, chatModel.getId()); chatModelConfig.put(ChatModelType.MULTI_TURN_REWRITE, demoChatModel.getId());
agent.setChatModelConfig(chatModelConfig); agent.setChatModelConfig(chatModelConfig);
MultiTurnConfig multiTurnConfig = new MultiTurnConfig(true); MultiTurnConfig multiTurnConfig = new MultiTurnConfig(true);
agent.setMultiTurnConfig(multiTurnConfig); agent.setMultiTurnConfig(multiTurnConfig);
Agent agentCreated = agentService.createAgent(agent, User.getDefaultUser()); Agent agentCreated = agentService.createAgent(agent, defaultUser);
return agentCreated.getId(); return agentCreated.getId();
} }
@@ -188,7 +187,7 @@ public class S2VisitsDemo extends S2BaseDemo {
domainReq.setViewers(Arrays.asList("admin", "tom")); domainReq.setViewers(Arrays.asList("admin", "tom"));
domainReq.setAdmins(Arrays.asList("admin", "jack")); domainReq.setAdmins(Arrays.asList("admin", "jack"));
domainReq.setIsOpen(1); domainReq.setIsOpen(1);
return domainService.createDomain(domainReq, user); return domainService.createDomain(domainReq, defaultUser);
} }
public ModelResp addModel_1(DomainResp s2Domain, DatabaseResp s2Database, public ModelResp addModel_1(DomainResp s2Domain, DatabaseResp s2Database,
@@ -220,7 +219,7 @@ public class S2VisitsDemo extends S2BaseDemo {
modelDetail.setQueryType("sql_query"); modelDetail.setQueryType("sql_query");
modelDetail.setSqlQuery("select user_name,department from s2_user_department"); modelDetail.setSqlQuery("select user_name,department from s2_user_department");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
return modelService.createModel(modelReq, user); return modelService.createModel(modelReq, defaultUser);
} }
public ModelResp addModel_2(DomainResp s2Domain, DatabaseResp s2Database) throws Exception { public ModelResp addModel_2(DomainResp s2Domain, DatabaseResp s2Database) throws Exception {
@@ -264,7 +263,7 @@ public class S2VisitsDemo extends S2BaseDemo {
+ "user_name as user_id FROM s2_pv_uv_statis"); + "user_name as user_id FROM s2_pv_uv_statis");
modelDetail.setQueryType("sql_query"); modelDetail.setQueryType("sql_query");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
return modelService.createModel(modelReq, user); return modelService.createModel(modelReq, defaultUser);
} }
public ModelResp addModel_3(DomainResp s2Domain, DatabaseResp s2Database) throws Exception { public ModelResp addModel_3(DomainResp s2Domain, DatabaseResp s2Database) throws Exception {
@@ -306,7 +305,7 @@ public class S2VisitsDemo extends S2BaseDemo {
.setSqlQuery("select imp_date,user_name,stay_hours,page from s2_stay_time_statis"); .setSqlQuery("select imp_date,user_name,stay_hours,page from s2_stay_time_statis");
modelDetail.setQueryType("sql_query"); modelDetail.setQueryType("sql_query");
modelReq.setModelDetail(modelDetail); modelReq.setModelDetail(modelDetail);
return modelService.createModel(modelReq, user); return modelService.createModel(modelReq, defaultUser);
} }
public void addModelRela_1(DomainResp s2Domain, ModelResp userDepartmentModel, public void addModelRela_1(DomainResp s2Domain, ModelResp userDepartmentModel,
@@ -319,7 +318,7 @@ public class S2VisitsDemo extends S2BaseDemo {
modelRelaReq.setToModelId(pvUvModel.getId()); modelRelaReq.setToModelId(pvUvModel.getId());
modelRelaReq.setJoinType("left join"); modelRelaReq.setJoinType("left join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
public void addModelRela_2(DomainResp s2Domain, ModelResp userDepartmentModel, public void addModelRela_2(DomainResp s2Domain, ModelResp userDepartmentModel,
@@ -332,7 +331,7 @@ public class S2VisitsDemo extends S2BaseDemo {
modelRelaReq.setToModelId(stayTimeModel.getId()); modelRelaReq.setToModelId(stayTimeModel.getId());
modelRelaReq.setJoinType("left join"); modelRelaReq.setJoinType("left join");
modelRelaReq.setJoinConditions(joinConditions); modelRelaReq.setJoinConditions(joinConditions);
modelRelaService.save(modelRelaReq, user); modelRelaService.save(modelRelaReq, defaultUser);
} }
private void addTags(ModelResp model) { private void addTags(ModelResp model) {
@@ -354,7 +353,7 @@ public class S2VisitsDemo extends S2BaseDemo {
dimensionReq.setDescription("页面"); dimensionReq.setDescription("页面");
dimensionReq.setExpr("page"); dimensionReq.setExpr("page");
dimensionReq.setDimValueMaps(Collections.emptyList()); dimensionReq.setDimValueMaps(Collections.emptyList());
dimensionService.updateDimension(dimensionReq, user); dimensionService.updateDimension(dimensionReq, defaultUser);
} }
public void updateMetric(ModelResp stayTimeModel, DimensionResp departmentDimension, public void updateMetric(ModelResp stayTimeModel, DimensionResp departmentDimension,
@@ -379,7 +378,7 @@ public class S2VisitsDemo extends S2BaseDemo {
metricReq.setMetricDefineType(MetricDefineType.MEASURE); metricReq.setMetricDefineType(MetricDefineType.MEASURE);
metricReq.setRelateDimension(getRelateDimension( metricReq.setRelateDimension(getRelateDimension(
Lists.newArrayList(departmentDimension.getId(), userDimension.getId()))); Lists.newArrayList(departmentDimension.getId(), userDimension.getId())));
metricService.updateMetric(metricReq, user); metricService.updateMetric(metricReq, defaultUser);
} }
public void updateMetric_pv(ModelResp pvUvModel, DimensionResp departmentDimension, public void updateMetric_pv(ModelResp pvUvModel, DimensionResp departmentDimension,
@@ -401,7 +400,7 @@ public class S2VisitsDemo extends S2BaseDemo {
metricReq.setMetricDefineType(MetricDefineType.MEASURE); metricReq.setMetricDefineType(MetricDefineType.MEASURE);
metricReq.setRelateDimension(getRelateDimension( metricReq.setRelateDimension(getRelateDimension(
Lists.newArrayList(departmentDimension.getId(), userDimension.getId()))); Lists.newArrayList(departmentDimension.getId(), userDimension.getId())));
metricService.updateMetric(metricReq, user); metricService.updateMetric(metricReq, defaultUser);
} }
public MetricResp addMetric_uv(ModelResp uvModel, DimensionResp departmentDimension) public MetricResp addMetric_uv(ModelResp uvModel, DimensionResp departmentDimension)
@@ -422,7 +421,7 @@ public class S2VisitsDemo extends S2BaseDemo {
metricReq.setMetricDefineType(MetricDefineType.FIELD); metricReq.setMetricDefineType(MetricDefineType.FIELD);
metricReq.setRelateDimension( metricReq.setRelateDimension(
getRelateDimension(Lists.newArrayList(departmentDimension.getId()))); getRelateDimension(Lists.newArrayList(departmentDimension.getId())));
return metricService.createMetric(metricReq, user); return metricService.createMetric(metricReq, defaultUser);
} }
public MetricResp addMetric_pv_avg(MetricResp metricPv, MetricResp metricUv, public MetricResp addMetric_pv_avg(MetricResp metricPv, MetricResp metricUv,
@@ -447,7 +446,7 @@ public class S2VisitsDemo extends S2BaseDemo {
metricReq.setMetricDefineType(MetricDefineType.METRIC); metricReq.setMetricDefineType(MetricDefineType.METRIC);
metricReq.setRelateDimension( metricReq.setRelateDimension(
getRelateDimension(Lists.newArrayList(departmentDimension.getId()))); getRelateDimension(Lists.newArrayList(departmentDimension.getId())));
return metricService.createMetric(metricReq, user); return metricService.createMetric(metricReq, defaultUser);
} }
public DataSetResp addDataSet(DomainResp s2Domain) { public DataSetResp addDataSet(DomainResp s2Domain) {
@@ -462,7 +461,7 @@ public class S2VisitsDemo extends S2BaseDemo {
dataSetDetail.setDataSetModelConfigs(dataSetModelConfigs); dataSetDetail.setDataSetModelConfigs(dataSetModelConfigs);
dataSetReq.setDataSetDetail(dataSetDetail); dataSetReq.setDataSetDetail(dataSetDetail);
dataSetReq.setTypeEnum(TypeEnums.DATASET); dataSetReq.setTypeEnum(TypeEnums.DATASET);
return dataSetService.save(dataSetReq, User.getDefaultUser()); return dataSetService.save(dataSetReq, defaultUser);
} }
public void addTerm(DomainResp s2Domain) { public void addTerm(DomainResp s2Domain) {
@@ -471,7 +470,7 @@ public class S2VisitsDemo extends S2BaseDemo {
termReq.setDescription("指近10天"); termReq.setDescription("指近10天");
termReq.setAlias(Lists.newArrayList("近一段时间")); termReq.setAlias(Lists.newArrayList("近一段时间"));
termReq.setDomainId(s2Domain.getId()); termReq.setDomainId(s2Domain.getId());
termService.saveOrUpdate(termReq, User.getDefaultUser()); termService.saveOrUpdate(termReq, defaultUser);
} }
public void addTerm_1(DomainResp s2Domain) { public void addTerm_1(DomainResp s2Domain) {
@@ -480,7 +479,7 @@ public class S2VisitsDemo extends S2BaseDemo {
termReq.setDescription("用户为tom和lucy"); termReq.setDescription("用户为tom和lucy");
termReq.setAlias(Lists.newArrayList("VIP用户")); termReq.setAlias(Lists.newArrayList("VIP用户"));
termReq.setDomainId(s2Domain.getId()); termReq.setDomainId(s2Domain.getId());
termService.saveOrUpdate(termReq, User.getDefaultUser()); termService.saveOrUpdate(termReq, defaultUser);
} }
public void addAuthGroup_1(ModelResp stayTimeModel) { public void addAuthGroup_1(ModelResp stayTimeModel) {
@@ -529,7 +528,7 @@ public class S2VisitsDemo extends S2BaseDemo {
webBase.setUrl("www.yourbi.com"); webBase.setUrl("www.yourbi.com");
webBase.setParamOptions(Lists.newArrayList()); webBase.setParamOptions(Lists.newArrayList());
plugin1.setConfig(JsonUtil.toString(webBase)); plugin1.setConfig(JsonUtil.toString(webBase));
pluginService.createPlugin(plugin1, user); pluginService.createPlugin(plugin1, defaultUser);
} }
private void addPlugin_1() { private void addPlugin_1() {
@@ -547,7 +546,7 @@ public class S2VisitsDemo extends S2BaseDemo {
webBase.setUrl("http://localhost:9080/api/chat/plugin/pluginDemo"); webBase.setUrl("http://localhost:9080/api/chat/plugin/pluginDemo");
webBase.setParamOptions(Lists.newArrayList()); webBase.setParamOptions(Lists.newArrayList());
plugin1.setConfig(JsonUtil.toString(webBase)); plugin1.setConfig(JsonUtil.toString(webBase));
pluginService.createPlugin(plugin1, user); pluginService.createPlugin(plugin1, defaultUser);
} }
private TagObjectResp addTagObjectUser(DomainResp s2Domain) throws Exception { private TagObjectResp addTagObjectUser(DomainResp s2Domain) throws Exception {
@@ -555,8 +554,7 @@ public class S2VisitsDemo extends S2BaseDemo {
tagObjectReq.setDomainId(s2Domain.getId()); tagObjectReq.setDomainId(s2Domain.getId());
tagObjectReq.setName("用户"); tagObjectReq.setName("用户");
tagObjectReq.setBizName("user"); tagObjectReq.setBizName("user");
User user = User.getDefaultUser(); return tagObjectService.create(tagObjectReq, defaultUser);
return tagObjectService.create(tagObjectReq, user);
} }
private void loadDictWord() { private void loadDictWord() {

View File

@@ -2,7 +2,6 @@ package com.tencent.supersonic.demo;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.tencent.supersonic.auth.api.authentication.pojo.User;
import com.tencent.supersonic.chat.server.agent.Agent; import com.tencent.supersonic.chat.server.agent.Agent;
import com.tencent.supersonic.chat.server.agent.MultiTurnConfig; import com.tencent.supersonic.chat.server.agent.MultiTurnConfig;
import com.tencent.supersonic.chat.server.agent.ToolConfig; import com.tencent.supersonic.chat.server.agent.ToolConfig;
@@ -31,7 +30,7 @@ public class SmallTalkDemo extends S2BaseDemo {
multiTurnConfig.setEnableMultiTurn(true); multiTurnConfig.setEnableMultiTurn(true);
agent.setMultiTurnConfig(multiTurnConfig); agent.setMultiTurnConfig(multiTurnConfig);
agentService.createAgent(agent, User.getDefaultUser()); agentService.createAgent(agent, defaultUser);
} }
@Override @Override