(improvement)(chat)Add SmallTalkDemo and support multi-turn conversation in PLAIN_TEXT mode.

This commit is contained in:
jerryjzhang
2024-06-26 10:19:45 +08:00
parent 82b2552d9d
commit 1e5cfb51df
4 changed files with 94 additions and 3 deletions

View File

@@ -0,0 +1,36 @@
package com.tencent.supersonic.demo;
import com.alibaba.fastjson.JSONObject;
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.AgentConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Component
@Slf4j
@Order(2)
public class SmallTalkDemo extends S2BaseDemo {
public void doRun() {
Agent agent = new Agent();
agent.setName("来闲聊");
agent.setDescription("直接与大模型对话,验证连通性");
agent.setStatus(1);
agent.setEnableSearch(0);
AgentConfig agentConfig = new AgentConfig();
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
agent.setExamples(Lists.newArrayList("如何才能变帅",
"如何才能赚更多钱", "如何才能世界和平"));
agentService.createAgent(agent, User.getFakeUser());
}
@Override
boolean checkNeedToRun() {
return true;
}
}

View File

@@ -71,7 +71,7 @@ s2:
path: /tmp
demo:
names: S2VisitsDemo,S2ArtistDemo
names: S2VisitsDemo,S2ArtistDemo,SmallTalkDemo
enableLLM: true
# swagger配置