From 9dbc2c3199047609a9f8496fec07ecdb10aee73d Mon Sep 17 00:00:00 2001 From: soryu Date: Sun, 18 Jan 2026 18:55:04 +0000 Subject: Add pushed heartbeats and multi-question select --- makima/frontend/src/components/mesh/TaskOutput.tsx | 76 ++++++++++++++++++---- 1 file changed, 65 insertions(+), 11 deletions(-) (limited to 'makima/frontend/src/components/mesh') diff --git a/makima/frontend/src/components/mesh/TaskOutput.tsx b/makima/frontend/src/components/mesh/TaskOutput.tsx index 7140c8a..c98b174 100644 --- a/makima/frontend/src/components/mesh/TaskOutput.tsx +++ b/makima/frontend/src/components/mesh/TaskOutput.tsx @@ -343,18 +343,48 @@ function SupervisorQuestionEntry({ const questionId = entry.toolInput?.question_id as string; const choices = (entry.toolInput?.choices as string[]) || []; const context = entry.toolInput?.context as string | null; + const multiSelect = (entry.toolInput?.multi_select as boolean) ?? false; const [customInput, setCustomInput] = useState(""); const [showOther, setShowOther] = useState(false); const [submitting, setSubmitting] = useState(false); + const [selectedChoices, setSelectedChoices] = useState>(new Set()); const isPending = pendingQuestionIds?.has(questionId) ?? false; const handleChoiceSelect = async (choice: string) => { if (!onAnswerQuestion || submitting) return; + + if (multiSelect) { + // Toggle selection for multi-select mode + setSelectedChoices(prev => { + const newSet = new Set(prev); + if (newSet.has(choice)) { + newSet.delete(choice); + } else { + newSet.add(choice); + } + return newSet; + }); + } else { + // Single select - submit immediately + setSubmitting(true); + try { + await onAnswerQuestion(questionId, choice); + } finally { + setSubmitting(false); + } + } + }; + + const handleMultiSelectSubmit = async () => { + if (!onAnswerQuestion || submitting || selectedChoices.size === 0) return; setSubmitting(true); try { - await onAnswerQuestion(questionId, choice); + // Join selected choices with comma + const response = Array.from(selectedChoices).join(", "); + await onAnswerQuestion(questionId, response); + setSelectedChoices(new Set()); } finally { setSubmitting(false); } @@ -376,6 +406,9 @@ function SupervisorQuestionEntry({
? Question + {multiSelect && isPending && ( + (select multiple) + )} {!isPending && ( (Answered) )} @@ -391,19 +424,40 @@ function SupervisorQuestionEntry({
{choices.length > 0 && (
- {choices.map((choice, idx) => ( - - ))} + {choices.map((choice, idx) => { + const isSelected = selectedChoices.has(choice); + return ( + + ); + })}
)} + {/* Submit button for multi-select mode */} + {multiSelect && selectedChoices.size > 0 && ( + + )} + {/* Other option */} {!showOther ? (