fix(agents): filter out internal strategy notes from followUp output
The model was putting internal notes like "引导回移民话题" in the followUp field instead of actual user-facing questions. Two fixes: 1. Schema: describe followUp as "必须以?结尾,禁止填写内部策略备注" 2. agent-loop: only yield followUp if it contains ?or ? (question mark) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d608403535
commit
6592e72758
|
|
@ -346,7 +346,8 @@ export async function* agentLoop(
|
|||
|
||||
yield { type: 'text', content: answer, timestamp: Date.now() };
|
||||
|
||||
if (parsed.followUp) {
|
||||
// followUp 必须是面向用户的问题(含?),过滤掉内部策略备注
|
||||
if (parsed.followUp && /?|\?/.test(parsed.followUp)) {
|
||||
const followUp = smartTruncate(parsed.followUp, MAX_FOLLOWUP_LENGTH);
|
||||
yield { type: 'text', content: '\n\n' + followUp, timestamp: Date.now() };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const CoordinatorResponseSchema = z.object({
|
|||
'casual_chat', // 闲聊/打招呼:"你好"
|
||||
]),
|
||||
answer: z.string().describe('直接回答用户的文本,简洁精准,默认100字以内'),
|
||||
followUp: z.string().optional().describe('跟进引导问题(可选)'),
|
||||
followUp: z.string().optional().describe('直接对用户提出的跟进问题(必须以?结尾,必须是用户能看到的自然语言问题,禁止填写内部策略备注)'),
|
||||
});
|
||||
|
||||
export type CoordinatorResponse = z.infer<typeof CoordinatorResponseSchema>;
|
||||
|
|
|
|||
Loading…
Reference in New Issue