remove allowCustomAnswer

- also refine the prompt
This commit is contained in:
uinstinct 2026-02-26 12:16:10 +05:30
parent bd5a4cad9d
commit 35725099c1
4 changed files with 14 additions and 37 deletions

View file

@ -1,7 +1,6 @@
export interface QuizQuestion {
question: string;
options?: string[];
allowCustomAnswer?: boolean;
defaultAnswer?: string;
}

View file

@ -6,11 +6,13 @@ export const askQuestionTool: Tool = {
name: "AskQuestion",
displayName: "Ask Question",
description: `Ask the user a clarifying question to gather requirements, preferences, or implementation details before proceeding.
**You should use this tool whenever you want to clarify your assumption or need answers to build your plan.**
Guidelines:
- You should use this tool **whenever you want to clarify your assumption or need answers to build your plan**.
- DO NOT supply "other" or "none of the above" or similar as an option. User can always provide a free-form answer when needed.
`,
parameters: {
type: "object",
required: ["question"],
required: ["question", "options"],
properties: {
question: {
type: "string",
@ -19,16 +21,11 @@ export const askQuestionTool: Tool = {
options: {
type: "array",
description:
"Optional list of choices. If provided, user selects one. If omitted, user types a free-form answer.",
"The list of choices. Leave as empty array if user should provide a free-form answer.",
items: {
type: "string",
},
},
allowCustomAnswer: {
type: "boolean",
description:
"If true and options are provided, user can also type a custom answer instead of selecting from options",
},
defaultAnswer: {
type: "string",
description:
@ -41,15 +38,13 @@ export const askQuestionTool: Tool = {
run: async (args: {
question: string;
options?: string[];
allowCustomAnswer?: boolean;
defaultAnswer?: string;
}): Promise<string> => {
const { question, options, allowCustomAnswer, defaultAnswer } = args;
const { question, options, defaultAnswer } = args;
const answer = await quizService.askQuestion({
question,
options,
allowCustomAnswer,
defaultAnswer,
});

View file

@ -57,7 +57,6 @@ export const ChatScreenContent: React.FC<ChatScreenContentProps> = ({
<QuizPrompt
question={activeQuizQuestion.question.question}
options={activeQuizQuestion.question.options}
allowCustomAnswer={activeQuizQuestion.question.allowCustomAnswer}
defaultAnswer={activeQuizQuestion.question.defaultAnswer}
requestId={activeQuizQuestion.requestId}
onAnswer={handleQuizAnswer}

View file

@ -6,7 +6,6 @@ import { defaultBoxStyles } from "../styles.js";
interface QuizPromptProps {
question: string;
options?: string[];
allowCustomAnswer?: boolean;
defaultAnswer?: string;
requestId: string;
onAnswer: (
@ -20,7 +19,6 @@ interface QuizPromptProps {
export const QuizPrompt: React.FC<QuizPromptProps> = ({
question,
options: rawOptions,
allowCustomAnswer = false,
defaultAnswer,
requestId,
onAnswer,
@ -54,12 +52,7 @@ export const QuizPrompt: React.FC<QuizPromptProps> = ({
return;
}
if (
hasOptions &&
allowCustomAnswer &&
key.upArrow &&
customInput === ""
) {
if (hasOptions && key.upArrow && customInput === "") {
// exit out of typing a custom answer
setIsCustomMode(false);
setSelectedIndex(options.length - 1);
@ -89,7 +82,7 @@ export const QuizPrompt: React.FC<QuizPromptProps> = ({
);
} else if (key.downArrow) {
if (hasOptions) {
if (selectedIndex === options.length - 1 && allowCustomAnswer) {
if (selectedIndex === options.length - 1) {
setIsCustomMode(true);
setSelectedIndex(0);
} else {
@ -100,14 +93,7 @@ export const QuizPrompt: React.FC<QuizPromptProps> = ({
}
}
if (
allowCustomAnswer &&
input &&
!key.ctrl &&
!key.meta &&
!key.upArrow &&
!key.downArrow
) {
if (input && !key.ctrl && !key.meta && !key.upArrow && !key.downArrow) {
setIsCustomMode(true);
setCustomInput(input);
}
@ -139,13 +125,11 @@ export const QuizPrompt: React.FC<QuizPromptProps> = ({
</Box>
);
})}
{allowCustomAnswer && (
<Box>
<Text color="gray" dimColor>
{" "}(or start typing for custom answer)
</Text>
</Box>
)}
<Box>
<Text color="gray" dimColor>
{" "}(or start typing for custom answer)
</Text>
</Box>
</Box>
)}