(improvement)(chat)Turn on multi-turn conversation for SmallTalkDemo.

This commit is contained in:
jerryjzhang
2024-06-26 10:33:18 +08:00
parent 34b76ffd53
commit d9916c9dc0
2 changed files with 9 additions and 4 deletions

View File

@@ -26,10 +26,11 @@ import static com.tencent.supersonic.chat.server.parser.ParserConfig.PARSER_MULT
public class PlainTextExecutor implements ChatExecutor {
private static final String INSTRUCTION = ""
+ "#Role: You are a nice person to talked to.\n"
+ "#Task: You will have a small talk with the user, please respond quickly and nicely."
+ "#History Conversations: %s\n"
+ "#Current User Input: %s\n"
+ "#Role: You are a nice person to talk to.\n"
+ "#Task: Respond quickly and nicely to the user."
+ "#Rules: 1.ALWAYS use the same language as the input.\n"
+ "#History Inputs: %s\n"
+ "#Current Input: %s\n"
+ "#Your response: ";
@Override

View File

@@ -6,6 +6,7 @@ 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 com.tencent.supersonic.chat.server.agent.MultiTurnConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@@ -25,6 +26,9 @@ public class SmallTalkDemo extends S2BaseDemo {
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
agent.setExamples(Lists.newArrayList("如何才能变帅",
"如何才能赚更多钱", "如何才能世界和平"));
MultiTurnConfig multiTurnConfig = new MultiTurnConfig();
multiTurnConfig.setEnableMultiTurn(true);
agent.setMultiTurnConfig(multiTurnConfig);
agentService.createAgent(agent, User.getFakeUser());
}