feat(core): 实现 ask_user_question 工具的用户输入等待机制
- 创建 UserInputWaiter 管理用户输入等待状态 - 修改 agent-tool-executor 在 requiresUserInput 时等待用户回答 - 添加 onWaitingForInput 回调通知前端显示问题 - Server 端处理 waiting_for_input 广播和 user_input_response 消息 - 前端处理问题显示和用户回答提交 - 修复问题选项在流式输出时被禁用的问题
This commit is contained in:
@@ -84,19 +84,22 @@ export const ChatMessage = forwardRef<HTMLDivElement, ChatMessageProps>(
|
||||
);
|
||||
case 'tool':
|
||||
return <ToolPartItem key={part.id} part={part} />;
|
||||
case 'question':
|
||||
case 'question': {
|
||||
// 问题组件:即使在流式输出时也允许用户回答(除非已回答)
|
||||
const questionPart = part as QuestionMessagePart;
|
||||
return (
|
||||
<AskUserQuestion
|
||||
key={part.id}
|
||||
part={part as QuestionMessagePart}
|
||||
part={questionPart}
|
||||
onAnswer={
|
||||
onAnswerQuestion
|
||||
? (answers) => onAnswerQuestion(part.id, answers)
|
||||
: undefined
|
||||
}
|
||||
disabled={isStreaming}
|
||||
disabled={questionPart.answered}
|
||||
/>
|
||||
);
|
||||
}
|
||||
case 'reasoning':
|
||||
return (
|
||||
<div key={part.id} className="text-fg-muted italic border-l-2 border-line pl-3">
|
||||
|
||||
Reference in New Issue
Block a user