fix: avoid pilot sidebar trim crash on input prop

This commit is contained in:
Ruslan Bakiev
2026-02-23 12:03:51 +07:00
parent 43960d0374
commit c94c229a1a
2 changed files with 7 additions and 4 deletions

View File

@@ -4783,7 +4783,7 @@ async function decideFeedCard(card: FeedCard, decision: "accepted" | "rejected")
:chat-thread-picker-open="chatThreadPickerOpen" :chat-thread-picker-open="chatThreadPickerOpen"
:selected-chat-id="selectedChatId" :selected-chat-id="selectedChatId"
:chat-archiving-id="chatArchivingId" :chat-archiving-id="chatArchivingId"
:pilot-input-ref="pilotInput" :pilot-input="pilotInput"
:pilot-recording="pilotRecording" :pilot-recording="pilotRecording"
:context-scope-chips="contextScopeChips" :context-scope-chips="contextScopeChips"
:context-picker-enabled="contextPickerEnabled" :context-picker-enabled="contextPickerEnabled"
@@ -4805,6 +4805,7 @@ async function decideFeedCard(card: FeedCard, decision: "accepted" | "rejected")
:format-chat-thread-meta="formatChatThreadMeta" :format-chat-thread-meta="formatChatThreadMeta"
:archive-chat-conversation="archiveChatConversation" :archive-chat-conversation="archiveChatConversation"
:handle-pilot-composer-enter="handlePilotComposerEnter" :handle-pilot-composer-enter="handlePilotComposerEnter"
:on-pilot-input="(value) => { pilotInput = value; }"
:set-pilot-wave-container-ref="setPilotWaveContainerRef" :set-pilot-wave-container-ref="setPilotWaveContainerRef"
:toggle-context-picker="toggleContextPicker" :toggle-context-picker="toggleContextPicker"
:remove-context-scope="removeContextScope" :remove-context-scope="removeContextScope"

View File

@@ -38,7 +38,7 @@ defineProps<{
chatThreadPickerOpen: boolean; chatThreadPickerOpen: boolean;
selectedChatId: string; selectedChatId: string;
chatArchivingId: string; chatArchivingId: string;
pilotInputRef: { value: string }; pilotInput: string;
pilotRecording: boolean; pilotRecording: boolean;
contextScopeChips: ContextScopeChip[]; contextScopeChips: ContextScopeChip[];
contextPickerEnabled: boolean; contextPickerEnabled: boolean;
@@ -66,6 +66,7 @@ defineProps<{
formatChatThreadMeta: (conversation: ChatConversation) => string; formatChatThreadMeta: (conversation: ChatConversation) => string;
archiveChatConversation: (id: string) => void; archiveChatConversation: (id: string) => void;
handlePilotComposerEnter: (event: KeyboardEvent) => void; handlePilotComposerEnter: (event: KeyboardEvent) => void;
onPilotInput: (value: string) => void;
setPilotWaveContainerRef: (element: HTMLDivElement | null) => void; setPilotWaveContainerRef: (element: HTMLDivElement | null) => void;
toggleContextPicker: () => void; toggleContextPicker: () => void;
removeContextScope: (scope: string) => void; removeContextScope: (scope: string) => void;
@@ -253,9 +254,10 @@ defineProps<{
<div class="pilot-input-wrap"> <div class="pilot-input-wrap">
<div class="pilot-input-shell"> <div class="pilot-input-shell">
<textarea <textarea
v-model="pilotInputRef.value" :value="pilotInput"
class="pilot-input-textarea" class="pilot-input-textarea"
:placeholder="pilotRecording ? 'Recording... speak, then press mic to fill or send to submit' : 'Type a message for Pilot...'" :placeholder="pilotRecording ? 'Recording... speak, then press mic to fill or send to submit' : 'Type a message for Pilot...'"
@input="onPilotInput(($event.target as HTMLTextAreaElement | null)?.value ?? '')"
@keydown.enter="handlePilotComposerEnter" @keydown.enter="handlePilotComposerEnter"
/> />
@@ -308,7 +310,7 @@ defineProps<{
<button <button
class="btn btn-sm btn-circle border-0 bg-[#5865f2] text-white hover:bg-[#4752c4]" class="btn btn-sm btn-circle border-0 bg-[#5865f2] text-white hover:bg-[#4752c4]"
:disabled="pilotTranscribing || pilotSending || (!pilotRecording && !pilotInputRef.value.trim())" :disabled="pilotTranscribing || pilotSending || (!pilotRecording && !String(pilotInput ?? '').trim())"
:title="pilotRecording ? 'Transcribe and send' : 'Send message'" :title="pilotRecording ? 'Transcribe and send' : 'Send message'"
@click="handlePilotSendAction" @click="handlePilotSendAction"
> >