@@ -39,6 +39,7 @@ import { useSkills } from "@/lib/use-skills";
3939import type { TurnMeta } from "@/lib/provenance" ;
4040import { hasDirectoryEntries , traverseDroppedEntries } from "@/lib/directory-upload" ;
4141import { useSandbox , fileCategory , type TreeNode } from "@/lib/use-sandbox" ;
42+ import { SpeechInput } from "@/components/ai-elements/speech-input" ;
4243import {
4344 CopyIcon ,
4445 CheckIcon ,
@@ -473,6 +474,12 @@ function ChatInput({
473474 }
474475 } , [ mentionQuery , filteredFiles , mentionSelIdx , applyMention , closeMention ] ) ;
475476
477+ const handleTranscription = useCallback ( ( text : string ) => {
478+ const current = controller . textInput . value ;
479+ const sep = current && ! current . endsWith ( " " ) && ! current . endsWith ( "\n" ) ? " " : "" ;
480+ controller . textInput . setInput ( current + sep + text ) ;
481+ } , [ controller ] ) ;
482+
476483 const isMentionOpen = mentionQuery !== null && filteredFiles . length > 0 ;
477484 const submitStatus = isStreaming ? "streaming" : agentStatus === "error" ? "error" : "ready" ;
478485
@@ -555,11 +562,17 @@ function ChatInput({
555562 < ComputeSelector selected = { selectedCompute } onChange = { onComputeChange } modalConfigured = { modalConfigured } />
556563 < SkillsSelector skills = { allSkills } selected = { selectedSkills } onChange = { onSkillsChange } />
557564 </ div >
558- < PromptInputSubmit
559- className = "shrink-0"
560- status = { submitStatus as "streaming" | "error" | "ready" }
561- onStop = { onStop }
562- />
565+ < div className = "flex items-center gap-1.5 shrink-0" >
566+ < SpeechInput
567+ size = "icon-sm"
568+ variant = "ghost"
569+ onTranscriptionChange = { handleTranscription }
570+ />
571+ < PromptInputSubmit
572+ status = { submitStatus as "streaming" | "error" | "ready" }
573+ onStop = { onStop }
574+ />
575+ </ div >
563576 </ PromptInputFooter >
564577 </ PromptInput >
565578 </ div >
0 commit comments