feat(question): support multi-select questions (#7386)

This commit is contained in:
Dax
2026-01-08 17:32:21 -05:00
committed by GitHub
parent b4f8de0c0a
commit 22dd70b75b
10 changed files with 1411 additions and 325 deletions

View File

@@ -15,7 +15,12 @@ export const QuestionTool = Tool.define("question", {
tool: ctx.callID ? { messageID: ctx.messageID, callID: ctx.callID } : undefined,
})
const formatted = params.questions.map((q, i) => `"${q.question}"="${answers[i] ?? "Unanswered"}"`).join(", ")
function format(answer: Question.Answer | undefined) {
if (!answer?.length) return "Unanswered"
return answer.join(", ")
}
const formatted = params.questions.map((q, i) => `"${q.question}"="${format(answers[i])}"`).join(", ")
return {
title: `Asked ${params.questions.length} question${params.questions.length > 1 ? "s" : ""}`,

View File

@@ -6,4 +6,5 @@ Use this tool when you need to ask the user questions during execution. This all
Usage notes:
- Users will always be able to select "Other" to provide custom text input
- Answers are returned as arrays of labels; set `multiple: true` to allow selecting more than one
- If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label