fix: resolve automated review issues for ask_followup_question

This commit is contained in:
ScDor 2026-02-05 13:49:13 +02:00
parent d3028c32e2
commit 5393c2b43e
4 changed files with 29 additions and 11 deletions

View file

@ -9,7 +9,7 @@ export interface FollowUpData {
/** The question being asked by the LLM */
question?: string
/** Array of questions being asked by the LLM */
questions?: string[]
questions?: FollowUpQuestion[]
/** Array of suggested answers that the user can select */
suggest?: Array<SuggestionItem>
}
@ -24,6 +24,12 @@ export interface SuggestionItem {
mode?: string
}
/**
* Type definition for a follow-up question
* Can be a simple string or an object with text and options
*/
export type FollowUpQuestion = string | { text: string; options?: string[] }
/**
* Zod schema for SuggestionItem
*/
@ -32,12 +38,23 @@ export const suggestionItemSchema = z.object({
mode: z.string().optional(),
})
/**
* Zod schema for FollowUpQuestion
*/
export const followUpQuestionSchema = z.union([
z.string(),
z.object({
text: z.string(),
options: z.array(z.string()).optional(),
}),
])
/**
* Zod schema for FollowUpData
*/
export const followUpDataSchema = z.object({
question: z.string().optional(),
questions: z.array(z.string()).optional(),
questions: z.array(followUpQuestionSchema).optional(),
suggest: z.array(suggestionItemSchema).optional(),
})

View file

@ -7,6 +7,7 @@ import type {
ToolName,
BrowserActionParams,
GenerateImageParams,
FollowUpQuestion,
} from "@roo-code/types"
export type ToolResponse = string | Array<Anthropic.TextBlockParam | Anthropic.ImageBlockParam>
@ -110,7 +111,7 @@ export type NativeToolArgs = {
list_files: { path: string; recursive?: boolean }
new_task: { mode: string; message: string; todos?: string }
ask_followup_question: {
questions: Array<string | { text: string; options?: string[] }>
questions: FollowUpQuestion[]
follow_up: Array<{ text: string; mode?: string }>
}
browser_action: BrowserActionParams
@ -237,7 +238,7 @@ export interface AccessMcpResourceToolUse extends ToolUse<"access_mcp_resource">
export interface AskFollowupQuestionToolUse extends ToolUse<"ask_followup_question"> {
name: "ask_followup_question"
params: Partial<Pick<Record<ToolParamName, string>, "question" | "follow_up">>
params: Partial<Pick<Record<ToolParamName, string>, "question" | "follow_up" | "questions">>
}
export interface AttemptCompletionToolUse extends ToolUse<"attempt_completion"> {

View file

@ -2,19 +2,15 @@ import { useState, useEffect } from "react"
import { Button, AutosizeTextarea } from "@/components/ui"
import { useAppTranslation } from "@src/i18n/TranslationContext"
import { useExtensionState } from "@src/context/ExtensionStateContext"
interface Question {
text: string
options?: string[]
}
import { FollowUpQuestion } from "@roo-code/types"
interface MultiQuestionHandlerProps {
questions: Array<string | Question>
questions: FollowUpQuestion[]
onSendResponse: (response: string) => void
}
interface QuestionItemProps {
question: string | Question
question: FollowUpQuestion
title: string
textValue: string
selectedOption?: string

View file

@ -126,6 +126,10 @@
"requireCtrlEnterToSend": {
"label": "Require {{primaryMod}}+Enter to send messages",
"description": "When enabled, you must press {{primaryMod}}+Enter to send messages instead of just Enter"
},
"showQuestionsOneByOne": {
"label": "Show questions one by one",
"description": "When enabled, questions from the model will be displayed one at a time."
}
},
"prompts": {