mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
fix: matcher 提示词补 {conversation} 占位符
generateSummary 只替换 {conversation} 占位符,而 buildInstruction 没有它,
导致拼好的「聊天内容+候选角色」从没发给 LLM,全程幻觉。
补上占位符 + 收一下调试日志(不记录聊天原文)。
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
7b2b520cf5
commit
0e229dffa6
1 changed files with 3 additions and 1 deletions
|
|
@ -122,6 +122,7 @@ public class PersonaMatcherServiceImpl implements PersonaMatcherService {
|
|||
.filter(s -> s != null && !s.isBlank())
|
||||
.collect(Collectors.joining("\n"));
|
||||
String conversation = buildConversation(topics, candidates, cur);
|
||||
log.info("[persona-match] user={} 候选{}个 主题{}字符", userId, candidates.size(), topics.length());
|
||||
String promptTemplate = buildInstruction();
|
||||
String resp;
|
||||
try {
|
||||
|
|
@ -172,7 +173,8 @@ public class PersonaMatcherServiceImpl implements PersonaMatcherService {
|
|||
|
||||
private String buildInstruction() {
|
||||
return "你是儿童陪伴角色匹配器。根据【孩子近期聊天】从【候选陪伴角色】的编号列表里选最贴合的一个。"
|
||||
+ "若【当前角色】已足够合适,务必保留当前(孩子需要稳定陪伴)。仅当另一角色明显更贴合时才换。"
|
||||
+ "若【当前角色】已足够合适,务必保留当前(孩子需要稳定陪伴)。仅当另一角色明显更贴合时才换。\n\n"
|
||||
+ "{conversation}\n\n"
|
||||
+ "只返回JSON,不要多余文字:{\"choice\":选中角色的编号(整数),\"score\":0.0到1.0,\"reason\":\"一句话\"}";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue