@marimo-team/islands 0.25.3-dev402 → 0.25.3-dev408
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConnectedDataExplorerComponent-1DGGwl88.js → ConnectedDataExplorerComponent-DCW4bXq-.js} +1 -1
- package/dist/{ErrorBoundary-DfbzIKA3.js → ErrorBoundary-W6a-7ong.js} +1 -1
- package/dist/{chat-ui-r3PPIMn0.js → chat-ui-BGEXB6V4.js} +1354 -1320
- package/dist/{code-visibility-CXijswY7.js → code-visibility-0v5rL9iu.js} +1 -1
- package/dist/{common-Cm5ENbUw.js → common-B7sS0asw.js} +1 -1
- package/dist/{data-grid-overlay-editor-Dv0TkGKt.js → data-grid-overlay-editor-DtWpYC-j.js} +1 -1
- package/dist/{feedback-button-Xk-mOev4.js → feedback-button-KVSGwnVr.js} +2 -2
- package/dist/{glide-data-editor-DdxBDWAj.js → glide-data-editor-D0dykzDr.js} +3 -3
- package/dist/{globals-DR3VVkF6.js → globals-DOi11Nup.js} +1 -1
- package/dist/main.js +6160 -6141
- package/dist/{number-overlay-editor-Cc5gJryh.js → number-overlay-editor-DoR-BTMn.js} +1 -1
- package/dist/{process-output-39KkAXSF.js → process-output-BvCDoG-m.js} +14 -25
- package/dist/{reveal-component-Dm5K9KPi.js → reveal-component-Vu8VncD4.js} +2 -2
- package/dist/{spec-Ww0JjShW.js → spec-DV8oNpRR.js} +46 -49
- package/dist/{semaphore-8KhQouXt.js → useDeepCompareMemoize-C90a6_io.js} +15 -5
- package/dist/{vega-component-DQZhTzVQ.js → vega-component-ArEoBGzQ.js} +197 -198
- package/package.json +1 -1
- package/src/components/chat/__tests__/chat-utils.test.ts +48 -0
- package/src/components/chat/__tests__/message-queue.test.tsx +94 -1
- package/src/components/chat/__tests__/pending-chat-prompt.test.tsx +568 -0
- package/src/components/chat/__tests__/useFileState.test.tsx +176 -15
- package/src/components/chat/chat-components.tsx +3 -2
- package/src/components/chat/chat-panel.tsx +199 -74
- package/src/components/chat/chat-utils.ts +148 -34
- package/src/components/chat/user-message.tsx +15 -6
- package/src/components/data-table/charts/__tests__/altair-generator.test.ts +42 -27
- package/src/components/data-table/charts/chart-spec/altair-generator.ts +2 -6
- package/src/core/ai/__tests__/attachments.test.ts +153 -0
- package/src/core/ai/attachments.ts +80 -0
- package/src/utils/python-poet/poet.ts +12 -2
- package/dist/useDeepCompareMemoize-Bvrue1iy.js +0 -11
|
@@ -16,14 +16,15 @@ import {
|
|
|
16
16
|
Loader2,
|
|
17
17
|
PlusIcon,
|
|
18
18
|
SettingsIcon,
|
|
19
|
+
XIcon,
|
|
19
20
|
} from "lucide-react";
|
|
20
21
|
import { memo, useEffect, useRef, useState } from "react";
|
|
21
22
|
import useEvent from "react-use-event-hook";
|
|
22
23
|
import { Button } from "@/components/ui/button";
|
|
23
24
|
import { replaceMessagesInChat } from "@/core/ai/chat-utils";
|
|
25
|
+
import { getSupportedAttachmentTypes } from "@/core/ai/attachments";
|
|
24
26
|
import { useAIConfigActions } from "@/core/ai/config";
|
|
25
27
|
import { AI_SDK_UI_THROTTLE_MS } from "@/core/ai/constants";
|
|
26
|
-
import { AiModelId } from "@/core/ai/ids/ids";
|
|
27
28
|
import { useStagedAICellsActions } from "@/core/ai/staged-cells";
|
|
28
29
|
import {
|
|
29
30
|
activeChatAtom,
|
|
@@ -59,6 +60,7 @@ import { CopyClipboardIcon } from "../icons/copy-icon";
|
|
|
59
60
|
import "./chat-typography.css";
|
|
60
61
|
import { MCPStatusIndicator } from "../mcp/mcp-status-indicator";
|
|
61
62
|
import { Tooltip, TooltipProvider } from "../ui/tooltip";
|
|
63
|
+
import { toast } from "../ui/use-toast";
|
|
62
64
|
import {
|
|
63
65
|
AddContextButton,
|
|
64
66
|
AttachFileButton,
|
|
@@ -82,13 +84,14 @@ import {
|
|
|
82
84
|
convertToFileUIPart,
|
|
83
85
|
generateChatTitle,
|
|
84
86
|
handleToolCall,
|
|
87
|
+
hasAssistantProgress,
|
|
85
88
|
hasPendingToolCalls,
|
|
86
89
|
hasUnresolvedToolCalls,
|
|
87
|
-
PROVIDERS_THAT_SUPPORT_ATTACHMENTS,
|
|
88
90
|
type QueuedUserMessage,
|
|
89
91
|
shouldFlushQueue,
|
|
90
92
|
useFileState,
|
|
91
93
|
useMessageQueue,
|
|
94
|
+
validateChatAttachments,
|
|
92
95
|
} from "./chat-utils";
|
|
93
96
|
import { notebookCellCodes } from "@/core/codemirror/copilot/getCodes";
|
|
94
97
|
import { getSessionId } from "@/core/kernel/session";
|
|
@@ -103,8 +106,33 @@ import { UserMessage } from "./user-message";
|
|
|
103
106
|
// Default mode for the AI
|
|
104
107
|
const DEFAULT_MODE = "ask";
|
|
105
108
|
|
|
109
|
+
async function readChatAttachments(
|
|
110
|
+
files: File[],
|
|
111
|
+
): Promise<FileUIPart[] | null> {
|
|
112
|
+
try {
|
|
113
|
+
return await convertToFileUIPart(files);
|
|
114
|
+
} catch {
|
|
115
|
+
toast({
|
|
116
|
+
title: "Could not read attachments",
|
|
117
|
+
description: "Try selecting the files again.",
|
|
118
|
+
variant: "danger",
|
|
119
|
+
});
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
106
124
|
const QueuedMessageDisplay = memo(
|
|
107
|
-
({
|
|
125
|
+
({
|
|
126
|
+
message,
|
|
127
|
+
isLoading,
|
|
128
|
+
onSend,
|
|
129
|
+
onRemove,
|
|
130
|
+
}: {
|
|
131
|
+
message: QueuedUserMessage;
|
|
132
|
+
isLoading: boolean;
|
|
133
|
+
onSend?: () => void;
|
|
134
|
+
onRemove: () => void;
|
|
135
|
+
}) => {
|
|
108
136
|
const textParts = message.parts.filter(
|
|
109
137
|
(p): p is TextUIPart => p.type === "text",
|
|
110
138
|
);
|
|
@@ -121,7 +149,22 @@ const QueuedMessageDisplay = memo(
|
|
|
121
149
|
))}
|
|
122
150
|
<div className="flex items-center justify-end gap-2 text-sm text-muted-foreground">
|
|
123
151
|
<span className="wrap-break-word">{content}</span>
|
|
124
|
-
|
|
152
|
+
{isLoading && (
|
|
153
|
+
<Loader2 className="h-3.5 w-3.5 shrink-0 animate-spin" />
|
|
154
|
+
)}
|
|
155
|
+
{onSend && (
|
|
156
|
+
<Button variant="ghost" size="sm" onClick={onSend}>
|
|
157
|
+
Send
|
|
158
|
+
</Button>
|
|
159
|
+
)}
|
|
160
|
+
<Button
|
|
161
|
+
variant="ghost"
|
|
162
|
+
size="icon"
|
|
163
|
+
aria-label="Remove queued message"
|
|
164
|
+
onClick={onRemove}
|
|
165
|
+
>
|
|
166
|
+
<XIcon className="h-3.5 w-3.5" />
|
|
167
|
+
</Button>
|
|
125
168
|
</div>
|
|
126
169
|
</div>
|
|
127
170
|
</div>
|
|
@@ -189,7 +232,7 @@ const ChatHeader: React.FC<ChatHeaderProps> = ({
|
|
|
189
232
|
interface ChatMessageProps {
|
|
190
233
|
message: UIMessage;
|
|
191
234
|
index: number;
|
|
192
|
-
onEdit: (index: number, newValue: string) =>
|
|
235
|
+
onEdit: (index: number, newValue: string) => Promise<boolean>;
|
|
193
236
|
isLast: boolean;
|
|
194
237
|
isActive: boolean;
|
|
195
238
|
turnStartedAt: number | null;
|
|
@@ -263,14 +306,9 @@ const ChatInputFooter: React.FC<ChatInputFooterProps> = memo(
|
|
|
263
306
|
}) => {
|
|
264
307
|
const ai = useAtomValue(aiAtom);
|
|
265
308
|
const currentMode = ai?.mode || DEFAULT_MODE;
|
|
266
|
-
const currentModel = ai?.models?.chat_model || DEFAULT_AI_MODEL;
|
|
267
|
-
const currentProvider = AiModelId.parse(currentModel).providerId;
|
|
268
309
|
|
|
269
310
|
const { saveModeChange } = useAIConfigActions();
|
|
270
311
|
|
|
271
|
-
const isAttachmentSupported =
|
|
272
|
-
PROVIDERS_THAT_SUPPORT_ATTACHMENTS.has(currentProvider);
|
|
273
|
-
|
|
274
312
|
return (
|
|
275
313
|
<TooltipProvider>
|
|
276
314
|
<div className="chat-input-footer px-3 py-2 border-t border-border/20 flex items-center gap-2">
|
|
@@ -293,13 +331,12 @@ const ChatInputFooter: React.FC<ChatInputFooterProps> = memo(
|
|
|
293
331
|
handleAddContext={onAddContext}
|
|
294
332
|
isLoading={isLoading}
|
|
295
333
|
/>
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
)}
|
|
334
|
+
<AttachFileButton
|
|
335
|
+
fileInputRef={fileInputRef}
|
|
336
|
+
isLoading={isLoading}
|
|
337
|
+
onAddFiles={onAddFiles}
|
|
338
|
+
accept=""
|
|
339
|
+
/>
|
|
303
340
|
<SendButton
|
|
304
341
|
isLoading={isLoading}
|
|
305
342
|
onStop={onStop}
|
|
@@ -316,6 +353,7 @@ const ChatInputFooter: React.FC<ChatInputFooterProps> = memo(
|
|
|
316
353
|
ChatInputFooter.displayName = "ChatInputFooter";
|
|
317
354
|
|
|
318
355
|
interface ChatInputProps {
|
|
356
|
+
isReadingFiles: boolean;
|
|
319
357
|
input: string;
|
|
320
358
|
setInput: (value: string) => void;
|
|
321
359
|
onSubmit: (e: KeyboardEvent | undefined, value: string) => void;
|
|
@@ -329,6 +367,7 @@ interface ChatInputProps {
|
|
|
329
367
|
|
|
330
368
|
const ChatInput: React.FC<ChatInputProps> = memo(
|
|
331
369
|
({
|
|
370
|
+
isReadingFiles,
|
|
332
371
|
input,
|
|
333
372
|
setInput,
|
|
334
373
|
onSubmit,
|
|
@@ -360,7 +399,7 @@ const ChatInput: React.FC<ChatInputProps> = memo(
|
|
|
360
399
|
/>
|
|
361
400
|
</div>
|
|
362
401
|
<ChatInputFooter
|
|
363
|
-
isEmpty={!input.trim()}
|
|
402
|
+
isEmpty={!input.trim() || isReadingFiles}
|
|
364
403
|
onAddContext={() => addContextCompletion(inputRef)}
|
|
365
404
|
onSendClick={handleSendClick}
|
|
366
405
|
isLoading={isLoading}
|
|
@@ -412,12 +451,24 @@ const ChatPanelBody = () => {
|
|
|
412
451
|
const [input, setInput] = useState("");
|
|
413
452
|
const [newThreadInput, setNewThreadInput] = useState("");
|
|
414
453
|
const [isScrolledToBottom, setIsScrolledToBottom] = useState(true);
|
|
415
|
-
const
|
|
454
|
+
const ai = useAtomValue(aiAtom);
|
|
455
|
+
const supportedTypes = getSupportedAttachmentTypes(
|
|
456
|
+
ai?.models?.chat_model || DEFAULT_AI_MODEL,
|
|
457
|
+
);
|
|
458
|
+
const {
|
|
459
|
+
files,
|
|
460
|
+
addFiles,
|
|
461
|
+
clearFiles,
|
|
462
|
+
removeFile,
|
|
463
|
+
validateFiles,
|
|
464
|
+
isReadingFiles,
|
|
465
|
+
} = useFileState(supportedTypes);
|
|
416
466
|
const {
|
|
417
467
|
messages: queuedMessages,
|
|
418
468
|
enqueue: enqueueUserMessage,
|
|
419
469
|
flushNext: flushNextQueuedMessage,
|
|
420
470
|
clear: clearQueuedMessages,
|
|
471
|
+
remove: removeQueuedMessage,
|
|
421
472
|
hasQueuedRef,
|
|
422
473
|
} = useMessageQueue();
|
|
423
474
|
const newThreadInputRef = useRef<ReactCodeMirrorRef>(null);
|
|
@@ -582,12 +633,31 @@ const ChatPanelBody = () => {
|
|
|
582
633
|
}),
|
|
583
634
|
);
|
|
584
635
|
|
|
585
|
-
const
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
636
|
+
const validateMessageAttachments = useEvent((parts: ChatMessagePart[]) => {
|
|
637
|
+
const currentModel =
|
|
638
|
+
store.get(aiAtom)?.models?.chat_model || DEFAULT_AI_MODEL;
|
|
639
|
+
return validateChatAttachments(
|
|
640
|
+
parts,
|
|
641
|
+
getSupportedAttachmentTypes(currentModel),
|
|
642
|
+
);
|
|
589
643
|
});
|
|
590
644
|
|
|
645
|
+
const sendUserMessage = useEvent(
|
|
646
|
+
(
|
|
647
|
+
parts: ChatMessagePart[],
|
|
648
|
+
messageId?: string,
|
|
649
|
+
history: UIMessage[] = messages,
|
|
650
|
+
) => {
|
|
651
|
+
clearAbortState();
|
|
652
|
+
turn.start();
|
|
653
|
+
sendMessage({
|
|
654
|
+
role: "user",
|
|
655
|
+
parts: contextualize(parts, history),
|
|
656
|
+
...(messageId ? { messageId } : {}),
|
|
657
|
+
});
|
|
658
|
+
},
|
|
659
|
+
);
|
|
660
|
+
|
|
591
661
|
const tryFlushQueuedMessages = useEvent(
|
|
592
662
|
(
|
|
593
663
|
chatMessages: typeof messages,
|
|
@@ -604,7 +674,7 @@ const ChatPanelBody = () => {
|
|
|
604
674
|
hasUnresolvedToolCalls: hasUnresolvedToolCalls(chatMessages),
|
|
605
675
|
})
|
|
606
676
|
) {
|
|
607
|
-
flushNextQueuedMessage(sendUserMessage);
|
|
677
|
+
flushNextQueuedMessage(sendUserMessage, validateMessageAttachments);
|
|
608
678
|
}
|
|
609
679
|
},
|
|
610
680
|
);
|
|
@@ -645,11 +715,15 @@ const ChatPanelBody = () => {
|
|
|
645
715
|
// useEvent reads the latest loading state, even when called after an await
|
|
646
716
|
// (e.g. resolving @-context) that outlives the original render's closure.
|
|
647
717
|
const submitOrQueue = useEvent((parts: ChatMessagePart[]) => {
|
|
718
|
+
if (!validateMessageAttachments(parts)) {
|
|
719
|
+
return false;
|
|
720
|
+
}
|
|
648
721
|
if (isTurnActive || hasQueuedRef.current) {
|
|
649
722
|
enqueueUserMessage(parts);
|
|
650
723
|
} else {
|
|
651
724
|
sendUserMessage(parts);
|
|
652
725
|
}
|
|
726
|
+
return true;
|
|
653
727
|
});
|
|
654
728
|
|
|
655
729
|
const handleScroll = useEvent(() => {
|
|
@@ -735,28 +809,27 @@ const ChatPanelBody = () => {
|
|
|
735
809
|
|
|
736
810
|
const createNewThread = useEvent(
|
|
737
811
|
async (initialMessage: string, initialAttachments?: File[]) => {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
812
|
+
if (!validateFiles(initialAttachments ?? [])) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
const fileParts = await readChatAttachments(initialAttachments ?? []);
|
|
816
|
+
if (fileParts === null) {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
744
819
|
const { contextPart, attachments } =
|
|
745
820
|
await resolveChatContext(initialMessage);
|
|
746
821
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
),
|
|
759
|
-
});
|
|
822
|
+
const parts: ChatMessagePart[] = [
|
|
823
|
+
{ type: "text" as const, text: initialMessage },
|
|
824
|
+
...(contextPart ? [contextPart] : []),
|
|
825
|
+
...fileParts,
|
|
826
|
+
...attachments,
|
|
827
|
+
];
|
|
828
|
+
if (!validateMessageAttachments(parts)) {
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
startNewChatState(initialMessage);
|
|
832
|
+
sendUserMessage(parts, undefined, []);
|
|
760
833
|
clearFiles();
|
|
761
834
|
setInput("");
|
|
762
835
|
},
|
|
@@ -804,51 +877,63 @@ const ChatPanelBody = () => {
|
|
|
804
877
|
) ?? [];
|
|
805
878
|
const { contextPart, attachments } = await resolveChatContext(newValue);
|
|
806
879
|
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
],
|
|
819
|
-
messages.slice(0, index),
|
|
820
|
-
),
|
|
821
|
-
});
|
|
880
|
+
const parts: ChatMessagePart[] = [
|
|
881
|
+
{ type: "text", text: newValue },
|
|
882
|
+
...(contextPart ? [contextPart] : []),
|
|
883
|
+
...userFileParts,
|
|
884
|
+
...attachments,
|
|
885
|
+
];
|
|
886
|
+
if (!validateMessageAttachments(parts)) {
|
|
887
|
+
return false;
|
|
888
|
+
}
|
|
889
|
+
sendUserMessage(parts, editedMessage.id, messages.slice(0, index));
|
|
890
|
+
return true;
|
|
822
891
|
},
|
|
823
892
|
);
|
|
824
893
|
|
|
825
894
|
const handleChatInputSubmit = useEvent(
|
|
826
895
|
async (e: KeyboardEvent | undefined, newValue: string): Promise<void> => {
|
|
827
|
-
if (!newValue.trim()) {
|
|
896
|
+
if (!newValue.trim() || !validateFiles(files)) {
|
|
828
897
|
return;
|
|
829
898
|
}
|
|
830
899
|
if (newMessageInputRef.current?.view) {
|
|
831
900
|
storePrompt(newMessageInputRef.current.view);
|
|
832
901
|
}
|
|
833
|
-
const fileParts =
|
|
902
|
+
const fileParts = await readChatAttachments(files);
|
|
903
|
+
if (fileParts === null) {
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
834
906
|
const { contextPart, attachments } = await resolveChatContext(newValue);
|
|
835
907
|
|
|
836
908
|
e?.preventDefault();
|
|
837
|
-
submitOrQueue([
|
|
909
|
+
const submitted = submitOrQueue([
|
|
838
910
|
{ type: "text", text: newValue },
|
|
839
911
|
...(contextPart ? [contextPart] : []),
|
|
840
|
-
...
|
|
912
|
+
...fileParts,
|
|
841
913
|
...attachments,
|
|
842
914
|
]);
|
|
915
|
+
if (!submitted) {
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
843
918
|
setInput("");
|
|
844
919
|
clearFiles();
|
|
845
920
|
},
|
|
846
921
|
);
|
|
847
922
|
|
|
848
|
-
const
|
|
923
|
+
const canContinue = hasAssistantProgress(messages);
|
|
924
|
+
const handleRecovery = () => {
|
|
925
|
+
if (canContinue) {
|
|
926
|
+
sendUserMessage([
|
|
927
|
+
{
|
|
928
|
+
type: "text",
|
|
929
|
+
text: "Your previous response was interrupted. Continue from the last recorded step.",
|
|
930
|
+
},
|
|
931
|
+
]);
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
849
934
|
clearAbortState();
|
|
850
935
|
turn.start();
|
|
851
|
-
regenerate();
|
|
936
|
+
void regenerate();
|
|
852
937
|
};
|
|
853
938
|
|
|
854
939
|
const handleNewThreadSubmit = useEvent(() => {
|
|
@@ -863,19 +948,27 @@ const ChatPanelBody = () => {
|
|
|
863
948
|
|
|
864
949
|
const handleOnCloseThread = () => newThreadInputRef.current?.editor?.blur();
|
|
865
950
|
|
|
866
|
-
const
|
|
867
|
-
if (activeChatId == null) {
|
|
951
|
+
const startPendingChat = useEvent((prompt: string) => {
|
|
952
|
+
if (store.get(chatStateAtom).activeChatId == null) {
|
|
868
953
|
startNewChatState(prompt);
|
|
869
|
-
//
|
|
870
|
-
// carry over any draft the user had typed so it isn't lost.
|
|
954
|
+
// Context resolution can outlive the render that started it.
|
|
871
955
|
setInput(newThreadInput);
|
|
872
956
|
}
|
|
957
|
+
});
|
|
958
|
+
|
|
959
|
+
const submitPendingPrompt = useEvent(async (prompt: string) => {
|
|
873
960
|
const { contextPart, attachments } = await resolveChatContext(prompt);
|
|
874
|
-
|
|
961
|
+
const parts: ChatMessagePart[] = [
|
|
875
962
|
{ type: "text", text: prompt },
|
|
876
963
|
...(contextPart ? [contextPart] : []),
|
|
877
964
|
...attachments,
|
|
878
|
-
]
|
|
965
|
+
];
|
|
966
|
+
if (!validateMessageAttachments(parts)) {
|
|
967
|
+
setPendingPrompt({ prompt, submit: false, append: true });
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
startPendingChat(prompt);
|
|
971
|
+
submitOrQueue(parts);
|
|
879
972
|
});
|
|
880
973
|
|
|
881
974
|
const isNewThread = messages.length === 0;
|
|
@@ -908,6 +1001,7 @@ const ChatPanelBody = () => {
|
|
|
908
1001
|
const chatInput = isNewThread ? (
|
|
909
1002
|
<ChatInput
|
|
910
1003
|
key="new-thread-input"
|
|
1004
|
+
isReadingFiles={isReadingFiles}
|
|
911
1005
|
input={newThreadInput}
|
|
912
1006
|
inputRef={newThreadInputRef}
|
|
913
1007
|
setInput={setNewThreadInput}
|
|
@@ -920,6 +1014,7 @@ const ChatPanelBody = () => {
|
|
|
920
1014
|
/>
|
|
921
1015
|
) : (
|
|
922
1016
|
<ChatInput
|
|
1017
|
+
isReadingFiles={isReadingFiles}
|
|
923
1018
|
input={input}
|
|
924
1019
|
setInput={setInput}
|
|
925
1020
|
onSubmit={handleChatInputSubmit}
|
|
@@ -947,6 +1042,11 @@ const ChatPanelBody = () => {
|
|
|
947
1042
|
const composer = (
|
|
948
1043
|
<div className="@container rounded-[10px] border border-border bg-background">
|
|
949
1044
|
{filesPills}
|
|
1045
|
+
{isReadingFiles && (
|
|
1046
|
+
<output className="px-3 pt-2 text-xs text-muted-foreground">
|
|
1047
|
+
Reading attachments…
|
|
1048
|
+
</output>
|
|
1049
|
+
)}
|
|
950
1050
|
{chatInput}
|
|
951
1051
|
</div>
|
|
952
1052
|
);
|
|
@@ -1007,15 +1107,40 @@ const ChatPanelBody = () => {
|
|
|
1007
1107
|
/>
|
|
1008
1108
|
)}
|
|
1009
1109
|
|
|
1010
|
-
{queuedMessages.map((message) => (
|
|
1011
|
-
<QueuedMessageDisplay
|
|
1110
|
+
{queuedMessages.map((message, idx) => (
|
|
1111
|
+
<QueuedMessageDisplay
|
|
1112
|
+
key={message.id}
|
|
1113
|
+
message={message}
|
|
1114
|
+
isLoading={isTurnActive}
|
|
1115
|
+
onRemove={() => {
|
|
1116
|
+
removeQueuedMessage(message.id);
|
|
1117
|
+
if (idx === 0 && !isTurnActive) {
|
|
1118
|
+
tryFlushQueuedMessages(messages, {
|
|
1119
|
+
isError: error != null,
|
|
1120
|
+
isAbort: false,
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
}}
|
|
1124
|
+
onSend={
|
|
1125
|
+
idx === 0 &&
|
|
1126
|
+
!isTurnActive &&
|
|
1127
|
+
!hasPendingToolCalls(messages) &&
|
|
1128
|
+
!hasUnresolvedToolCalls(messages)
|
|
1129
|
+
? () =>
|
|
1130
|
+
tryFlushQueuedMessages(messages, {
|
|
1131
|
+
isError: false,
|
|
1132
|
+
isAbort: false,
|
|
1133
|
+
})
|
|
1134
|
+
: undefined
|
|
1135
|
+
}
|
|
1136
|
+
/>
|
|
1012
1137
|
))}
|
|
1013
1138
|
|
|
1014
1139
|
{error && (
|
|
1015
1140
|
<div className="flex items-center justify-center space-x-2 mb-4">
|
|
1016
1141
|
<ErrorBanner error={error || new Error("Unknown error")} />
|
|
1017
|
-
<Button variant="outline" size="sm" onClick={
|
|
1018
|
-
Retry
|
|
1142
|
+
<Button variant="outline" size="sm" onClick={handleRecovery}>
|
|
1143
|
+
{canContinue ? "Continue" : "Retry"}
|
|
1019
1144
|
</Button>
|
|
1020
1145
|
</div>
|
|
1021
1146
|
)}
|