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

View File

@@ -38,7 +38,7 @@ defineProps<{
chatThreadPickerOpen: boolean;
selectedChatId: string;
chatArchivingId: string;
pilotInputRef: { value: string };
pilotInput: string;
pilotRecording: boolean;
contextScopeChips: ContextScopeChip[];
contextPickerEnabled: boolean;
@@ -66,6 +66,7 @@ defineProps<{
formatChatThreadMeta: (conversation: ChatConversation) => string;
archiveChatConversation: (id: string) => void;
handlePilotComposerEnter: (event: KeyboardEvent) => void;
onPilotInput: (value: string) => void;
setPilotWaveContainerRef: (element: HTMLDivElement | null) => void;
toggleContextPicker: () => void;
removeContextScope: (scope: string) => void;
@@ -253,9 +254,10 @@ defineProps<{
<div class="pilot-input-wrap">
<div class="pilot-input-shell">
<textarea
v-model="pilotInputRef.value"
:value="pilotInput"
class="pilot-input-textarea"
: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"
/>
@@ -308,7 +310,7 @@ defineProps<{
<button
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'"
@click="handlePilotSendAction"
>