@widgetic/chat 0.1.38 → 0.1.40
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/README.md +71 -0
- package/dist/components/AttachmentDisplay.svelte +14 -4
- package/dist/components/Chat.svelte +131 -106
- package/dist/components/Chat.svelte.d.ts +29 -0
- package/dist/components/ChatComposer.svelte +5 -1
- package/dist/components/ChatMessages.svelte +595 -175
- package/dist/components/ChatMessages.svelte.d.ts +20 -0
- package/dist/components/CodeBlock.svelte +9 -1
- package/dist/components/ComposerAttachmentsTray.svelte +64 -0
- package/dist/components/ComposerAttachmentsTray.svelte.d.ts +11 -0
- package/dist/components/PanelChatHeader.svelte +26 -6
- package/dist/components/PanelChatHeader.svelte.d.ts +1 -0
- package/dist/components/PanelFollowUpSuggestions.svelte +2 -2
- package/dist/components/PanelSuggestionButtons.svelte +2 -1
- package/dist/components/agent/AgentAvatar.svelte +153 -0
- package/dist/components/agent/AgentAvatar.svelte.d.ts +27 -0
- package/dist/components/agent/AgentTurn.svelte +64 -0
- package/dist/components/agent/AgentTurn.svelte.d.ts +32 -0
- package/dist/components/agent/AvatarBoundary.svelte +29 -0
- package/dist/components/agent/AvatarBoundary.svelte.d.ts +20 -0
- package/dist/components/agent/CodeCard.svelte +288 -0
- package/dist/components/agent/CodeCard.svelte.d.ts +12 -0
- package/dist/components/agent/GenerationModule.svelte +99 -0
- package/dist/components/agent/GenerationModule.svelte.d.ts +16 -0
- package/dist/components/agent/MemberAvatar.svelte +87 -0
- package/dist/components/agent/MemberAvatar.svelte.d.ts +8 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +9 -0
- package/dist/i18n/messages.d.ts +32 -10
- package/dist/i18n/messages.js +32 -10
- package/dist/types/agent.d.ts +74 -0
- package/dist/types/agent.js +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/agentTurn.d.ts +219 -0
- package/dist/utils/agentTurn.js +301 -0
- package/dist/utils/attachmentPreviewUrl.d.ts +21 -0
- package/dist/utils/attachmentPreviewUrl.js +39 -0
- package/dist/utils/bubbleFit.d.ts +75 -0
- package/dist/utils/bubbleFit.js +116 -0
- package/dist/utils/bubbleShrinkWrap.d.ts +32 -0
- package/dist/utils/bubbleShrinkWrap.js +360 -0
- package/dist/utils/chatImageUploadPrep.d.ts +22 -0
- package/dist/utils/chatImageUploadPrep.js +90 -0
- package/dist/utils/codeHighlight.d.ts +13 -0
- package/dist/utils/codeHighlight.js +61 -0
- package/dist/utils/codePrettier.d.ts +6 -0
- package/dist/utils/codePrettier.js +34 -0
- package/dist/utils/codeStreamFormat.d.ts +90 -0
- package/dist/utils/codeStreamFormat.js +429 -0
- package/dist/utils/generationArchiveStore.d.ts +15 -0
- package/dist/utils/generationArchiveStore.js +89 -0
- package/dist/utils/imageTransform.d.ts +12 -0
- package/dist/utils/imageTransform.js +45 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/suggestionDraft.d.ts +5 -0
- package/dist/utils/suggestionDraft.js +15 -0
- package/package.json +5 -4
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ChatMessage, ChatContext } from '../types/index.js';
|
|
3
3
|
import type { ClarificationSuggestion, DesignControlRequest, VersionRating } from '../types/message.js';
|
|
4
|
-
import {
|
|
5
|
-
import { chatLog } from '../utils/logger.js';
|
|
4
|
+
import type { AgentAvatarRenderer, AgentAvatarState, AgentSoundPlayer, ChatMember } from '../types/agent.js';
|
|
5
|
+
import { chatLog, chatWarn } from '../utils/logger.js';
|
|
6
|
+
import { shrinkWrapBubble } from '../utils/bubbleShrinkWrap.js';
|
|
6
7
|
import { splitTextIntoLinks } from '../utils/linkifyText.js';
|
|
7
8
|
import { isRatableVersionReply, type VersionThumb } from '../utils/versionRatings.js';
|
|
8
9
|
import { isLocalMessageId, restoreBeforeTarget, textToCopy, type TurnRestorePoint } from '../utils/messageActions.js';
|
|
@@ -11,7 +12,10 @@
|
|
|
11
12
|
import PanelFollowUpSuggestions from './PanelFollowUpSuggestions.svelte';
|
|
12
13
|
import CodeBlock from './CodeBlock.svelte';
|
|
13
14
|
import MessageActions from './MessageActions.svelte';
|
|
14
|
-
import
|
|
15
|
+
import AgentTurn from './agent/AgentTurn.svelte';
|
|
16
|
+
import GenerationModule from './agent/GenerationModule.svelte';
|
|
17
|
+
import MemberAvatar from './agent/MemberAvatar.svelte';
|
|
18
|
+
import { onDestroy, onMount, tick, untrack } from 'svelte';
|
|
15
19
|
import type { Snippet } from 'svelte';
|
|
16
20
|
import { useChatLanguage } from '../i18n/language.js';
|
|
17
21
|
import { CHAT_MESSAGES } from '../i18n/messages.js';
|
|
@@ -19,17 +23,43 @@
|
|
|
19
23
|
import { dirForUserText, useTextDirection } from '@widgetic/design-system/components/textDirection';
|
|
20
24
|
import IconSparkles from '@tabler/icons-svelte/icons/sparkles';
|
|
21
25
|
import IconPlayerStop from '@tabler/icons-svelte/icons/player-stop';
|
|
26
|
+
import IconAlertTriangle from '@tabler/icons-svelte/icons/alert-triangle';
|
|
27
|
+
import IconRefresh from '@tabler/icons-svelte/icons/refresh';
|
|
22
28
|
import {
|
|
23
29
|
generationActivityAriaKey,
|
|
24
30
|
generationActivityPhase,
|
|
25
31
|
thoughtDurationSeconds,
|
|
32
|
+
readThinkingTail,
|
|
33
|
+
readCodegenStreamTail,
|
|
26
34
|
} from '../utils/generationActivity.js';
|
|
27
35
|
import { mapWidgetPlanToPlanCard, type GenerationPlanWire } from '../utils/generationPlan.js';
|
|
36
|
+
import {
|
|
37
|
+
agentLookSignature,
|
|
38
|
+
avatarStartAfter,
|
|
39
|
+
finishedGenerationBelongsTo,
|
|
40
|
+
finishedModulesView,
|
|
41
|
+
keepFinishedGeneration,
|
|
42
|
+
keptWorkIsOutdated,
|
|
43
|
+
liveAgentLook,
|
|
44
|
+
liveModulesView,
|
|
45
|
+
pageNamesPeople,
|
|
46
|
+
resolveChatMember,
|
|
47
|
+
settledAgentLook,
|
|
48
|
+
soundStateOf,
|
|
49
|
+
turnOutcome,
|
|
50
|
+
type AgentAvatarSize,
|
|
51
|
+
type AgentLook,
|
|
52
|
+
type FinishedGeneration,
|
|
53
|
+
type TurnReplyFacts
|
|
54
|
+
} from '../utils/agentTurn.js';
|
|
55
|
+
import {
|
|
56
|
+
clearGenerationArchive,
|
|
57
|
+
loadGenerationArchive,
|
|
58
|
+
saveGenerationArchive,
|
|
59
|
+
} from '../utils/generationArchiveStore.js';
|
|
28
60
|
// The chat barrel of the design system: its export map resolves `components/<name>` to `<name>.js` only,
|
|
29
61
|
// so a deep `.svelte` path types fine but cannot be resolved by Vite or Node.
|
|
30
62
|
import {
|
|
31
|
-
ActivityRow,
|
|
32
|
-
ChatAlertCard,
|
|
33
63
|
Message,
|
|
34
64
|
MessageCheckpointRow,
|
|
35
65
|
PlanCard,
|
|
@@ -132,6 +162,25 @@
|
|
|
132
162
|
onRequestOlderMessages?: () => Promise<boolean | void>;
|
|
133
163
|
/** Widget creator side panel: Figma empty / follow-up suggestion cards. */
|
|
134
164
|
panelLayout?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* The people of the project's team. A message a person wrote gets that person's picture (or initials) at its right, and
|
|
167
|
+
* their e-mail while the pointer is on it.
|
|
168
|
+
*/
|
|
169
|
+
members?: ChatMember[];
|
|
170
|
+
/** The signed-in person: who wrote the messages they just sent, and anything no member matches. */
|
|
171
|
+
currentUser?: ChatMember | null;
|
|
172
|
+
/** How the assistant's avatar is drawn (the Scribble Mascot in the Widgetic apps). A plain round avatar without it. */
|
|
173
|
+
renderAgentAvatar?: AgentAvatarRenderer;
|
|
174
|
+
/** Lets the avatar be heard: told its state once for each change, for runs the person watched. Silent without it. */
|
|
175
|
+
agentSound?: AgentSoundPlayer;
|
|
176
|
+
/**
|
|
177
|
+
* Sizes the bubbles of what people wrote to their text with Pretext (https://chenglou.me/pretext/bubbles/): a bubble whose text
|
|
178
|
+
* wraps is as narrow as its widest line allows, not as wide as the chat, so no dead space is left beside short lines. A text that
|
|
179
|
+
* does not wrap, and a message with code blocks, keep the width CSS gives them. On by default; pass `false` for CSS's widths.
|
|
180
|
+
*/
|
|
181
|
+
tightBubbles?: boolean;
|
|
182
|
+
/** Active conversation id — persists generation archive in IndexedDB across reload. */
|
|
183
|
+
conversationId?: string | null;
|
|
135
184
|
}
|
|
136
185
|
|
|
137
186
|
let {
|
|
@@ -165,6 +214,12 @@
|
|
|
165
214
|
hasOlderMessages = false,
|
|
166
215
|
onRequestOlderMessages,
|
|
167
216
|
panelLayout = false,
|
|
217
|
+
members = [],
|
|
218
|
+
currentUser = null,
|
|
219
|
+
renderAgentAvatar,
|
|
220
|
+
agentSound,
|
|
221
|
+
tightBubbles = true,
|
|
222
|
+
conversationId = null,
|
|
168
223
|
}: Props = $props();
|
|
169
224
|
|
|
170
225
|
|
|
@@ -194,15 +249,22 @@
|
|
|
194
249
|
|
|
195
250
|
function detectMessagesScrollbar(node: HTMLElement) {
|
|
196
251
|
function check() {
|
|
197
|
-
messagesHasScrollbar = node.scrollHeight > node.clientHeight +
|
|
252
|
+
messagesHasScrollbar = node.scrollHeight > node.clientHeight + 4;
|
|
198
253
|
if (panelLayout) {
|
|
199
254
|
// The docked panel keeps Figma's 16px on both sides (set in the style of the list); with a scrollbar the bar
|
|
200
255
|
// takes the place of half of it.
|
|
201
256
|
if (messagesHasScrollbar) node.style.setProperty('padding-inline-end', '8px', 'important');
|
|
202
|
-
else
|
|
257
|
+
else {
|
|
258
|
+
node.style.removeProperty('padding-inline-end');
|
|
259
|
+
node.style.setProperty('padding-inline-start', '16px', 'important');
|
|
260
|
+
node.style.setProperty('padding-inline-end', '16px', 'important');
|
|
261
|
+
}
|
|
203
262
|
return;
|
|
204
263
|
}
|
|
205
|
-
|
|
264
|
+
// A scrollbar that takes room of its own (classic bars) is the gap itself. One that floats over the list (overlay bars, as on
|
|
265
|
+
// a Mac) takes none, so there the 12px stay, and a wide card (a question, a plan) does not touch the edge under the bar.
|
|
266
|
+
const scrollbarTakesRoom = node.offsetWidth - node.clientWidth > 0;
|
|
267
|
+
node.style.setProperty('padding-inline-end', messagesHasScrollbar && scrollbarTakesRoom ? '0px' : '12px', 'important');
|
|
206
268
|
}
|
|
207
269
|
const resizeObserver = new ResizeObserver(check);
|
|
208
270
|
resizeObserver.observe(node);
|
|
@@ -811,7 +873,12 @@
|
|
|
811
873
|
const meta = reply.metadata as { panelFollowUp?: boolean } | undefined;
|
|
812
874
|
if (!reply.suggestions?.length || meta?.panelFollowUp === false) continue;
|
|
813
875
|
if (!shouldShowAssistantReply(reply)) continue;
|
|
814
|
-
|
|
876
|
+
// A suggestion without a text label would give the keyed list a NaN key and stop the whole panel from rendering.
|
|
877
|
+
const suggestionLabels = reply.suggestions
|
|
878
|
+
.map((suggestion) => suggestion?.label)
|
|
879
|
+
.filter((label): label is string => typeof label === 'string' && label.trim().length > 0);
|
|
880
|
+
if (suggestionLabels.length === 0) continue;
|
|
881
|
+
return { labels: suggestionLabels };
|
|
815
882
|
}
|
|
816
883
|
}
|
|
817
884
|
return null;
|
|
@@ -872,6 +939,108 @@
|
|
|
872
939
|
);
|
|
873
940
|
});
|
|
874
941
|
|
|
942
|
+
// --- the faces: the assistant's avatar on its turn, and the people's next to what they wrote --------------------------
|
|
943
|
+
|
|
944
|
+
/** Whether the page said who is who: without it no face is drawn next to what people wrote. */
|
|
945
|
+
const peopleAreNamed = $derived(pageNamesPeople(members, currentUser));
|
|
946
|
+
|
|
947
|
+
/** The person who wrote a message, or null when nobody can be named (no face is better than a wrong one). */
|
|
948
|
+
function authorOfMessage(message: ChatMessage): ChatMember | null {
|
|
949
|
+
if (!peopleAreNamed) return null;
|
|
950
|
+
return resolveChatMember(message.userId, members, currentUser);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
// An author the page did not name is said once per author, not on every redraw
|
|
954
|
+
const unnamedAuthorIdsSaid = new Set<string>();
|
|
955
|
+
$effect(() => {
|
|
956
|
+
if (!peopleAreNamed) return;
|
|
957
|
+
for (const message of messages) {
|
|
958
|
+
if (message.messageType !== 'user') continue;
|
|
959
|
+
const authorId = message.userId;
|
|
960
|
+
if (unnamedAuthorIdsSaid.has(authorId) || resolveChatMember(authorId, members, currentUser)) continue;
|
|
961
|
+
unnamedAuthorIdsSaid.add(authorId);
|
|
962
|
+
chatWarn('[Chat] No member of the team matches the author of a message, so it has no face:', authorId);
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
|
|
966
|
+
/** What the assistant looks like and shows in one turn. */
|
|
967
|
+
type TurnAssistantView = {
|
|
968
|
+
/** Anything to draw for the assistant in this turn: a reply to show, or a run that just ended for it. */
|
|
969
|
+
hasContent: boolean;
|
|
970
|
+
look: AgentLook;
|
|
971
|
+
/**
|
|
972
|
+
* The size the avatar glides from as it appears. It takes over from the live avatar of the run that just ended, so it starts as
|
|
973
|
+
* large or as small as that one was (a Stop pressed while it was large shrinks it down; the conclusion grows out of the work).
|
|
974
|
+
*/
|
|
975
|
+
startSize: AgentAvatarSize | undefined;
|
|
976
|
+
/** The state the avatar is drawn in first, the one of the live avatar it takes over from, before it moves on to its own. */
|
|
977
|
+
startState: AgentAvatarState | undefined;
|
|
978
|
+
/** What the assistant did in the run that just ended for this turn: the modules under its conclusion. */
|
|
979
|
+
finished: FinishedGeneration | null;
|
|
980
|
+
/** It built something and the chat shows no message about it: the catalog's "done" line is its conclusion. */
|
|
981
|
+
showDoneLine: boolean;
|
|
982
|
+
};
|
|
983
|
+
|
|
984
|
+
const NO_ASSISTANT_VIEW: TurnAssistantView = {
|
|
985
|
+
hasContent: false,
|
|
986
|
+
look: { state: 'idle', size: 'small', live: false },
|
|
987
|
+
startSize: undefined,
|
|
988
|
+
startState: undefined,
|
|
989
|
+
finished: null,
|
|
990
|
+
showDoneLine: false,
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
/** What the chat found out about one reply, in the terms the turn's outcome is judged by (the rules live in `agentTurn.ts`). */
|
|
994
|
+
function replyFactsOf(reply: ChatMessage): TurnReplyFacts {
|
|
995
|
+
return {
|
|
996
|
+
isFailure: isCodegenFailure(reply),
|
|
997
|
+
isStopped: isStoppedByUser(reply),
|
|
998
|
+
// In the panel the suggestions are the cards above the composer, not a card in the turn
|
|
999
|
+
hasQuestion: !panelLayout && (reply.suggestions?.length ?? 0) > 0,
|
|
1000
|
+
hasCommit: messageHasCommit(reply) && !isCodegenFailure(reply),
|
|
1001
|
+
isCompletion: /^Code generation completed/i.test((reply.messageContent || '').trim()),
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* The assistant of one turn: its avatar's look, and what it shows besides its replies. Only the newest turn moves, and only
|
|
1007
|
+
* what just ended in front of the person (a run, a failure, a card to answer) is large: the rest is small and still.
|
|
1008
|
+
*/
|
|
1009
|
+
function assistantViewOf(turn: ChatTurn): TurnAssistantView {
|
|
1010
|
+
const visibleReplies = turn.replies.filter(shouldShowAssistantReply);
|
|
1011
|
+
const isNewestTurn = isLastUserTurn(turn);
|
|
1012
|
+
const keptWork = finishedGeneration;
|
|
1013
|
+
// The words of the prompt find the turn again after a reload, but a prompt sent again (a retry) has the same words as the one
|
|
1014
|
+
// the work answered: the chat adds that message before the host has saved it and started the run, and until then the new
|
|
1015
|
+
// turn is not the work's, which the message the work answered tells.
|
|
1016
|
+
const finished =
|
|
1017
|
+
isNewestTurn &&
|
|
1018
|
+
finishedGenerationBelongsTo(keptWork, turn.user?.messageContent) &&
|
|
1019
|
+
!keptWorkIsOutdated(keptForUserMessageId, messages)
|
|
1020
|
+
? keptWork
|
|
1021
|
+
: null;
|
|
1022
|
+
const outcome = turnOutcome(visibleReplies.map(replyFactsOf), finished !== null);
|
|
1023
|
+
if (outcome === null) return NO_ASSISTANT_VIEW;
|
|
1024
|
+
// A success the person did not just watch (the conversation was loaded, or a debug line says so) is not celebrated
|
|
1025
|
+
const shownOutcome = outcome === 'success' && finished === null ? 'answer' : outcome;
|
|
1026
|
+
// The run is over, but the effects that keep its work and clear its traces have not run yet. The page tells a failure or a
|
|
1027
|
+
// stop in the same tick the run ends (the creator adds the message, then clears isGenerating), so the avatar that appears in
|
|
1028
|
+
// this very pass is the end of that run, and the one of a success appears a pass later. It takes over from the live avatar
|
|
1029
|
+
// and starts from how that one looked: a Stop pressed while the avatar is still large shrinks it down to its small size, the
|
|
1030
|
+
// conclusion grows out of the small avatar of the work.
|
|
1031
|
+
const runIsEnding = thinkingHold && !assistantIsWorking;
|
|
1032
|
+
const takesOverFromLiveAvatar = finished !== null || (isNewestTurn && runIsEnding);
|
|
1033
|
+
const avatarStart = takesOverFromLiveAvatar ? avatarStartAfter(lastLiveLook) : null;
|
|
1034
|
+
return {
|
|
1035
|
+
hasContent: true,
|
|
1036
|
+
look: settledAgentLook(shownOutcome, isNewestTurn),
|
|
1037
|
+
startSize: avatarStart?.startSize,
|
|
1038
|
+
startState: avatarStart?.startState,
|
|
1039
|
+
finished,
|
|
1040
|
+
showDoneLine: finished !== null && outcome === 'success' && visibleReplies.length === 0,
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
|
|
875
1044
|
/** One entry per turn, in the order of `chatTurns`. */
|
|
876
1045
|
const restorePoints = $derived(chatTurns.map(restorePointOf));
|
|
877
1046
|
|
|
@@ -884,13 +1053,6 @@
|
|
|
884
1053
|
return autoScroll;
|
|
885
1054
|
}
|
|
886
1055
|
|
|
887
|
-
function scrollGenerationTail(): void {
|
|
888
|
-
const tail = messagesContainer?.querySelector('.generation-stream');
|
|
889
|
-
if (tail) tail.scrollTop = tail.scrollHeight;
|
|
890
|
-
const thinking = messagesContainer?.querySelector('.generation-thinking-stream');
|
|
891
|
-
if (thinking) thinking.scrollTop = thinking.scrollHeight;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
1056
|
function messageImpliesAttachedFile(content: string): boolean {
|
|
895
1057
|
return /imaginea ata[sș]at[ăa]|attached (reference )?(image|document|file|pdf|video)|reference image|din imagine|ata[sș]at[ăa]?\s+(document|pdf|fi[sș]ier|video)|attached document/i.test(
|
|
896
1058
|
content,
|
|
@@ -911,14 +1073,14 @@
|
|
|
911
1073
|
return /credit balance|free trial|not available in your plan|not available on the free plan|upgrade your plan|upgrade to a solo/i.test(message);
|
|
912
1074
|
}
|
|
913
1075
|
|
|
914
|
-
/** What the
|
|
915
|
-
*
|
|
916
|
-
function
|
|
1076
|
+
/** What the line of a failed reply says: the server's own words when they tell something specific (the plan or the credits,
|
|
1077
|
+
* too many requests, the service is unavailable, the run was stopped), otherwise the short "Could not build the widget". */
|
|
1078
|
+
function failureLine(message: ChatMessage): string {
|
|
917
1079
|
const serverText = visibleMessageContent(message.messageContent || '').trim();
|
|
918
1080
|
const isSpecificFailure =
|
|
919
1081
|
isPlanLimitMessage(message.messageContent) ||
|
|
920
1082
|
/Too many generation requests|temporarily unavailable|Generation stopped/i.test(serverText);
|
|
921
|
-
return isSpecificFailure && serverText ? serverText : $t('chat.messages.
|
|
1083
|
+
return isSpecificFailure && serverText ? serverText : $t('chat.messages.failedTitle');
|
|
922
1084
|
}
|
|
923
1085
|
|
|
924
1086
|
function openUpgradePlans() {
|
|
@@ -969,10 +1131,8 @@
|
|
|
969
1131
|
let thinkingStartedAtMs = $state<number | null>(null);
|
|
970
1132
|
let codeStreamingStartedAtMs = $state<number | null>(null);
|
|
971
1133
|
let frozenThoughtSeconds = $state<number | null>(null);
|
|
972
|
-
let thinkingExpanded = $state(false);
|
|
973
1134
|
let generationAriaLine = $state('');
|
|
974
1135
|
let lastGenerationAriaKey = '';
|
|
975
|
-
let thinkingStreamEl = $state<HTMLDivElement | null>(null);
|
|
976
1136
|
|
|
977
1137
|
const planCardView = $derived(
|
|
978
1138
|
isGenerating && generationPlan
|
|
@@ -1003,6 +1163,170 @@
|
|
|
1003
1163
|
return previous + '\n' + incoming;
|
|
1004
1164
|
}
|
|
1005
1165
|
|
|
1166
|
+
// --- what the assistant did, kept for its conclusion -------------------------------------------------------------
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* True only while the assistant really works. The chat raises `isGenerating` while the history loads as well (that locks the
|
|
1170
|
+
* composer), but loading is no work of the assistant: no avatar thinks for it, and nothing is kept from it.
|
|
1171
|
+
*/
|
|
1172
|
+
const assistantIsWorking = $derived(isGenerating && !isLoading);
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* The thinking and the code of the generation that just ended: the modules under its conclusion show them, closed, for the
|
|
1176
|
+
* person to open. For the newest turn only. The host saves neither, so this browser keeps them (see the archive below) and
|
|
1177
|
+
* they come back after a reload, found again by the words of the prompt they answered.
|
|
1178
|
+
*/
|
|
1179
|
+
let finishedGeneration = $state<FinishedGeneration | null>(null);
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* The id of the message of the person that the kept work answered. A user message after it means a new turn, even if its words
|
|
1183
|
+
* are the same (see `keptWorkIsOutdated`). It is set together with `finishedGeneration`, which is what makes the turns draw
|
|
1184
|
+
* again, so it needs no state of its own. Work that came back from the archive knows only the words of its prompt: this is null
|
|
1185
|
+
* until the history is there and the message with those words is found (see `restoredWorkAwaitsItsMessage`).
|
|
1186
|
+
*/
|
|
1187
|
+
let keptForUserMessageId: string | null = null;
|
|
1188
|
+
|
|
1189
|
+
/** Work came back from the archive and has not been told yet which message it answered (the history may not be there yet). */
|
|
1190
|
+
let restoredWorkAwaitsItsMessage = false;
|
|
1191
|
+
|
|
1192
|
+
/** The work of the last run is not the newest work any more (a new run, another conversation, an empty thread). */
|
|
1193
|
+
function forgetKeptWork(): void {
|
|
1194
|
+
finishedGeneration = null;
|
|
1195
|
+
keptForUserMessageId = null;
|
|
1196
|
+
restoredWorkAwaitsItsMessage = false;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* How the live avatar of the run looked at its last change of look. The avatar that takes over when the run ends starts from it
|
|
1201
|
+
* (see `avatarStartAfter`). It is read in the pass that ends the run, which does not wait for it, so it is a plain variable and
|
|
1202
|
+
* not state: a change of look has no reason to draw the list again.
|
|
1203
|
+
*/
|
|
1204
|
+
let lastLiveLook: AgentLook | null = null;
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* A run worked while this conversation was open here: the person saw it happen. The sound of the avatar follows only what the
|
|
1208
|
+
* person saw, so a conversation that is merely opened (whose newest turn may well have ended in an error) stays silent until a run
|
|
1209
|
+
* works in it (see `soundStateOf`). State, because what the sound is told is worked out from it.
|
|
1210
|
+
*/
|
|
1211
|
+
let runWasWatched = $state(false);
|
|
1212
|
+
|
|
1213
|
+
/** The newest message the person sent: the turn the run that just ended belongs to. */
|
|
1214
|
+
function newestUserMessage(): ChatMessage | null {
|
|
1215
|
+
for (let messageIndex = messages.length - 1; messageIndex >= 0; messageIndex--) {
|
|
1216
|
+
if (messages[messageIndex].messageType === 'user') return messages[messageIndex];
|
|
1217
|
+
}
|
|
1218
|
+
return null;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
let assistantWasWorking = false;
|
|
1222
|
+
// The end of a run keeps its work. It has to do that BEFORE the effect below clears the texts that work is made of: effects run
|
|
1223
|
+
// in the order they are written, so this one stays above it (a test of the chat guards the order).
|
|
1224
|
+
$effect(() => {
|
|
1225
|
+
const working = assistantIsWorking;
|
|
1226
|
+
if (working === assistantWasWorking) return;
|
|
1227
|
+
assistantWasWorking = working;
|
|
1228
|
+
// Only the start and the end of a run get here; what is read below is not what makes this run again
|
|
1229
|
+
untrack(() => {
|
|
1230
|
+
try {
|
|
1231
|
+
if (working) {
|
|
1232
|
+
// A new run starts: what the last one kept is not the newest work any more, and no avatar of it is left to take over from
|
|
1233
|
+
forgetKeptWork();
|
|
1234
|
+
lastLiveLook = null;
|
|
1235
|
+
runWasWatched = true;
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
const keptThinking = keptThinkingText;
|
|
1239
|
+
const keptCode = keptGenerationText;
|
|
1240
|
+
const keptThoughtSeconds =
|
|
1241
|
+
frozenThoughtSeconds ??
|
|
1242
|
+
(keptThinking.trim().length > 0 ? thoughtDurationSeconds(thinkingStartedAtMs, Date.now()) : null);
|
|
1243
|
+
const answeredMessage = newestUserMessage();
|
|
1244
|
+
finishedGeneration = keepFinishedGeneration({
|
|
1245
|
+
promptText: answeredMessage?.messageContent,
|
|
1246
|
+
thinking: keptThinking,
|
|
1247
|
+
code: keptCode,
|
|
1248
|
+
thoughtSeconds: keptThoughtSeconds,
|
|
1249
|
+
});
|
|
1250
|
+
// Said with the work, so that a prompt sent after it (even with the same words) is not taken for the one it answered
|
|
1251
|
+
keptForUserMessageId = finishedGeneration ? (answeredMessage?.id ?? null) : null;
|
|
1252
|
+
chatLog('[Chat] the assistant finished, kept for its conclusion:', {
|
|
1253
|
+
'Thinking Characters Kept': finishedGeneration?.thinking.length ?? 0,
|
|
1254
|
+
'Code Characters Kept': finishedGeneration?.code.length ?? 0,
|
|
1255
|
+
'Thought Seconds': keptThoughtSeconds,
|
|
1256
|
+
});
|
|
1257
|
+
// Also in this browser (by conversation), so a reload of the page brings the same modules back under the conclusion
|
|
1258
|
+
if (finishedGeneration) void saveGenerationArchive(conversationId, finishedGeneration);
|
|
1259
|
+
} catch (error) {
|
|
1260
|
+
chatWarn('[Chat] Could not keep what the assistant did for its conclusion:', error);
|
|
1261
|
+
forgetKeptWork();
|
|
1262
|
+
}
|
|
1263
|
+
});
|
|
1264
|
+
});
|
|
1265
|
+
|
|
1266
|
+
// After a reload, or when a conversation is opened, the work of its last run comes back from what this browser kept, so the
|
|
1267
|
+
// newest turn shows its thinking and its code again. Only the id of the conversation makes this run again.
|
|
1268
|
+
let archiveConversationId: string | null = null;
|
|
1269
|
+
$effect(() => {
|
|
1270
|
+
const archiveKey = conversationId?.trim() || null;
|
|
1271
|
+
untrack(() => {
|
|
1272
|
+
const previousKey = archiveConversationId;
|
|
1273
|
+
archiveConversationId = archiveKey;
|
|
1274
|
+
// Another conversation (or none) is open: nothing in it was watched yet. Not while a run works at this very moment: the first
|
|
1275
|
+
// message of a new chat makes its conversation, and the run it starts is the one the person is watching.
|
|
1276
|
+
if (previousKey !== archiveKey && !assistantIsWorking) runWasWatched = false;
|
|
1277
|
+
if (!archiveKey) return;
|
|
1278
|
+
// Another conversation was opened: what was kept for the one before is not this one's work
|
|
1279
|
+
if (previousKey && previousKey !== archiveKey) forgetKeptWork();
|
|
1280
|
+
void loadGenerationArchive(archiveKey)
|
|
1281
|
+
.then((record) => {
|
|
1282
|
+
// A run that began or ended while the archive was read keeps what it has, and so does a conversation that changed meanwhile
|
|
1283
|
+
if (!record || assistantIsWorking || finishedGeneration || archiveConversationId !== archiveKey) return;
|
|
1284
|
+
finishedGeneration = keepFinishedGeneration({
|
|
1285
|
+
promptText: record.prompt,
|
|
1286
|
+
thinking: record.thinking,
|
|
1287
|
+
code: record.code,
|
|
1288
|
+
thoughtSeconds: record.thoughtSeconds,
|
|
1289
|
+
});
|
|
1290
|
+
// The archive knows the words of the prompt and nothing else: they find the turn again, and the effect below tells the
|
|
1291
|
+
// work which message that is as soon as the history is there
|
|
1292
|
+
keptForUserMessageId = null;
|
|
1293
|
+
restoredWorkAwaitsItsMessage = finishedGeneration !== null;
|
|
1294
|
+
chatLog('[Chat] the work of the last run came back from the archive:', {
|
|
1295
|
+
'Thinking Characters': finishedGeneration?.thinking.length ?? 0,
|
|
1296
|
+
'Code Characters': finishedGeneration?.code.length ?? 0,
|
|
1297
|
+
});
|
|
1298
|
+
})
|
|
1299
|
+
.catch((error) => chatWarn('[Chat] Could not read the archive of the last run:', error));
|
|
1300
|
+
});
|
|
1301
|
+
});
|
|
1302
|
+
|
|
1303
|
+
// The work that came back from the archive is told which message of the person it answered: the newest one with its words, once
|
|
1304
|
+
// the history is there. From then on a prompt sent after it is a new turn even if its words are the same (a retry after a
|
|
1305
|
+
// reload). Work that answers none of the newest messages (the run it came from is not the newest turn) has no turn to show
|
|
1306
|
+
// under, and must not be taken for the work of a later prompt that happens to have the same words, so it goes.
|
|
1307
|
+
$effect(() => {
|
|
1308
|
+
const restoredWork = finishedGeneration;
|
|
1309
|
+
const historyIsThere = isInitialized && !isLoading && messages.length > 0;
|
|
1310
|
+
if (!restoredWork || !historyIsThere || assistantIsWorking) return;
|
|
1311
|
+
untrack(() => {
|
|
1312
|
+
if (!restoredWorkAwaitsItsMessage) return;
|
|
1313
|
+
restoredWorkAwaitsItsMessage = false;
|
|
1314
|
+
try {
|
|
1315
|
+
const newestMessage = newestUserMessage();
|
|
1316
|
+
if (newestMessage && finishedGenerationBelongsTo(restoredWork, newestMessage.messageContent)) {
|
|
1317
|
+
keptForUserMessageId = newestMessage.id;
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
chatLog('[Chat] the work in the archive answers none of the newest messages, so it is not shown:', {
|
|
1321
|
+
'Prompt Of The Work': restoredWork.prompt.slice(0, 60),
|
|
1322
|
+
});
|
|
1323
|
+
forgetKeptWork();
|
|
1324
|
+
} catch (error) {
|
|
1325
|
+
chatWarn('[Chat] Could not tell which message the work from the archive answered:', error);
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
});
|
|
1329
|
+
|
|
1006
1330
|
// A new send starts a fresh transcript. An empty thread drops the previous one.
|
|
1007
1331
|
$effect(() => {
|
|
1008
1332
|
if (isGenerating && !generationWasRunning) {
|
|
@@ -1014,23 +1338,27 @@
|
|
|
1014
1338
|
thinkingStartedAtMs = Date.now();
|
|
1015
1339
|
codeStreamingStartedAtMs = null;
|
|
1016
1340
|
frozenThoughtSeconds = null;
|
|
1017
|
-
thinkingExpanded = false;
|
|
1018
1341
|
generationAriaLine = '';
|
|
1019
1342
|
lastGenerationAriaKey = '';
|
|
1020
1343
|
}
|
|
1021
1344
|
if (!isGenerating && generationWasRunning) {
|
|
1022
|
-
keptGenerationText = '';
|
|
1023
|
-
keptThinkingText = '';
|
|
1024
|
-
shownGenerationCount = 0;
|
|
1025
|
-
thinkingShownCount = 0;
|
|
1026
1345
|
thinkingHold = false;
|
|
1346
|
+
shownGenerationCount = keptGenerationText.length;
|
|
1347
|
+
thinkingShownCount = $t('chat.messages.thinking').length;
|
|
1027
1348
|
thinkingStartedAtMs = null;
|
|
1028
1349
|
codeStreamingStartedAtMs = null;
|
|
1029
1350
|
frozenThoughtSeconds = null;
|
|
1030
|
-
thinkingExpanded = false;
|
|
1031
1351
|
}
|
|
1032
1352
|
generationWasRunning = isGenerating;
|
|
1033
|
-
|
|
1353
|
+
});
|
|
1354
|
+
|
|
1355
|
+
// Drop the local transcript only after init finished and history is truly empty — not while the thread hydrates on reload.
|
|
1356
|
+
$effect(() => {
|
|
1357
|
+
void messages.length;
|
|
1358
|
+
if (!isInitialized || isLoading || isGenerating) return;
|
|
1359
|
+
if (messages.length === 0) {
|
|
1360
|
+
void clearGenerationArchive(conversationId);
|
|
1361
|
+
forgetKeptWork();
|
|
1034
1362
|
keptGenerationText = '';
|
|
1035
1363
|
keptThinkingText = '';
|
|
1036
1364
|
shownGenerationCount = 0;
|
|
@@ -1061,23 +1389,72 @@
|
|
|
1061
1389
|
generationActivityPhase(isGenerating, keptThinkingText, keptGenerationText),
|
|
1062
1390
|
);
|
|
1063
1391
|
|
|
1392
|
+
/** What the avatar of the live turn looks like and does, and which parts of the work are on screen, for this phase of the run. */
|
|
1393
|
+
const liveLook = $derived(liveAgentLook(activityPhase));
|
|
1394
|
+
const liveModules = $derived(liveModulesView(activityPhase));
|
|
1395
|
+
|
|
1396
|
+
// Said once per change of the look (never on every streamed token)
|
|
1397
|
+
let lastLiveLookSignature = '';
|
|
1064
1398
|
$effect(() => {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1399
|
+
if (!thinkingHold || !assistantIsWorking) {
|
|
1400
|
+
lastLiveLookSignature = '';
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
const signature = agentLookSignature(liveLook);
|
|
1404
|
+
if (signature === lastLiveLookSignature) return;
|
|
1405
|
+
lastLiveLookSignature = signature;
|
|
1406
|
+
// What the avatar of the run's ending takes over from (it is read when the run is over, see `lastLiveLook`)
|
|
1407
|
+
lastLiveLook = liveLook;
|
|
1408
|
+
chatLog('[Chat] the assistant, while it works:', { 'Look': signature, 'Phase': activityPhase });
|
|
1069
1409
|
});
|
|
1070
1410
|
|
|
1411
|
+
/**
|
|
1412
|
+
* How the settled avatar of the newest turn looks: the very view the turn draws, so the sound follows what the person sees and
|
|
1413
|
+
* never a state the avatar does not show. Null while that turn has nothing to show (a prompt just sent, a run that ended a
|
|
1414
|
+
* moment before its conclusion arrives).
|
|
1415
|
+
*/
|
|
1416
|
+
const newestTurnLook = $derived.by((): AgentLook | null => {
|
|
1417
|
+
for (let turnIndex = chatTurns.length - 1; turnIndex >= 0; turnIndex--) {
|
|
1418
|
+
if (!chatTurns[turnIndex].user) continue;
|
|
1419
|
+
const newestTurnView = assistantViewOf(chatTurns[turnIndex]);
|
|
1420
|
+
return newestTurnView.hasContent ? newestTurnView.look : null;
|
|
1421
|
+
}
|
|
1422
|
+
return null;
|
|
1423
|
+
});
|
|
1424
|
+
|
|
1425
|
+
/** The state of the avatar the person is looking at, for the page's sound, or null when there is nothing to hear (see `soundStateOf`). */
|
|
1426
|
+
const soundState = $derived(
|
|
1427
|
+
soundStateOf({
|
|
1428
|
+
runIsLive: thinkingHold && assistantIsWorking,
|
|
1429
|
+
liveLook,
|
|
1430
|
+
runWasWatched,
|
|
1431
|
+
newestTurnLook,
|
|
1432
|
+
}),
|
|
1433
|
+
);
|
|
1434
|
+
|
|
1435
|
+
// The page's sound is told once for each change of what the person looks at (never on every streamed token): thinking when the
|
|
1436
|
+
// run starts, writing when it writes code or the answer, then how it went. The player decides whether anything sounds.
|
|
1071
1437
|
$effect(() => {
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1438
|
+
const announcedState = soundState;
|
|
1439
|
+
if (announcedState === null) return;
|
|
1440
|
+
untrack(() => {
|
|
1441
|
+
if (!agentSound) return;
|
|
1442
|
+
try {
|
|
1443
|
+
chatLog('[Chat] the avatar of the assistant is heard going to:', { 'Sound State': announcedState });
|
|
1444
|
+
agentSound.notifyStateChange(announcedState);
|
|
1445
|
+
} catch (error) {
|
|
1446
|
+
chatWarn('[Chat] The sound of the assistant failed, so it stays silent:', error);
|
|
1447
|
+
}
|
|
1078
1448
|
});
|
|
1079
1449
|
});
|
|
1080
1450
|
|
|
1451
|
+
$effect(() => {
|
|
1452
|
+
const key = generationActivityAriaKey(activityPhase) ?? '';
|
|
1453
|
+
if (!key || key === lastGenerationAriaKey) return;
|
|
1454
|
+
lastGenerationAriaKey = key;
|
|
1455
|
+
generationAriaLine = $t(key);
|
|
1456
|
+
});
|
|
1457
|
+
|
|
1081
1458
|
// Reveal from the first character already on screen, then catch up to new tokens.
|
|
1082
1459
|
$effect(() => {
|
|
1083
1460
|
const target = keptGenerationText.length;
|
|
@@ -1138,6 +1515,43 @@
|
|
|
1138
1515
|
requestAnimationFrame(step);
|
|
1139
1516
|
}
|
|
1140
1517
|
|
|
1518
|
+
/**
|
|
1519
|
+
* An action for the part of the list that is still changing: the assistant's turn while it works, and the newest turn once
|
|
1520
|
+
* it has answered. Such a turn changes size under the list: the plan card moves on, the thinking grows inside its module,
|
|
1521
|
+
* the code streams, a module opens, and when the conclusion appears the face glides to its size and the content beside it
|
|
1522
|
+
* wraps again (a card gets taller). The mutation observer below sees nodes come and go, not a text that grows inside a node
|
|
1523
|
+
* or a card that re-wraps, so the end slid out of view. This watches the size of the turn itself and keeps the end in view,
|
|
1524
|
+
* as a generation always has (see `shouldPinChatToBottom`). Only the newest turn is watched (`active`): opening something in
|
|
1525
|
+
* the history must not pull the view away. At most one turn is observed at a time, and the observer is let go when the turn
|
|
1526
|
+
* stops being the newest or leaves.
|
|
1527
|
+
*/
|
|
1528
|
+
function keepEndInView(node: HTMLElement, active: boolean = true) {
|
|
1529
|
+
if (typeof ResizeObserver === 'undefined') return;
|
|
1530
|
+
let growthObserver: ResizeObserver | null = null;
|
|
1531
|
+
|
|
1532
|
+
function watchGrowth(shouldWatch: boolean): void {
|
|
1533
|
+
growthObserver?.disconnect();
|
|
1534
|
+
growthObserver = null;
|
|
1535
|
+
if (!shouldWatch) return;
|
|
1536
|
+
growthObserver = new ResizeObserver(() => {
|
|
1537
|
+
if (pendingOlderScroll || !initialBottomPinned) return;
|
|
1538
|
+
if (shouldPinChatToBottom()) scrollMessagesToEnd();
|
|
1539
|
+
});
|
|
1540
|
+
growthObserver.observe(node);
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
watchGrowth(active);
|
|
1544
|
+
return {
|
|
1545
|
+
update(shouldWatch: boolean) {
|
|
1546
|
+
watchGrowth(shouldWatch);
|
|
1547
|
+
},
|
|
1548
|
+
destroy() {
|
|
1549
|
+
growthObserver?.disconnect();
|
|
1550
|
+
growthObserver = null;
|
|
1551
|
+
}
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1141
1555
|
// Auto-scroll to bottom when new messages arrive or on initial load.
|
|
1142
1556
|
// Also scrolls on mount/conversation-switch when messages are already present.
|
|
1143
1557
|
$effect(() => {
|
|
@@ -1154,8 +1568,8 @@
|
|
|
1154
1568
|
if (messagesContainer && pinToBottom && (messageCount > 0 || streamLength > 0) && !pendingOlderScroll && initialBottomPinned) {
|
|
1155
1569
|
tick().then(() => {
|
|
1156
1570
|
if (!messagesContainer || pendingOlderScroll || !shouldPinChatToBottom()) return;
|
|
1571
|
+
// (The thinking and the code keep their own newest line in view: see GenerationModule.)
|
|
1157
1572
|
scrollMessagesToEnd();
|
|
1158
|
-
if (isGenerating) scrollGenerationTail();
|
|
1159
1573
|
});
|
|
1160
1574
|
}
|
|
1161
1575
|
});
|
|
@@ -1567,9 +1981,11 @@
|
|
|
1567
1981
|
<div class="{panelLayout ? 'panel-messages-shell flex h-full min-h-0 w-full flex-1 flex-col' : 'contents'}">
|
|
1568
1982
|
<div
|
|
1569
1983
|
bind:this={messagesContainer}
|
|
1570
|
-
class="{className ? className : 'prompt-chat-messages-ct'} prompt-chat-messages-scroll flex flex-col overflow-y-auto {panelLayout ? 'min-h-0 flex-1
|
|
1984
|
+
class="{className ? className : 'prompt-chat-messages-ct'} prompt-chat-messages-scroll flex flex-col {panelLayout && showEmptyState && !isLoading && !isGenerating ? 'overflow-y-hidden pb-0' : 'overflow-y-auto'} {panelLayout ? (showEmptyState && !isLoading && !isGenerating ? 'min-h-0 flex-1' : 'min-h-0 flex-1 pb-4') : 'space-y-4 pb-3'}"
|
|
1571
1985
|
class:loading={isLoading}
|
|
1572
|
-
style={panelLayout
|
|
1986
|
+
style={panelLayout
|
|
1987
|
+
? `padding: 8px 16px ${showEmptyState && !isLoading && !isGenerating ? 0 : 16}px; overflow-anchor: none;`
|
|
1988
|
+
: 'padding: 8px 16px 12px; overflow-anchor: none;'}
|
|
1573
1989
|
use:detectMessagesScrollbar
|
|
1574
1990
|
onscroll={handleScroll}
|
|
1575
1991
|
>
|
|
@@ -1581,8 +1997,8 @@
|
|
|
1581
1997
|
middle of the messages, and the suggestions are pinned under it, above the composer. The block takes the
|
|
1582
1998
|
free height with flex-1 (not min-h-full): the sticky scroll-to-bottom row below it needs its own room, and a
|
|
1583
1999
|
block as tall as the whole area would push it out and make the list scroll. -->
|
|
1584
|
-
<div class="empty-state-ct flex w-full flex-
|
|
1585
|
-
<div class="empty-state-hero flex
|
|
2000
|
+
<div class="empty-state-ct flex w-full flex-col gap-4 {panelLayout ? 'shrink-0' : 'flex-1'}">
|
|
2001
|
+
<div class="empty-state-hero flex shrink-0 flex-col items-center justify-center gap-3 text-center {panelLayout ? 'h-[508px]' : 'min-h-0 flex-1 px-2'}">
|
|
1586
2002
|
<span class="empty-state-icon-circle bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-full" aria-hidden="true">
|
|
1587
2003
|
<IconSparkles class="size-4 stroke-2" />
|
|
1588
2004
|
</span>
|
|
@@ -1607,20 +2023,29 @@
|
|
|
1607
2023
|
</div>
|
|
1608
2024
|
{/if}
|
|
1609
2025
|
|
|
2026
|
+
<div class="{panelLayout && chatTurns.length > 0 ? 'flex min-h-full flex-col' : 'contents'}">
|
|
2027
|
+
<div class="{panelLayout && chatTurns.length > 0 ? 'mt-auto flex w-full flex-col gap-4' : 'contents'}">
|
|
1610
2028
|
<!-- Conversation turns (user prompt + assistant status grouped) -->
|
|
1611
2029
|
{#each chatTurns as turn, turnIndex (turn.user?.id ?? turn.replies[0]?.id ?? turnIndex)}
|
|
1612
|
-
|
|
2030
|
+
{@const assistant = assistantViewOf(turn)}
|
|
2031
|
+
<div
|
|
2032
|
+
class="wc-chat-turn-ct rounded-lg {panelLayout ? 'flex flex-col gap-[52px]' : 'space-y-1.5 border border-transparent p-0.5'}"
|
|
2033
|
+
use:keepEndInView={turnIndex === chatTurns.length - 1}
|
|
2034
|
+
>
|
|
1613
2035
|
{#if turn.user}
|
|
1614
2036
|
{@const userMsg = turn.user}
|
|
1615
2037
|
{@const shownAttachments = visibleUserAttachments(turn, turnIndex)}
|
|
2038
|
+
{@const author = authorOfMessage(userMsg)}
|
|
1616
2039
|
<div class="message-container wc-chat-turn-user flex w-full flex-col {panelLayout ? 'items-end' : 'items-stretch'}"
|
|
1617
2040
|
class:opacity-75={userMsg._optimistic}
|
|
1618
2041
|
class:opacity-50={userMsg._failed}
|
|
1619
2042
|
class:has-attachments={shownAttachments.length > 0}
|
|
1620
2043
|
>
|
|
2044
|
+
<!-- The bubble and, at its end, the face of the person who wrote it (when the page told the chat who is who). -->
|
|
2045
|
+
<div class="wc-chat-turn-user-row flex w-full min-w-0 items-start gap-2" data-bubble-row>
|
|
1621
2046
|
<Message
|
|
1622
2047
|
role="user"
|
|
1623
|
-
class="{panelLayout ? 'panel-layout-user-message ms-auto w-fit max-w-[85%]' : 'ms-auto w-full max-w-full'}"
|
|
2048
|
+
class="{panelLayout ? 'panel-layout-user-message ms-auto w-fit max-w-[85%]' : 'ms-auto w-full max-w-full'} min-w-0"
|
|
1624
2049
|
data-testid="chat-user-bubble"
|
|
1625
2050
|
>
|
|
1626
2051
|
{#snippet children()}
|
|
@@ -1647,7 +2072,8 @@
|
|
|
1647
2072
|
{/each}
|
|
1648
2073
|
</div>
|
|
1649
2074
|
{:else}
|
|
1650
|
-
|
|
2075
|
+
<!-- Pretext sizes this text to the narrowest width that keeps its lines, so a wrapped bubble has no dead space beside them -->
|
|
2076
|
+
<p class="wc-chat-text whitespace-pre-wrap [overflow-wrap:anywhere] {panelLayout ? '' : 'p-3'}" dir={dirForUserText($textDirection)} use:shrinkWrapBubble={{ text: userMsg.messageContent, enabled: tightBubbles }}>{@render linkified(userMsg.messageContent)}</p>
|
|
1651
2077
|
{/if}
|
|
1652
2078
|
{/if}
|
|
1653
2079
|
{#if shownAttachments.length > 0}
|
|
@@ -1668,11 +2094,15 @@
|
|
|
1668
2094
|
</div>
|
|
1669
2095
|
{/snippet}
|
|
1670
2096
|
</Message>
|
|
2097
|
+
{#if author}
|
|
2098
|
+
<MemberAvatar member={author} class="mt-1" />
|
|
2099
|
+
{/if}
|
|
2100
|
+
</div>
|
|
1671
2101
|
{#if showCommitMetaOnUserTurn(turn) && (!panelLayout || showCommitMeta)}
|
|
1672
2102
|
{@const commitTitle = getTurnCommitTitle(turn)}
|
|
1673
2103
|
{@const versionLabel = getTurnVersionLabel(turn)}
|
|
1674
2104
|
{#if showCommitMeta && commitTitle}
|
|
1675
|
-
<div class="wc-user-commit-title-row flex w-full min-w-0 mt-1">
|
|
2105
|
+
<div class="wc-user-commit-title-row flex w-full min-w-0 mt-1 {author ? 'pe-8' : ''}">
|
|
1676
2106
|
<span class="wc-user-commit-title text-xs text-gray-600" title={commitTitle}>
|
|
1677
2107
|
{commitTitle}
|
|
1678
2108
|
</span>
|
|
@@ -1682,7 +2112,7 @@
|
|
|
1682
2112
|
{@const restoredVersion = restoredVersionFromTurn(turn)}
|
|
1683
2113
|
{@const headRedoId = turnIsRestoreEcho(turn) ? headCommitRestoreTargetId() : null}
|
|
1684
2114
|
<MessageCheckpointRow
|
|
1685
|
-
class="wc-user-commit-meta-ct mt-1"
|
|
2115
|
+
class="wc-user-commit-meta-ct mt-1 {author ? 'pe-8' : ''}"
|
|
1686
2116
|
versionLabel={versionLabel && versionNumberFromLabel(versionLabel) !== 1
|
|
1687
2117
|
? versionLabelText(versionLabel, $t)
|
|
1688
2118
|
: showCommitMeta && getTurnCommitShort(turn)
|
|
@@ -1704,41 +2134,69 @@
|
|
|
1704
2134
|
</div>
|
|
1705
2135
|
{/if}
|
|
1706
2136
|
|
|
2137
|
+
<!-- Everything the assistant said or showed in this turn, with its face: the avatar at the left, the words to its right. After
|
|
2138
|
+
a run that just ended, the thinking and the code it made sit closed above its conclusion. (Not re-indented: the replies
|
|
2139
|
+
below are the same markup that used to sit directly in the turn.) -->
|
|
2140
|
+
{#if assistant.hasContent}
|
|
2141
|
+
<AgentTurn look={assistant.look} startSize={assistant.startSize} startState={assistant.startState} {renderAgentAvatar} class="wc-chat-turn-assistant">
|
|
2142
|
+
{#if assistant.finished}
|
|
2143
|
+
{@const keptModules = finishedModulesView(assistant.finished)}
|
|
2144
|
+
{#if keptModules.showThinking}
|
|
2145
|
+
<GenerationModule kind="thinking" text={assistant.finished.thinking} seconds={assistant.finished.thoughtSeconds} />
|
|
2146
|
+
{/if}
|
|
2147
|
+
{#if keptModules.showCode}
|
|
2148
|
+
<GenerationModule kind="code" text={assistant.finished.code} />
|
|
2149
|
+
{/if}
|
|
2150
|
+
{/if}
|
|
1707
2151
|
{#each turn.replies as reply (reply.id)}
|
|
1708
2152
|
{#if shouldShowAssistantReply(reply)}
|
|
2153
|
+
<!-- In the standard layout a question's text is the question card's own title, so the reply has no text of its own to draw -->
|
|
2154
|
+
{@const replyTextIsShown = !!reply.messageContent && (panelLayout || !(reply.suggestions && reply.suggestions.length > 0))}
|
|
1709
2155
|
{#if panelLayout && isStoppedByUser(reply)}
|
|
1710
2156
|
<!-- A stop is the person's own command: one quiet line, not the red "Could not build the widget" card. -->
|
|
1711
2157
|
<p
|
|
1712
|
-
class="wc-chat-turn-reply wc-chat-stopped text-body text-muted-foreground flex items-center gap-2"
|
|
2158
|
+
class="wc-chat-turn-reply wc-chat-stopped text-body text-muted-foreground flex min-h-7 items-center gap-2"
|
|
1713
2159
|
data-testid="chat-stopped-notice"
|
|
1714
2160
|
>
|
|
1715
2161
|
<IconPlayerStop class="size-4 shrink-0 stroke-2" aria-hidden="true" />
|
|
1716
2162
|
<span>{$t('chat.messages.stoppedByYou')}</span>
|
|
1717
2163
|
</p>
|
|
1718
2164
|
{:else if panelLayout && isCodegenFailure(reply)}
|
|
1719
|
-
<!--
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
title={$t('chat.messages.failedTitle')}
|
|
1724
|
-
description={failureAlertDescription(reply)}
|
|
1725
|
-
actionLabel={onRetryMessage &&
|
|
2165
|
+
<!-- A failed reply in the docked panel is one short line, not a card: the warning mark, what went wrong in a few words,
|
|
2166
|
+
and a refresh icon that runs the prompt of this turn again (on the last failure of the turn only, never on a plan limit). -->
|
|
2167
|
+
{@const canRetryFailure =
|
|
2168
|
+
!!onRetryMessage &&
|
|
1726
2169
|
isLastCodegenFailureInTurn(turn, reply) &&
|
|
1727
2170
|
!isPlanLimitMessage(reply.messageContent) &&
|
|
1728
|
-
turnNeedsRetry(turn, turnIndex)
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
2171
|
+
turnNeedsRetry(turn, turnIndex)}
|
|
2172
|
+
<div
|
|
2173
|
+
class="wc-chat-turn-reply wc-chat-failed text-body text-destructive flex min-h-7 items-center gap-2"
|
|
2174
|
+
data-testid="chat-failed-notice"
|
|
2175
|
+
>
|
|
2176
|
+
<IconAlertTriangle class="size-4 shrink-0 stroke-2" aria-hidden="true" />
|
|
2177
|
+
<span class="min-w-0 flex-1 [overflow-wrap:anywhere]">{failureLine(reply)}</span>
|
|
2178
|
+
{#if canRetryFailure}
|
|
2179
|
+
<button
|
|
2180
|
+
type="button"
|
|
2181
|
+
class="text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:ring-ring flex size-7 shrink-0 items-center justify-center rounded-md transition-colors focus-visible:ring-2 focus-visible:outline-none"
|
|
2182
|
+
aria-label={$t('chat.messages.failedRetry')}
|
|
2183
|
+
title={$t('chat.messages.failedRetry')}
|
|
2184
|
+
data-testid="chat-failed-retry"
|
|
2185
|
+
onclick={() => handleRetryTurn(turn, turnIndex)}
|
|
2186
|
+
>
|
|
2187
|
+
<IconRefresh class="size-4 stroke-2" aria-hidden="true" />
|
|
2188
|
+
</button>
|
|
2189
|
+
{/if}
|
|
2190
|
+
</div>
|
|
2191
|
+
{:else if replyTextIsShown || isCodegenFailure(reply)}
|
|
1734
2192
|
<Message
|
|
1735
2193
|
role="assistant"
|
|
1736
|
-
class="wc-chat-turn-reply max-w-full"
|
|
2194
|
+
class="wc-chat-turn-reply mt-0.5 max-w-full"
|
|
1737
2195
|
error={isCodegenFailure(reply)}
|
|
1738
2196
|
errorText={visibleMessageContent(reply.messageContent || '')}
|
|
1739
2197
|
>
|
|
1740
2198
|
{#snippet children()}
|
|
1741
|
-
{#if
|
|
2199
|
+
{#if replyTextIsShown}
|
|
1742
2200
|
<div class="message-content-assistant select-text text-sm leading-relaxed" use:bubbleScrollPadding>
|
|
1743
2201
|
{#if reply.messageContent}
|
|
1744
2202
|
{#if hasCodeBlocks(reply.messageContent)}
|
|
@@ -1804,6 +2262,20 @@
|
|
|
1804
2262
|
{/if}
|
|
1805
2263
|
{/if}
|
|
1806
2264
|
{/each}
|
|
2265
|
+
{#if assistant.showDoneLine}
|
|
2266
|
+
<!-- The first line of the turn (no thinking or code above it) is as tall as the small avatar, like every first line -->
|
|
2267
|
+
{@const doneLineHasModulesAbove =
|
|
2268
|
+
!!assistant.finished &&
|
|
2269
|
+
(finishedModulesView(assistant.finished).showThinking || finishedModulesView(assistant.finished).showCode)}
|
|
2270
|
+
<p
|
|
2271
|
+
class="text-body text-foreground {doneLineHasModulesAbove ? '' : 'flex min-h-7 items-center'}"
|
|
2272
|
+
data-testid="agent-conclusion"
|
|
2273
|
+
>
|
|
2274
|
+
{$t('chat.generation.doneMessage')}
|
|
2275
|
+
</p>
|
|
2276
|
+
{/if}
|
|
2277
|
+
</AgentTurn>
|
|
2278
|
+
{/if}
|
|
1807
2279
|
|
|
1808
2280
|
<!-- Copy, regenerate and the two thumbs: at the end of the last message only, and not while something is being generated.
|
|
1809
2281
|
Not in the panel either: the creator page's chat panel (Figma 526:2706, ready) draws no row of actions under the last message. -->
|
|
@@ -1828,6 +2300,60 @@
|
|
|
1828
2300
|
</div>
|
|
1829
2301
|
{/each}
|
|
1830
2302
|
|
|
2303
|
+
<!-- The assistant while it works: its face (large while it waits, small once its thoughts or its code stream) and, to its
|
|
2304
|
+
right, the parts of its work one under the other, each with its own words: the plan, "Thinking…", "Writing code…". When it is done the face is
|
|
2305
|
+
drawn again under the turn it answered, grown into the conclusion. The offset keeps the face where that turn will put it
|
|
2306
|
+
(the turn spaces its reply closer than the list spaces a turn from the next). -->
|
|
2307
|
+
{#if thinkingHold && assistantIsWorking}
|
|
2308
|
+
<!-- (The wrapper is what the list sees grow: keepEndInView keeps the end of the list in view while the turn changes size.) -->
|
|
2309
|
+
<div class="loading-indicator-ct {panelLayout ? 'mt-9 pb-3' : '-mt-3'}" use:keepEndInView>
|
|
2310
|
+
<AgentTurn look={liveLook} {renderAgentAvatar}>
|
|
2311
|
+
{#if planCardView}
|
|
2312
|
+
<PlanCard
|
|
2313
|
+
class="w-full"
|
|
2314
|
+
dir="auto"
|
|
2315
|
+
role="region"
|
|
2316
|
+
aria-label={$t('chat.plan.regionLabel')}
|
|
2317
|
+
title={planCardView.title}
|
|
2318
|
+
tasks={planCardView.tasks}
|
|
2319
|
+
progressCurrent={planCardView.progressCurrent}
|
|
2320
|
+
progressTotal={planCardView.progressTotal}
|
|
2321
|
+
visibleTaskCount={4}
|
|
2322
|
+
messages={planCardMessages}
|
|
2323
|
+
/>
|
|
2324
|
+
{/if}
|
|
2325
|
+
{#if liveModules.showShimmer}
|
|
2326
|
+
<div class="thinking-bubble relative flex min-h-7 w-fit items-center whitespace-nowrap text-sm">
|
|
2327
|
+
<span class="thinking-sizer" aria-hidden="true">{thinkingLabel}</span>
|
|
2328
|
+
<span class="thinking-reveal absolute inset-0 flex items-center">{shownThinkingLabel}</span>
|
|
2329
|
+
</div>
|
|
2330
|
+
{/if}
|
|
2331
|
+
{#if liveModules.showThinking}
|
|
2332
|
+
<GenerationModule
|
|
2333
|
+
kind="thinking"
|
|
2334
|
+
text={keptThinkingText}
|
|
2335
|
+
streaming={liveModules.thinkingStreaming}
|
|
2336
|
+
seconds={frozenThoughtSeconds}
|
|
2337
|
+
openByDefault={liveModules.thinkingOpenByDefault}
|
|
2338
|
+
/>
|
|
2339
|
+
{/if}
|
|
2340
|
+
{#if liveModules.showCode && shownGenerationText}
|
|
2341
|
+
<GenerationModule
|
|
2342
|
+
kind="code"
|
|
2343
|
+
text={shownGenerationText}
|
|
2344
|
+
streaming={liveModules.codeStreaming}
|
|
2345
|
+
openByDefault={liveModules.codeOpenByDefault}
|
|
2346
|
+
/>
|
|
2347
|
+
{/if}
|
|
2348
|
+
{#if generationAriaLine}
|
|
2349
|
+
<p class="sr-only" aria-live="polite">{generationAriaLine}</p>
|
|
2350
|
+
{/if}
|
|
2351
|
+
</AgentTurn>
|
|
2352
|
+
</div>
|
|
2353
|
+
{/if}
|
|
2354
|
+
</div>
|
|
2355
|
+
</div>
|
|
2356
|
+
|
|
1831
2357
|
<!-- Loading indicator -->
|
|
1832
2358
|
{#if messages.length === 0 && isLoading}
|
|
1833
2359
|
<div class="loading-history-ct flex flex-1 items-center justify-center p-8">
|
|
@@ -1837,92 +2363,11 @@
|
|
|
1837
2363
|
</div>
|
|
1838
2364
|
</div>
|
|
1839
2365
|
{/if}
|
|
1840
|
-
{#if thinkingHold}
|
|
1841
|
-
<div class="loading-indicator-ct flex flex-col items-start gap-2 p-3">
|
|
1842
|
-
{#if planCardView}
|
|
1843
|
-
<PlanCard
|
|
1844
|
-
class="w-full"
|
|
1845
|
-
dir="auto"
|
|
1846
|
-
role="region"
|
|
1847
|
-
aria-label={$t('chat.plan.regionLabel')}
|
|
1848
|
-
title={planCardView.title}
|
|
1849
|
-
tasks={planCardView.tasks}
|
|
1850
|
-
progressCurrent={planCardView.progressCurrent}
|
|
1851
|
-
progressTotal={planCardView.progressTotal}
|
|
1852
|
-
visibleTaskCount={4}
|
|
1853
|
-
messages={planCardMessages}
|
|
1854
|
-
/>
|
|
1855
|
-
{/if}
|
|
1856
|
-
<ActivityRow
|
|
1857
|
-
class="w-full"
|
|
1858
|
-
label={shownThinkingLabel || $t('chat.generation.thinking')}
|
|
1859
|
-
status={activityPhase === 'code-only' || activityPhase === 'thinking-and-code' ? 'running' : 'pending'}
|
|
1860
|
-
/>
|
|
1861
|
-
<div
|
|
1862
|
-
class="generation-activity-card w-full max-w-full rounded-lg p-3 text-sm leading-relaxed shadow-sm"
|
|
1863
|
-
style="background-color: {MESSAGE_COLORS.ASSISTANT}; color: {MESSAGE_COLORS.ASSISTANT_TEXT}"
|
|
1864
|
-
>
|
|
1865
|
-
{#if activityPhase === 'shimmer-only'}
|
|
1866
|
-
<div class="thinking-bubble relative inline-block whitespace-nowrap">
|
|
1867
|
-
<span class="thinking-sizer" aria-hidden="true">{thinkingLabel}</span>
|
|
1868
|
-
<span class="thinking-reveal absolute inset-0 flex items-center">{shownThinkingLabel}</span>
|
|
1869
|
-
</div>
|
|
1870
|
-
{:else}
|
|
1871
|
-
{#if activityPhase === 'thinking-stream'}
|
|
1872
|
-
<div class="mb-2 flex items-center gap-2 font-medium">
|
|
1873
|
-
<div class="h-4 w-4 shrink-0 rounded-full border-2 border-gray-400 border-t-transparent animate-spin" aria-hidden="true"></div>
|
|
1874
|
-
<span class="thinking-reveal-inline">{$t('chat.generation.thinking')}</span>
|
|
1875
|
-
</div>
|
|
1876
|
-
<div
|
|
1877
|
-
bind:this={thinkingStreamEl}
|
|
1878
|
-
class="generation-thinking-stream max-h-32 w-full overflow-auto whitespace-pre-wrap break-words text-xs text-gray-600"
|
|
1879
|
-
dir="auto"
|
|
1880
|
-
>{keptThinkingText}</div>
|
|
1881
|
-
{:else if activityPhase === 'thinking-and-code' || activityPhase === 'code-only'}
|
|
1882
|
-
{#if keptThinkingText.trim().length > 0}
|
|
1883
|
-
<button
|
|
1884
|
-
type="button"
|
|
1885
|
-
class="thought-summary-btn mb-2 flex w-full items-center gap-2 text-start text-xs text-gray-600 underline-offset-2 hover:underline"
|
|
1886
|
-
aria-expanded={thinkingExpanded}
|
|
1887
|
-
onclick={() => { thinkingExpanded = !thinkingExpanded; }}
|
|
1888
|
-
>
|
|
1889
|
-
<span>
|
|
1890
|
-
{#if frozenThoughtSeconds != null}
|
|
1891
|
-
{$t('chat.generation.thoughtFor', { seconds: String(frozenThoughtSeconds) })}
|
|
1892
|
-
{:else}
|
|
1893
|
-
{$t('chat.generation.thinking')}
|
|
1894
|
-
{/if}
|
|
1895
|
-
</span>
|
|
1896
|
-
<span class="sr-only">
|
|
1897
|
-
{thinkingExpanded ? $t('chat.generation.collapseThought') : $t('chat.generation.expandThought')}
|
|
1898
|
-
</span>
|
|
1899
|
-
</button>
|
|
1900
|
-
{#if thinkingExpanded}
|
|
1901
|
-
<div
|
|
1902
|
-
class="generation-thinking-stream mb-2 max-h-24 w-full overflow-auto whitespace-pre-wrap break-words text-xs text-gray-600"
|
|
1903
|
-
dir="auto"
|
|
1904
|
-
>{keptThinkingText}</div>
|
|
1905
|
-
{/if}
|
|
1906
|
-
{/if}
|
|
1907
|
-
{#if shownGenerationText}
|
|
1908
|
-
<div class="mb-1 text-xs font-medium text-gray-800">
|
|
1909
|
-
<span>{$t('chat.generation.writingCode')}</span>
|
|
1910
|
-
</div>
|
|
1911
|
-
<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" dir="ltr">{shownGenerationText}</pre>
|
|
1912
|
-
{/if}
|
|
1913
|
-
{/if}
|
|
1914
|
-
{/if}
|
|
1915
|
-
</div>
|
|
1916
|
-
{#if generationAriaLine}
|
|
1917
|
-
<p class="sr-only" aria-live="polite">{generationAriaLine}</p>
|
|
1918
|
-
{/if}
|
|
1919
|
-
</div>
|
|
1920
|
-
{/if}
|
|
1921
2366
|
|
|
1922
|
-
{#if !
|
|
1923
|
-
<div class="sticky bottom-2 z-10 flex justify-center pb-1 pt-2">
|
|
2367
|
+
{#if !autoScroll && messages.length > 0 && !isLoading}
|
|
2368
|
+
<div class="sticky bottom-2 z-10 flex justify-center pb-1 pt-2 pointer-events-none [&_button]:pointer-events-auto">
|
|
1924
2369
|
<ScrollToBottom
|
|
1925
|
-
visible={
|
|
2370
|
+
visible={true}
|
|
1926
2371
|
label={$t('chat.messages.scrollToBottom')}
|
|
1927
2372
|
onScroll={() => {
|
|
1928
2373
|
autoScroll = true;
|
|
@@ -1966,38 +2411,13 @@
|
|
|
1966
2411
|
0% { background-position: 100% 0; }
|
|
1967
2412
|
100% { background-position: -100% 0; }
|
|
1968
2413
|
}
|
|
1969
|
-
.thinking-reveal-inline {
|
|
1970
|
-
background-image: linear-gradient(100deg, #1f2937 35%, #ffffff 50%, #1f2937 65%);
|
|
1971
|
-
background-size: 200% 100%;
|
|
1972
|
-
-webkit-background-clip: text;
|
|
1973
|
-
background-clip: text;
|
|
1974
|
-
color: transparent;
|
|
1975
|
-
animation: thinking-shine 1.6s linear infinite;
|
|
1976
|
-
}
|
|
1977
2414
|
@media (prefers-reduced-motion: reduce) {
|
|
1978
|
-
.thinking-reveal
|
|
1979
|
-
.thinking-reveal-inline {
|
|
2415
|
+
.thinking-reveal {
|
|
1980
2416
|
animation: none;
|
|
1981
2417
|
color: inherit;
|
|
1982
2418
|
background-image: none;
|
|
1983
2419
|
}
|
|
1984
2420
|
}
|
|
1985
|
-
.generation-stream {
|
|
1986
|
-
scrollbar-width: thin;
|
|
1987
|
-
scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
|
|
1988
|
-
}
|
|
1989
|
-
.generation-stream::-webkit-scrollbar {
|
|
1990
|
-
width: 8px;
|
|
1991
|
-
height: 8px;
|
|
1992
|
-
background: transparent;
|
|
1993
|
-
}
|
|
1994
|
-
.generation-stream::-webkit-scrollbar-track {
|
|
1995
|
-
background: transparent;
|
|
1996
|
-
}
|
|
1997
|
-
.generation-stream::-webkit-scrollbar-thumb {
|
|
1998
|
-
background: rgba(255, 255, 255, 0.35);
|
|
1999
|
-
border-radius: 4px;
|
|
2000
|
-
}
|
|
2001
2421
|
.loading {
|
|
2002
2422
|
opacity: 0.75;
|
|
2003
2423
|
}
|