[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",
"", "string", MODULE_NAME, null, getModelNameDependency());
public static final Parameter CHAT_MODEL_API_KEY =
new Parameter("apiKey", "", "ApiKey", "",
"password", MODULE_NAME, null, getApiKeyDependency());
public static final Parameter CHAT_MODEL_API_KEY = new Parameter("apiKey", "", "ApiKey", "",
"password", MODULE_NAME, null, getApiKeyDependency());
public static final Parameter CHAT_MODEL_ENDPOINT = new Parameter("endpoint", "llama_2_70b",
"Endpoint", "", "string", MODULE_NAME, null, getEndpointDependency());

View File

@@ -122,8 +122,9 @@ public class AgentServiceImpl extends ServiceImpl<AgentDOMapper, AgentDO> implem
continue;
}
try {
chatQueryService.parseAndExecute(ChatParseReq.builder().chatId(-1)
.agentId(agent.getId()).queryText(example).user(User.getDefaultUser()).build());
chatQueryService
.parseAndExecute(ChatParseReq.builder().chatId(-1).agentId(agent.getId())
.queryText(example).user(User.getDefaultUser()).build());
} catch (Exception e) {
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) {
// do not save duplicate memory for exactly the same question
List<ChatMemoryDO> memories = getMemories(ChatMemoryFilter.builder()
.agentId(memory.getAgentId())
.question(memory.getQuestion()).build());
.agentId(memory.getAgentId()).question(memory.getQuestion()).build());
if (memories.size() == 0) {
chatMemoryRepository.createMemory(memory);
}