mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
(improvement)(chat)Turn on multi-turn conversation for SmallTalkDemo.
This commit is contained in:
@@ -26,10 +26,11 @@ import static com.tencent.supersonic.chat.server.parser.ParserConfig.PARSER_MULT
|
|||||||
public class PlainTextExecutor implements ChatExecutor {
|
public class PlainTextExecutor implements ChatExecutor {
|
||||||
|
|
||||||
private static final String INSTRUCTION = ""
|
private static final String INSTRUCTION = ""
|
||||||
+ "#Role: You are a nice person to talked to.\n"
|
+ "#Role: You are a nice person to talk to.\n"
|
||||||
+ "#Task: You will have a small talk with the user, please respond quickly and nicely."
|
+ "#Task: Respond quickly and nicely to the user."
|
||||||
+ "#History Conversations: %s\n"
|
+ "#Rules: 1.ALWAYS use the same language as the input.\n"
|
||||||
+ "#Current User Input: %s\n"
|
+ "#History Inputs: %s\n"
|
||||||
|
+ "#Current Input: %s\n"
|
||||||
+ "#Your response: ";
|
+ "#Your response: ";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -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.Agent;
|
||||||
import com.tencent.supersonic.chat.server.agent.AgentConfig;
|
import com.tencent.supersonic.chat.server.agent.AgentConfig;
|
||||||
|
|
||||||
|
import com.tencent.supersonic.chat.server.agent.MultiTurnConfig;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -25,6 +26,9 @@ public class SmallTalkDemo extends S2BaseDemo {
|
|||||||
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
agent.setAgentConfig(JSONObject.toJSONString(agentConfig));
|
||||||
agent.setExamples(Lists.newArrayList("如何才能变帅",
|
agent.setExamples(Lists.newArrayList("如何才能变帅",
|
||||||
"如何才能赚更多钱", "如何才能世界和平"));
|
"如何才能赚更多钱", "如何才能世界和平"));
|
||||||
|
MultiTurnConfig multiTurnConfig = new MultiTurnConfig();
|
||||||
|
multiTurnConfig.setEnableMultiTurn(true);
|
||||||
|
agent.setMultiTurnConfig(multiTurnConfig);
|
||||||
|
|
||||||
agentService.createAgent(agent, User.getFakeUser());
|
agentService.createAgent(agent, User.getFakeUser());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user