mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-20 06:34:55 +00:00
[improvement][launcher]Clean code structure of system demos.
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user