@widgetic/chat 0.1.26 → 0.1.28
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.
|
@@ -143,6 +143,8 @@
|
|
|
143
143
|
viewingVersion?: number | null;
|
|
144
144
|
/** Host is running widget codegen — send button becomes stop. */
|
|
145
145
|
isGenerating?: boolean;
|
|
146
|
+
/** Tail of the model stream while codegen is in flight. */
|
|
147
|
+
generationStream?: string;
|
|
146
148
|
onStopGeneration?: () => void;
|
|
147
149
|
/**
|
|
148
150
|
* Renders the inline design-control card attached to an assistant reply
|
|
@@ -216,7 +218,7 @@
|
|
|
216
218
|
updateLastUserMessageAttachments: (attachments: Array<{ id?: string; url: string; file_type?: string; file_name?: string | null }>) => void;
|
|
217
219
|
}
|
|
218
220
|
|
|
219
|
-
let { context, config = {}, class: className = '', locale = null, messages: languageMessages = null, dir = undefined, style = '', isCompleted = false, onStatsUpdate, onChatReady, onCompletionToggle, onSendMessage, onLoadConversations, onLoadMessages, onCreateConversation, onSaveMessage, onRestoreCheckpointBackend, onTakeScreenshot, onConversationChange, onDraftChange, onRetryMessage, onUpgradePlans, onUploadChatFile, showHeader = true, headerTitle = '', showDescriptionHeader = true, showLogs = true, resizeExpandsContainer = false, onMessagesResize, onMessagesDrag, onMessagesDragEnd, onLoadOlderMessages, widgetHeadCommitSha = null, versionLabelByCommitSha = {}, versionLabelByPrompt = {}, versionTimeline = [], viewingVersion = null, isGenerating = false, onStopGeneration, renderDesignControls, actionBarExtras, completeReplacement, replaceComplete = false, showSelector = false, isSelectorActive = false, selectedElements = [], onToggleSelector, onRemoveSelectedElement, onClearSelectedElements, composerExtras, storedLineLabel }: Props = $props();
|
|
221
|
+
let { context, config = {}, class: className = '', locale = null, messages: languageMessages = null, dir = undefined, style = '', isCompleted = false, onStatsUpdate, onChatReady, onCompletionToggle, onSendMessage, onLoadConversations, onLoadMessages, onCreateConversation, onSaveMessage, onRestoreCheckpointBackend, onTakeScreenshot, onConversationChange, onDraftChange, onRetryMessage, onUpgradePlans, onUploadChatFile, showHeader = true, headerTitle = '', showDescriptionHeader = true, showLogs = true, resizeExpandsContainer = false, onMessagesResize, onMessagesDrag, onMessagesDragEnd, onLoadOlderMessages, widgetHeadCommitSha = null, versionLabelByCommitSha = {}, versionLabelByPrompt = {}, versionTimeline = [], viewingVersion = null, isGenerating = false, generationStream = '', onStopGeneration, renderDesignControls, actionBarExtras, completeReplacement, replaceComplete = false, showSelector = false, isSelectorActive = false, selectedElements = [], onToggleSelector, onRemoveSelectedElement, onClearSelectedElements, composerExtras, storedLineLabel }: Props = $props();
|
|
220
222
|
|
|
221
223
|
// The words of everything inside the chat, in the language the page chose. The page can change the language while the
|
|
222
224
|
// chat is open: the settings are read again whenever they change (and setting the same language again does nothing).
|
|
@@ -1247,7 +1249,24 @@
|
|
|
1247
1249
|
const rollback = result?.gitRollback || result?.git_rollback || result?.data?.gitRollback || result?.data?.git_rollback;
|
|
1248
1250
|
const newSha = String(rollback?.commitId || rollback?.commit_id || '').trim();
|
|
1249
1251
|
if (rollback?.success && newSha && promptCopy) {
|
|
1250
|
-
|
|
1252
|
+
const attachmentSource = (checkpointUser?.attachments || []).some((attachment: { url?: string }) => !!attachment?.url)
|
|
1253
|
+
? checkpointUser
|
|
1254
|
+
: currentMessages.find((message: any) =>
|
|
1255
|
+
message?.messageType === 'user'
|
|
1256
|
+
&& String(message.messageContent || '').trim() === promptCopy
|
|
1257
|
+
&& (message.attachments || []).some((attachment: { url?: string }) => !!attachment?.url)
|
|
1258
|
+
);
|
|
1259
|
+
const restoredAttachments = (attachmentSource?.attachments || [])
|
|
1260
|
+
.filter((attachment: { url?: string }) => !!attachment?.url)
|
|
1261
|
+
.map((attachment: { id?: string; url: string; file_type?: string; fileType?: string; file_name?: string; fileName?: string; file_size?: number; fileSize?: number }) => ({
|
|
1262
|
+
id: String(attachment.id || attachment.url),
|
|
1263
|
+
url: attachment.url,
|
|
1264
|
+
file_type: attachment.file_type || attachment.fileType || 'image/png',
|
|
1265
|
+
file_name: attachment.file_name || attachment.fileName || 'design-screenshot.png',
|
|
1266
|
+
file_size: attachment.file_size ?? attachment.fileSize,
|
|
1267
|
+
}));
|
|
1268
|
+
console.log('[Chat] Restore echo attachments', restoredAttachments.length);
|
|
1269
|
+
addUserMessage(promptCopy, restoredAttachments.length ? restoredAttachments : undefined);
|
|
1251
1270
|
addAssistantMessage(`Restored from ${sourceLabel}\n\nCommit: ${newSha.slice(0, 8)}`);
|
|
1252
1271
|
}
|
|
1253
1272
|
} catch (backendError) {
|
|
@@ -1469,7 +1488,7 @@
|
|
|
1469
1488
|
|
|
1470
1489
|
// Terminal codegen status lines: the normal completion and the semantic-cache
|
|
1471
1490
|
// "already done" affordance. Both are turn-deduped status bubbles.
|
|
1472
|
-
const CODEGEN_STATUS_MESSAGE_REGEX = /^(Code generation completed|Already done)/i;
|
|
1491
|
+
const CODEGEN_STATUS_MESSAGE_REGEX = /^(Code generation completed|Already done|Generation complete \(100%\))/i;
|
|
1473
1492
|
|
|
1474
1493
|
function isCodegenStatusMessage(content?: string | null): boolean {
|
|
1475
1494
|
return CODEGEN_STATUS_MESSAGE_REGEX.test((content || '').trim());
|
|
@@ -1862,6 +1881,7 @@
|
|
|
1862
1881
|
onRequestOlderMessages={() => loadOlderMessages()}
|
|
1863
1882
|
showCommitMeta={showLogs}
|
|
1864
1883
|
isGenerating={isGenerating || isLoading}
|
|
1884
|
+
generationStream={isGenerating ? generationStream : ''}
|
|
1865
1885
|
onSuggestionSelected={handleSuggestionSelected}
|
|
1866
1886
|
onRestoreCheckpoint={handleRestoreCheckpoint}
|
|
1867
1887
|
onRetryMessage={handleRetryMessage}
|
|
@@ -186,6 +186,8 @@ interface Props {
|
|
|
186
186
|
viewingVersion?: number | null;
|
|
187
187
|
/** Host is running widget codegen — send button becomes stop. */
|
|
188
188
|
isGenerating?: boolean;
|
|
189
|
+
/** Tail of the model stream while codegen is in flight. */
|
|
190
|
+
generationStream?: string;
|
|
189
191
|
onStopGeneration?: () => void;
|
|
190
192
|
/**
|
|
191
193
|
* Renders the inline design-control card attached to an assistant reply
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { chatLog } from '../utils/logger.js';
|
|
6
6
|
import { AttachmentDisplay, SuggestionButtons } from './index.js';
|
|
7
7
|
import CodeBlock from './CodeBlock.svelte';
|
|
8
|
-
import LoadingIndicator from './LoadingIndicator.svelte';
|
|
9
8
|
import { onDestroy, onMount, tick } from 'svelte';
|
|
10
9
|
import type { Snippet } from 'svelte';
|
|
11
10
|
import { useChatLanguage } from '../i18n/language.js';
|
|
@@ -63,6 +62,8 @@
|
|
|
63
62
|
showCommitMeta?: boolean;
|
|
64
63
|
/** True while codegen / send is in flight — suppresses premature Retry. */
|
|
65
64
|
isGenerating?: boolean;
|
|
65
|
+
/** Tail of the model stream for the generation in flight. Empty when it is only thinking. */
|
|
66
|
+
generationStream?: string;
|
|
66
67
|
onSuggestionSelected?: (suggestion: string) => void;
|
|
67
68
|
onRestoreCheckpoint?: (messageId: string, messageIndex: number) => void;
|
|
68
69
|
onRetryMessage?: (content: string) => void;
|
|
@@ -102,6 +103,7 @@
|
|
|
102
103
|
viewingVersion = null,
|
|
103
104
|
showCommitMeta = true,
|
|
104
105
|
isGenerating = false,
|
|
106
|
+
generationStream = '',
|
|
105
107
|
onSuggestionSelected,
|
|
106
108
|
onRestoreCheckpoint,
|
|
107
109
|
onRetryMessage,
|
|
@@ -115,12 +117,15 @@
|
|
|
115
117
|
|
|
116
118
|
/** What a visitor reads for stored assistant/system lines; matching still uses the English stored text. */
|
|
117
119
|
function visibleMessageContent(content: string): string {
|
|
118
|
-
|
|
120
|
+
const withoutContractNote = showGenerationSummaries
|
|
121
|
+
? content
|
|
122
|
+
: content.replace(/\n*⚠️ Heads up:[\s\S]*$/i, '').trim();
|
|
123
|
+
if (!storedLineLabel) return withoutContractNote;
|
|
119
124
|
try {
|
|
120
|
-
return storedLineLabel(
|
|
125
|
+
return storedLineLabel(withoutContractNote);
|
|
121
126
|
} catch (error) {
|
|
122
127
|
console.warn('[Chat] storedLineLabel failed:', error);
|
|
123
|
-
return
|
|
128
|
+
return withoutContractNote;
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
131
|
|
|
@@ -340,8 +345,15 @@
|
|
|
340
345
|
return expanded;
|
|
341
346
|
}
|
|
342
347
|
|
|
348
|
+
function turnIsRestoreEcho(turn: ChatTurn): boolean {
|
|
349
|
+
return turn.replies.some((reply) => isRestoreForkContent(reply.messageContent));
|
|
350
|
+
}
|
|
351
|
+
|
|
343
352
|
function visibleUserAttachments(turn: ChatTurn, turnIndex: number) {
|
|
344
353
|
const attachments = turn.user?.attachments || [];
|
|
354
|
+
// Restore adds a copy of the prompt. That copy should keep the sketch image
|
|
355
|
+
// the original turn showed, even though it is not the first message.
|
|
356
|
+
if (turnIsRestoreEcho(turn)) return attachments;
|
|
345
357
|
const hasEarlierUser = chatTurns.slice(0, turnIndex).some((candidate) => candidate.user);
|
|
346
358
|
if (!hasEarlierUser) return attachments;
|
|
347
359
|
// The opening sketch stays on the first turn. Later prompts must not
|
|
@@ -693,6 +705,7 @@
|
|
|
693
705
|
const trimmed = (content || '').trim();
|
|
694
706
|
return (
|
|
695
707
|
/^Code generation completed/i.test(trimmed) ||
|
|
708
|
+
/^Generation complete \(100%\)/i.test(trimmed) ||
|
|
696
709
|
/^Code saved/i.test(trimmed) ||
|
|
697
710
|
/^Compile fix applied/i.test(trimmed) ||
|
|
698
711
|
/^Preview recompiled/i.test(trimmed) ||
|
|
@@ -702,6 +715,8 @@
|
|
|
702
715
|
|
|
703
716
|
/** Whether this assistant bubble should render (vs commit chrome on user message). */
|
|
704
717
|
function shouldShowAssistantReply(reply: ChatMessage): boolean {
|
|
718
|
+
const trimmedReply = (reply.messageContent || '').trim();
|
|
719
|
+
if (!showGenerationSummaries && /^⚠️ Heads up:/i.test(trimmedReply)) return false;
|
|
705
720
|
if (isCodegenFailure(reply)) return true;
|
|
706
721
|
if (showGenerationSummaries) return true;
|
|
707
722
|
if (isCodegenProgressBubble(reply.messageContent)) return false;
|
|
@@ -774,6 +789,9 @@
|
|
|
774
789
|
}
|
|
775
790
|
|
|
776
791
|
function shouldPinChatToBottom(): boolean {
|
|
792
|
+
// A live generation grows under the list. Stay on that tail even when an
|
|
793
|
+
// older version is the one marked "you are here".
|
|
794
|
+
if (isGenerating) return true;
|
|
777
795
|
if (viewingVersion != null) {
|
|
778
796
|
const hereIndex = viewingTurnIndex();
|
|
779
797
|
if (hereIndex < 0 || hereIndex < chatTurns.length - 1) return false;
|
|
@@ -781,6 +799,11 @@
|
|
|
781
799
|
return autoScroll;
|
|
782
800
|
}
|
|
783
801
|
|
|
802
|
+
function scrollGenerationTail(): void {
|
|
803
|
+
const tail = messagesContainer?.querySelector('.generation-stream');
|
|
804
|
+
if (tail) tail.scrollTop = tail.scrollHeight;
|
|
805
|
+
}
|
|
806
|
+
|
|
784
807
|
/**
|
|
785
808
|
* Scroll to the selected version only when that selection changes.
|
|
786
809
|
* A page of older messages must not pull the list back to the latest turn.
|
|
@@ -791,10 +814,11 @@
|
|
|
791
814
|
const sha = widgetHeadCommitSha ?? '';
|
|
792
815
|
const key = `${version ?? ''}|${sha}`;
|
|
793
816
|
const turnCount = chatTurns.length;
|
|
794
|
-
|
|
817
|
+
const generating = isGenerating;
|
|
818
|
+
if (generating || (version == null && !sha) || !messagesContainer || turnCount === 0) return;
|
|
795
819
|
if (key === scrolledViewKey || pendingOlderScroll) return;
|
|
796
820
|
void tick().then(() => {
|
|
797
|
-
if (!messagesContainer || pendingOlderScroll) return;
|
|
821
|
+
if (!messagesContainer || pendingOlderScroll || isGenerating) return;
|
|
798
822
|
const here = messagesContainer.querySelector('[data-you-are-here="true"]');
|
|
799
823
|
if (!here) return;
|
|
800
824
|
scrollIntoViewWithin(messagesContainer, here);
|
|
@@ -858,18 +882,78 @@
|
|
|
858
882
|
|
|
859
883
|
// Local state
|
|
860
884
|
let messagesContainer: HTMLElement;
|
|
861
|
-
let showSuggestionsInline = $state(false);
|
|
862
885
|
let autoScroll = $state(true);
|
|
886
|
+
/** Model text kept after the preview is up, so thinking and code stay in the thread. */
|
|
887
|
+
let keptGenerationText = $state('');
|
|
888
|
+
let shownGenerationCount = $state(0);
|
|
889
|
+
let thinkingShownCount = $state(0);
|
|
890
|
+
let generationWasRunning = false;
|
|
863
891
|
// The first paint is shorter than the loaded page. Scrolling then, or treating
|
|
864
892
|
// that short box as "the user is at the top", loads older pages and never
|
|
865
893
|
// lands on the newest message. Pin once, after this load has finished.
|
|
866
894
|
let initialBottomPinned = $state(false);
|
|
867
895
|
|
|
868
|
-
|
|
869
|
-
|
|
896
|
+
function mergeGenerationStream(previous: string, incoming: string): string {
|
|
897
|
+
if (!incoming) return previous;
|
|
898
|
+
if (!previous || incoming.startsWith(previous)) return incoming;
|
|
899
|
+
if (previous.includes(incoming)) return previous;
|
|
900
|
+
const maxOverlap = Math.min(previous.length, incoming.length);
|
|
901
|
+
for (let size = maxOverlap; size > 20; size -= 1) {
|
|
902
|
+
if (previous.slice(-size) === incoming.slice(0, size)) {
|
|
903
|
+
return previous + incoming.slice(size);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
return previous + '\n' + incoming;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// A new send starts a fresh transcript. An empty thread drops the previous one.
|
|
870
910
|
$effect(() => {
|
|
871
|
-
if (isGenerating &&
|
|
911
|
+
if (isGenerating && !generationWasRunning) {
|
|
912
|
+
keptGenerationText = '';
|
|
913
|
+
shownGenerationCount = 0;
|
|
914
|
+
thinkingShownCount = 0;
|
|
915
|
+
}
|
|
916
|
+
generationWasRunning = isGenerating;
|
|
917
|
+
if (messages.length === 0 && !isGenerating) {
|
|
918
|
+
keptGenerationText = '';
|
|
919
|
+
shownGenerationCount = 0;
|
|
920
|
+
}
|
|
872
921
|
});
|
|
922
|
+
|
|
923
|
+
$effect(() => {
|
|
924
|
+
const incoming = generationStream;
|
|
925
|
+
if (!incoming) return;
|
|
926
|
+
const merged = mergeGenerationStream(keptGenerationText, incoming);
|
|
927
|
+
if (merged !== keptGenerationText) keptGenerationText = merged;
|
|
928
|
+
});
|
|
929
|
+
|
|
930
|
+
// Reveal from the first character already on screen, then catch up to new tokens.
|
|
931
|
+
$effect(() => {
|
|
932
|
+
const target = keptGenerationText.length;
|
|
933
|
+
if (shownGenerationCount >= target) return;
|
|
934
|
+
const timer = setInterval(() => {
|
|
935
|
+
shownGenerationCount = Math.min(keptGenerationText.length, shownGenerationCount + 8);
|
|
936
|
+
if (shownGenerationCount >= keptGenerationText.length) clearInterval(timer);
|
|
937
|
+
}, 20);
|
|
938
|
+
return () => clearInterval(timer);
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
const thinkingLabel = $derived($t('chat.messages.thinking'));
|
|
942
|
+
|
|
943
|
+
$effect(() => {
|
|
944
|
+
if (!isGenerating || keptGenerationText) return;
|
|
945
|
+
const label = thinkingLabel;
|
|
946
|
+
if (thinkingShownCount >= label.length) return;
|
|
947
|
+
const timer = setInterval(() => {
|
|
948
|
+
thinkingShownCount = Math.min(label.length, thinkingShownCount + 1);
|
|
949
|
+
if (thinkingShownCount >= label.length) clearInterval(timer);
|
|
950
|
+
}, 28);
|
|
951
|
+
return () => clearInterval(timer);
|
|
952
|
+
});
|
|
953
|
+
|
|
954
|
+
const shownThinkingLabel = $derived(thinkingLabel.slice(0, thinkingShownCount));
|
|
955
|
+
|
|
956
|
+
const shownGenerationText = $derived(keptGenerationText.slice(0, shownGenerationCount));
|
|
873
957
|
/**
|
|
874
958
|
* Opening on a small screen often resizes the container (parent panel layout)
|
|
875
959
|
* AFTER mount, which resets scroll to the top and clips the input below the
|
|
@@ -912,13 +996,15 @@
|
|
|
912
996
|
}
|
|
913
997
|
const pinToBottom = shouldPinChatToBottom();
|
|
914
998
|
const messageCount = visibleMessages.length;
|
|
999
|
+
const streamLength = shownGenerationText.length;
|
|
915
1000
|
if (!initialBottomPinned && messagesContainer && messageCount > 0 && !pendingOlderScroll) {
|
|
916
1001
|
void tick().then(() => settleMessagesToEnd());
|
|
917
1002
|
}
|
|
918
|
-
if (messagesContainer && pinToBottom && messageCount > 0 && !pendingOlderScroll && initialBottomPinned) {
|
|
1003
|
+
if (messagesContainer && pinToBottom && (messageCount > 0 || streamLength > 0) && !pendingOlderScroll && initialBottomPinned) {
|
|
919
1004
|
tick().then(() => {
|
|
920
1005
|
if (!messagesContainer || pendingOlderScroll || !shouldPinChatToBottom()) return;
|
|
921
1006
|
scrollMessagesToEnd();
|
|
1007
|
+
if (isGenerating) scrollGenerationTail();
|
|
922
1008
|
});
|
|
923
1009
|
}
|
|
924
1010
|
});
|
|
@@ -1555,27 +1641,6 @@
|
|
|
1555
1641
|
</div>
|
|
1556
1642
|
{/each}
|
|
1557
1643
|
|
|
1558
|
-
<!-- Show suggestions toggle (when there are messages) -->
|
|
1559
|
-
{#if messages.length > 0 && !isLoading && !isGenerating}
|
|
1560
|
-
<div class="suggestions-toggle-ct flex justify-center py-2">
|
|
1561
|
-
{#if showSuggestionsInline}
|
|
1562
|
-
<SuggestionButtons
|
|
1563
|
-
{context}
|
|
1564
|
-
visible={true}
|
|
1565
|
-
onHide={() => { showSuggestionsInline = false; }}
|
|
1566
|
-
on:suggestionSelected={(e) => { showSuggestionsInline = false; handleSuggestionSelected(e); }}
|
|
1567
|
-
/>
|
|
1568
|
-
{:else}
|
|
1569
|
-
<button
|
|
1570
|
-
class="suggestions-toggle-btn text-xs text-gray-400 hover:text-gray-600 px-3 py-1.5 rounded-full border border-gray-200 hover:border-gray-300 bg-white hover:bg-gray-50 transition-colors cursor-pointer"
|
|
1571
|
-
onclick={() => { showSuggestionsInline = true; }}
|
|
1572
|
-
>
|
|
1573
|
-
{$t('chat.messages.showSuggestions')}
|
|
1574
|
-
</button>
|
|
1575
|
-
{/if}
|
|
1576
|
-
</div>
|
|
1577
|
-
{/if}
|
|
1578
|
-
|
|
1579
1644
|
<!-- Loading indicator -->
|
|
1580
1645
|
{#if messages.length === 0 && isLoading}
|
|
1581
1646
|
<div class="loading-history-ct flex flex-1 items-center justify-center p-8">
|
|
@@ -1584,23 +1649,52 @@
|
|
|
1584
1649
|
<p class="text-gray-500 text-xs">{$t('chat.messages.loadingHistory')}</p>
|
|
1585
1650
|
</div>
|
|
1586
1651
|
</div>
|
|
1587
|
-
{:else if
|
|
1588
|
-
<div class="loading-indicator-ct flex
|
|
1589
|
-
<div class="rounded-lg
|
|
1652
|
+
{:else if isGenerating && !shownGenerationText}
|
|
1653
|
+
<div class="loading-indicator-ct flex flex-col items-start gap-2 p-3">
|
|
1654
|
+
<div class="thinking-bubble relative inline-block whitespace-nowrap rounded-lg p-3 text-sm leading-relaxed shadow-sm"
|
|
1590
1655
|
style="background-color: {MESSAGE_COLORS.ASSISTANT}; color: {MESSAGE_COLORS.ASSISTANT_TEXT}"
|
|
1591
1656
|
>
|
|
1592
|
-
<
|
|
1593
|
-
|
|
1594
|
-
text={$t('chat.messages.thinking')}
|
|
1595
|
-
color="secondary"
|
|
1596
|
-
size="md"
|
|
1597
|
-
/>
|
|
1657
|
+
<span class="thinking-sizer invisible" aria-hidden="true">{thinkingLabel}</span>
|
|
1658
|
+
<span class="thinking-reveal absolute inset-0 flex items-center px-3">{shownThinkingLabel}</span>
|
|
1598
1659
|
</div>
|
|
1599
1660
|
</div>
|
|
1600
1661
|
{/if}
|
|
1662
|
+
{#if shownGenerationText}
|
|
1663
|
+
<div class="generation-stream-ct flex flex-col items-start gap-2 px-3 pb-3">
|
|
1664
|
+
<pre class="generation-stream m-0 max-h-40 w-full overflow-auto whitespace-pre-wrap break-words rounded-lg bg-gray-900 p-3 font-mono text-[11px] leading-relaxed text-gray-100">{shownGenerationText}</pre>
|
|
1665
|
+
</div>
|
|
1666
|
+
{/if}
|
|
1601
1667
|
</div>
|
|
1602
1668
|
|
|
1603
1669
|
<style>
|
|
1670
|
+
.thinking-reveal {
|
|
1671
|
+
background-image: linear-gradient(100deg, #1f2937 35%, #ffffff 50%, #1f2937 65%);
|
|
1672
|
+
background-size: 200% 100%;
|
|
1673
|
+
-webkit-background-clip: text;
|
|
1674
|
+
background-clip: text;
|
|
1675
|
+
color: transparent;
|
|
1676
|
+
animation: thinking-shine 1.6s linear infinite;
|
|
1677
|
+
}
|
|
1678
|
+
@keyframes thinking-shine {
|
|
1679
|
+
0% { background-position: 100% 0; }
|
|
1680
|
+
100% { background-position: -100% 0; }
|
|
1681
|
+
}
|
|
1682
|
+
.generation-stream {
|
|
1683
|
+
scrollbar-width: thin;
|
|
1684
|
+
scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
|
|
1685
|
+
}
|
|
1686
|
+
.generation-stream::-webkit-scrollbar {
|
|
1687
|
+
width: 8px;
|
|
1688
|
+
height: 8px;
|
|
1689
|
+
background: transparent;
|
|
1690
|
+
}
|
|
1691
|
+
.generation-stream::-webkit-scrollbar-track {
|
|
1692
|
+
background: transparent;
|
|
1693
|
+
}
|
|
1694
|
+
.generation-stream::-webkit-scrollbar-thumb {
|
|
1695
|
+
background: rgba(255, 255, 255, 0.35);
|
|
1696
|
+
border-radius: 4px;
|
|
1697
|
+
}
|
|
1604
1698
|
.loading {
|
|
1605
1699
|
opacity: 0.75;
|
|
1606
1700
|
}
|
|
@@ -49,6 +49,8 @@ interface Props {
|
|
|
49
49
|
showCommitMeta?: boolean;
|
|
50
50
|
/** True while codegen / send is in flight — suppresses premature Retry. */
|
|
51
51
|
isGenerating?: boolean;
|
|
52
|
+
/** Tail of the model stream for the generation in flight. Empty when it is only thinking. */
|
|
53
|
+
generationStream?: string;
|
|
52
54
|
onSuggestionSelected?: (suggestion: string) => void;
|
|
53
55
|
onRestoreCheckpoint?: (messageId: string, messageIndex: number) => void;
|
|
54
56
|
onRetryMessage?: (content: string) => void;
|
package/dist/i18n/messages.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare const CHAT_MESSAGES: {
|
|
|
41
41
|
readonly 'chat.messages.startHint': "Ask a question about your {type} to get started.";
|
|
42
42
|
readonly 'chat.messages.loadingHistory': "Loading chat history...";
|
|
43
43
|
/** Said while the assistant works on an answer. */
|
|
44
|
-
readonly 'chat.messages.thinking': "Assistant is thinking
|
|
44
|
+
readonly 'chat.messages.thinking': "Assistant is thinking";
|
|
45
45
|
/** The mark on the turn of the version that is open now, and the line that explains it. */
|
|
46
46
|
readonly 'chat.messages.viewing': "You are here";
|
|
47
47
|
readonly 'chat.messages.viewingTitle': "This is the version you are looking at";
|
|
@@ -75,7 +75,7 @@ export declare const CHAT_MESSAGES: {
|
|
|
75
75
|
readonly 'chat.suggestions.hide': "Hide suggestions";
|
|
76
76
|
/** The ideas for a widget: tapping one sends it as the person's own message. */
|
|
77
77
|
readonly 'chat.suggestions.frame.generateCode': "Generate code from this design";
|
|
78
|
-
readonly 'chat.suggestions.frame.improveLayout': "
|
|
78
|
+
readonly 'chat.suggestions.frame.improveLayout': "Improve this layout";
|
|
79
79
|
readonly 'chat.suggestions.frame.addInteractivity': "Add interactive functionality";
|
|
80
80
|
readonly 'chat.suggestions.frame.makeResponsive': "Make this responsive for mobile";
|
|
81
81
|
readonly 'chat.suggestions.frame.addAnimations': "Add animations and transitions";
|
package/dist/i18n/messages.js
CHANGED
|
@@ -45,7 +45,7 @@ export const CHAT_MESSAGES = {
|
|
|
45
45
|
'chat.messages.startHint': 'Ask a question about your {type} to get started.',
|
|
46
46
|
'chat.messages.loadingHistory': 'Loading chat history...',
|
|
47
47
|
/** Said while the assistant works on an answer. */
|
|
48
|
-
'chat.messages.thinking': 'Assistant is thinking
|
|
48
|
+
'chat.messages.thinking': 'Assistant is thinking',
|
|
49
49
|
/** The mark on the turn of the version that is open now, and the line that explains it. */
|
|
50
50
|
'chat.messages.viewing': 'You are here',
|
|
51
51
|
'chat.messages.viewingTitle': 'This is the version you are looking at',
|
|
@@ -80,7 +80,7 @@ export const CHAT_MESSAGES = {
|
|
|
80
80
|
'chat.suggestions.hide': 'Hide suggestions',
|
|
81
81
|
/** The ideas for a widget: tapping one sends it as the person's own message. */
|
|
82
82
|
'chat.suggestions.frame.generateCode': 'Generate code from this design',
|
|
83
|
-
'chat.suggestions.frame.improveLayout': '
|
|
83
|
+
'chat.suggestions.frame.improveLayout': 'Improve this layout',
|
|
84
84
|
'chat.suggestions.frame.addInteractivity': 'Add interactive functionality',
|
|
85
85
|
'chat.suggestions.frame.makeResponsive': 'Make this responsive for mobile',
|
|
86
86
|
'chat.suggestions.frame.addAnimations': 'Add animations and transitions',
|