feat(llm 對話): 新增 prompt builder 與 few-shot 範例組裝,強化 Claude 對話品質

This commit is contained in:
Jeffery
2026-08-14 12:44:48 +08:00
parent 6ce7b2e800
commit 30719a2960
6 changed files with 187 additions and 12 deletions
+2 -2
View File
@@ -63,7 +63,7 @@ export class DialogueService {
options: HandleMessageOptions = {},
): Promise<HandleMessageResult> {
const now = options.now ?? new Date();
this.workingMemory.append(sessionId, { role: "user", content: userInput, timestamp: now });
await this.workingMemory.append(sessionId, { role: "user", content: userInput, timestamp: now });
// I-6:按需生成離線事件(今天只生成一次),成為話題來源。
await this.offlineEvent.maybeGenerate(characterId, now);
@@ -138,7 +138,7 @@ export class DialogueService {
this.outputFilter.filter(text, forbiddenWords),
context.character.personalityArchetype,
);
this.workingMemory.append(sessionId, { role: "character", content: filteredText, timestamp: now });
await this.workingMemory.append(sessionId, { role: "character", content: filteredText, timestamp: now });
return { text: filteredText, actions, isFastChannel, availability: effectiveAvailability, exceptionType, context };
}