From 3bbc3c548fb9864e55a323372e9615377cbb43e7 Mon Sep 17 00:00:00 2001 From: rickgao Date: Wed, 29 Jul 2026 00:18:15 +0800 Subject: [PATCH] fix(vscode): all AskUserQuestions should be answered and added to the context --- .../vscode-question-dialog-multi-answers.md | 5 +++ .../src/components/QuestionDialog.tsx | 37 ++++++++++++++----- 2 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 .changeset/vscode-question-dialog-multi-answers.md diff --git a/.changeset/vscode-question-dialog-multi-answers.md b/.changeset/vscode-question-dialog-multi-answers.md new file mode 100644 index 0000000000..984c34b625 --- /dev/null +++ b/.changeset/vscode-question-dialog-multi-answers.md @@ -0,0 +1,5 @@ +--- +"kimi-code": patch +--- + +Fix only the first question being answerable when the agent asked multiple questions at once; each question is now answered one by one and submitted together. diff --git a/apps/vscode/webview-ui/src/components/QuestionDialog.tsx b/apps/vscode/webview-ui/src/components/QuestionDialog.tsx index 03a6da1fbc..c4919269a9 100644 --- a/apps/vscode/webview-ui/src/components/QuestionDialog.tsx +++ b/apps/vscode/webview-ui/src/components/QuestionDialog.tsx @@ -7,33 +7,45 @@ export function QuestionDialog() { const [customInput, setCustomInput] = useState(""); const [showCustom, setShowCustom] = useState(false); const [selectedIndex, setSelectedIndex] = useState(1); + const [questionIndex, setQuestionIndex] = useState(0); + const [answers, setAnswers] = useState>({}); - // For now, only handle the first question - const question = pendingQuestion?.questions?.[0]; + const questions = pendingQuestion?.questions ?? []; + const question = questions[questionIndex]; useEffect(() => { if (pendingQuestion) { setShowCustom(false); setCustomInput(""); setSelectedIndex(1); + setQuestionIndex(0); + setAnswers({}); } }, [pendingQuestion?.id]); if (!pendingQuestion || !question) return null; + // Step through the questions one by one; submit all answers after the last. + const handleAnswer = async (answer: string) => { + const nextAnswers = { ...answers, [question.question]: answer }; + if (questionIndex + 1 < questions.length) { + setAnswers(nextAnswers); + setQuestionIndex(questionIndex + 1); + setShowCustom(false); + setCustomInput(""); + setSelectedIndex(1); + } else { + await respondQuestion(nextAnswers); + } + }; + const handleSelect = async (optionLabel: string) => { - const answers: Record = { - [question.question]: optionLabel, - }; - await respondQuestion(answers); + await handleAnswer(optionLabel); }; const handleCustomSubmit = async () => { if (!customInput.trim()) return; - const answers: Record = { - [question.question]: customInput.trim(), - }; - await respondQuestion(answers); + await handleAnswer(customInput.trim()); }; const options = question.options || []; @@ -42,6 +54,11 @@ export function QuestionDialog() { return (
+ {questions.length > 1 && ( +
+ Question {questionIndex + 1} of {questions.length} +
+ )} {question.header &&
{question.header}
}
{question.question}