@lvce-editor/chat-view 6.64.0 → 6.66.0
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/chatViewWorkerMain.js +237 -21
- package/package.json +1 -1
|
@@ -1865,13 +1865,19 @@ const StartConversationByTypingBelow = 'Start a conversation by typing below.';
|
|
|
1865
1865
|
const NoMatchingModelsFound = 'No matching models have been found.';
|
|
1866
1866
|
const ComposePlaceholder = 'Type your message. Enter to send.';
|
|
1867
1867
|
const AttachImageAsContext = 'Attach Image as Context';
|
|
1868
|
-
const
|
|
1868
|
+
const OpenImageInNewTab = 'Open image in new tab';
|
|
1869
|
+
const RemoveAttachment = 'Remove attachment';
|
|
1869
1870
|
const ImageCouldNotBeLoaded = 'image could not be loaded';
|
|
1870
1871
|
const OpenRouterApiKeyPlaceholder = 'Enter OpenRouter API key';
|
|
1871
1872
|
const OpenApiApiKeyPlaceholder = 'Enter OpenAI API key';
|
|
1872
1873
|
const SendMessage = 'Send message';
|
|
1873
1874
|
const StartVoiceDictation = 'Start voice dictation';
|
|
1874
1875
|
const AddContext$1 = 'Add Context';
|
|
1876
|
+
const AddAction = 'Add Action';
|
|
1877
|
+
const OpenInVsCode = 'Open in VSCode';
|
|
1878
|
+
const Commit = 'Commit';
|
|
1879
|
+
const OpenTerminal = 'Open Terminal';
|
|
1880
|
+
const ShowDiff = 'Show Diff';
|
|
1875
1881
|
const CreatePullRequest$2 = 'Create PR';
|
|
1876
1882
|
const Save = 'Save';
|
|
1877
1883
|
const Saving = 'Saving...';
|
|
@@ -1960,8 +1966,11 @@ const composePlaceholder = () => {
|
|
|
1960
1966
|
const attachImageAsContext = () => {
|
|
1961
1967
|
return i18nString(AttachImageAsContext);
|
|
1962
1968
|
};
|
|
1963
|
-
const
|
|
1964
|
-
return i18nString(
|
|
1969
|
+
const openImageInNewTab = () => {
|
|
1970
|
+
return i18nString(OpenImageInNewTab);
|
|
1971
|
+
};
|
|
1972
|
+
const removeAttachment = () => {
|
|
1973
|
+
return i18nString(RemoveAttachment);
|
|
1965
1974
|
};
|
|
1966
1975
|
const imageCouldNotBeLoaded = () => {
|
|
1967
1976
|
return i18nString(ImageCouldNotBeLoaded);
|
|
@@ -1981,6 +1990,21 @@ const startVoiceDictation = () => {
|
|
|
1981
1990
|
const addContext = () => {
|
|
1982
1991
|
return i18nString(AddContext$1);
|
|
1983
1992
|
};
|
|
1993
|
+
const addAction = () => {
|
|
1994
|
+
return i18nString(AddAction);
|
|
1995
|
+
};
|
|
1996
|
+
const openInVsCode = () => {
|
|
1997
|
+
return i18nString(OpenInVsCode);
|
|
1998
|
+
};
|
|
1999
|
+
const commit = () => {
|
|
2000
|
+
return i18nString(Commit);
|
|
2001
|
+
};
|
|
2002
|
+
const openTerminal = () => {
|
|
2003
|
+
return i18nString(OpenTerminal);
|
|
2004
|
+
};
|
|
2005
|
+
const showDiff = () => {
|
|
2006
|
+
return i18nString(ShowDiff);
|
|
2007
|
+
};
|
|
1984
2008
|
const createPullRequest = () => {
|
|
1985
2009
|
return i18nString(CreatePullRequest$2);
|
|
1986
2010
|
};
|
|
@@ -3245,6 +3269,24 @@ const getKeyBindings = () => {
|
|
|
3245
3269
|
}];
|
|
3246
3270
|
};
|
|
3247
3271
|
|
|
3272
|
+
const getMenuEntriesChatAttachment = (attachmentId, previewSrc) => {
|
|
3273
|
+
return [{
|
|
3274
|
+
args: [previewSrc],
|
|
3275
|
+
command: 'Chat.openChatAttachmentInNewTab',
|
|
3276
|
+
flags: None,
|
|
3277
|
+
id: 'openImageInNewTab',
|
|
3278
|
+
// @ts-ignore
|
|
3279
|
+
label: openImageInNewTab()
|
|
3280
|
+
}, {
|
|
3281
|
+
args: [attachmentId],
|
|
3282
|
+
command: 'Chat.removeComposerAttachment',
|
|
3283
|
+
flags: None,
|
|
3284
|
+
id: 'removeAttachment',
|
|
3285
|
+
// @ts-ignore
|
|
3286
|
+
label: removeAttachment()
|
|
3287
|
+
}];
|
|
3288
|
+
};
|
|
3289
|
+
|
|
3248
3290
|
const getMenuEntriesChatHeader = () => {
|
|
3249
3291
|
// TODO
|
|
3250
3292
|
return [{
|
|
@@ -3304,10 +3346,16 @@ const Composer = 'composer';
|
|
|
3304
3346
|
const Search = 'search';
|
|
3305
3347
|
const ComposerDropTarget = 'composer-drop-target';
|
|
3306
3348
|
const ComposerAttachmentPrefix = 'composer-attachment:';
|
|
3349
|
+
const ComposerAttachmentPreviewPrefix = 'composer-attachment-preview:';
|
|
3307
3350
|
const ComposerAttachmentRemovePrefix = 'composer-attachment-remove:';
|
|
3308
3351
|
const AddContext = 'add-context';
|
|
3309
3352
|
const Dictate = 'dictate';
|
|
3310
3353
|
const CreatePullRequest$1 = 'create-pull-request';
|
|
3354
|
+
const FocusAddAction = 'focus-add-action';
|
|
3355
|
+
const FocusOpenInVsCode = 'focus-open-in-vscode';
|
|
3356
|
+
const FocusCommit = 'focus-commit';
|
|
3357
|
+
const FocusOpenTerminal = 'focus-open-terminal';
|
|
3358
|
+
const FocusShowDiff = 'focus-show-diff';
|
|
3311
3359
|
const Send = 'send';
|
|
3312
3360
|
const Back = 'back';
|
|
3313
3361
|
const ModelPickerToggle = 'model-picker-toggle';
|
|
@@ -3377,6 +3425,12 @@ const getComposerAttachmentInputName = attachmentId => {
|
|
|
3377
3425
|
const getComposerAttachmentRemoveInputName = attachmentId => {
|
|
3378
3426
|
return `${ComposerAttachmentRemovePrefix}${attachmentId}`;
|
|
3379
3427
|
};
|
|
3428
|
+
const isComposerAttachmentPreviewInputName = name => {
|
|
3429
|
+
return name.startsWith(ComposerAttachmentPreviewPrefix);
|
|
3430
|
+
};
|
|
3431
|
+
const getAttachmentIdFromComposerAttachmentPreviewInputName = name => {
|
|
3432
|
+
return name.slice(ComposerAttachmentPreviewPrefix.length);
|
|
3433
|
+
};
|
|
3380
3434
|
const isComposerAttachmentRemoveInputName = name => {
|
|
3381
3435
|
return name.startsWith(ComposerAttachmentRemovePrefix);
|
|
3382
3436
|
};
|
|
@@ -3452,12 +3506,15 @@ const MenuChatHeader = 2179;
|
|
|
3452
3506
|
const MenuChatInput = 2180;
|
|
3453
3507
|
const MenuProjectAddButton = 2181;
|
|
3454
3508
|
const MenuChatProjectList = 2182;
|
|
3509
|
+
const MenuChatAttachment = 2183;
|
|
3455
3510
|
const getMenuEntryIds = () => {
|
|
3456
|
-
return [Chat$2, MenuChatList, MenuChatHeader, MenuChatInput, MenuProjectAddButton, MenuChatProjectList];
|
|
3511
|
+
return [Chat$2, MenuChatList, MenuChatHeader, MenuChatInput, MenuProjectAddButton, MenuChatProjectList, MenuChatAttachment];
|
|
3457
3512
|
};
|
|
3458
3513
|
|
|
3459
3514
|
const getMenuEntries = (menuId, props) => {
|
|
3460
3515
|
switch (props.menuId) {
|
|
3516
|
+
case MenuChatAttachment:
|
|
3517
|
+
return getMenuEntriesChatAttachment(props.attachmentId, props.previewSrc);
|
|
3461
3518
|
case MenuChatHeader:
|
|
3462
3519
|
return getMenuEntriesChatHeader();
|
|
3463
3520
|
case MenuChatInput:
|
|
@@ -6500,6 +6557,9 @@ const Chat = 'Chat';
|
|
|
6500
6557
|
const ChatActions = 'ChatActions';
|
|
6501
6558
|
const ChatAuthError = 'ChatAuthError';
|
|
6502
6559
|
const ChatFocus = 'ChatFocus';
|
|
6560
|
+
const ChatFocusActions = 'ChatFocusActions';
|
|
6561
|
+
const ChatFocusHeader = 'ChatFocusHeader';
|
|
6562
|
+
const ChatFocusProject = 'ChatFocusProject';
|
|
6503
6563
|
const ChatHeader = 'ChatHeader';
|
|
6504
6564
|
const ChatHeaderLabel = 'ChatHeaderLabel';
|
|
6505
6565
|
const ChatInputBox = 'ChatInputBox';
|
|
@@ -6528,6 +6588,7 @@ const ChatOverlays = 'ChatOverlays';
|
|
|
6528
6588
|
const ChatOrderedList = 'ChatOrderedList';
|
|
6529
6589
|
const ChatOrderedListItem = 'ChatOrderedListItem';
|
|
6530
6590
|
const ChatOrderedListItemContent = 'ChatOrderedListItemContent';
|
|
6591
|
+
const ChatOrderedListItemPrefix = 'ChatOrderedListItemPrefix';
|
|
6531
6592
|
const ChatOrderedListMarker = 'ChatOrderedListMarker';
|
|
6532
6593
|
const ChatComposerAttachment = 'ChatComposerAttachment';
|
|
6533
6594
|
const ChatComposerAttachmentImage = 'ChatComposerAttachmentImage';
|
|
@@ -8979,7 +9040,8 @@ const handleRemoveComposerAttachment = async (state, attachmentId) => {
|
|
|
8979
9040
|
}
|
|
8980
9041
|
return {
|
|
8981
9042
|
...state,
|
|
8982
|
-
composerAttachments: nextComposerAttachments
|
|
9043
|
+
composerAttachments: nextComposerAttachments,
|
|
9044
|
+
composerAttachmentsHeight: getComposerAttachmentsHeight(nextComposerAttachments, state.width)
|
|
8983
9045
|
};
|
|
8984
9046
|
};
|
|
8985
9047
|
|
|
@@ -9423,7 +9485,23 @@ const handleClickSettings = async () => {
|
|
|
9423
9485
|
await invoke('Main.openUri', 'app://settings.json');
|
|
9424
9486
|
};
|
|
9425
9487
|
|
|
9426
|
-
const handleContextMenuChatImageAttachment = async state => {
|
|
9488
|
+
const handleContextMenuChatImageAttachment = async (state, name, eventX, eventY) => {
|
|
9489
|
+
const getFallbackAttachment = () => {
|
|
9490
|
+
const attachmentsWithPreview = state.composerAttachments.filter(attachment => attachment.previewSrc);
|
|
9491
|
+
if (attachmentsWithPreview.length !== 1) {
|
|
9492
|
+
return undefined;
|
|
9493
|
+
}
|
|
9494
|
+
return attachmentsWithPreview[0];
|
|
9495
|
+
};
|
|
9496
|
+
const attachment = isComposerAttachmentPreviewInputName(name) ? state.composerAttachments.find(item => item.attachmentId === getAttachmentIdFromComposerAttachmentPreviewInputName(name)) : getFallbackAttachment();
|
|
9497
|
+
if (!attachment?.previewSrc) {
|
|
9498
|
+
return state;
|
|
9499
|
+
}
|
|
9500
|
+
await showContextMenu2(state.uid, MenuChatAttachment, eventX, eventY, {
|
|
9501
|
+
attachmentId: attachment.attachmentId,
|
|
9502
|
+
menuId: MenuChatAttachment,
|
|
9503
|
+
previewSrc: attachment.previewSrc
|
|
9504
|
+
});
|
|
9427
9505
|
return state;
|
|
9428
9506
|
};
|
|
9429
9507
|
|
|
@@ -10672,6 +10750,10 @@ const registerMockResponse = (state, mockResponse) => {
|
|
|
10672
10750
|
return state;
|
|
10673
10751
|
};
|
|
10674
10752
|
|
|
10753
|
+
const removeComposerAttachment = async (state, attachmentId) => {
|
|
10754
|
+
return handleRemoveComposerAttachment(state, attachmentId);
|
|
10755
|
+
};
|
|
10756
|
+
|
|
10675
10757
|
const getCss = (composerHeight, composerAttachmentsHeight, modelPickerHeight, listItemHeight, chatMessageFontSize, chatMessageLineHeight, chatMessageFontFamily, chatFocusContentMaxWidth, textAreaPaddingTop, textAreaPaddingLeft, textAreaPaddingRight, textAreaPaddingBottom, chatSendAreaPaddingTop, chatSendAreaPaddingLeft, chatSendAreaPaddingRight, chatSendAreaPaddingBottom, renderHtmlCss) => {
|
|
10676
10758
|
const buttonsHeight = 20;
|
|
10677
10759
|
const gap = 10;
|
|
@@ -10791,6 +10873,10 @@ const getCss = (composerHeight, composerAttachmentsHeight, modelPickerHeight, li
|
|
|
10791
10873
|
pointer-events: auto;
|
|
10792
10874
|
}
|
|
10793
10875
|
|
|
10876
|
+
.ChatViewDropOverlayActive{
|
|
10877
|
+
background: rgba(255, 255, 255, 0.1);
|
|
10878
|
+
}
|
|
10879
|
+
|
|
10794
10880
|
.RunModePickerPopOver{
|
|
10795
10881
|
overflow: hidden;
|
|
10796
10882
|
border: 1px solid var(--vscode-widget-border, var(--vscode-panel-border));
|
|
@@ -10803,6 +10889,26 @@ const getCss = (composerHeight, composerAttachmentsHeight, modelPickerHeight, li
|
|
|
10803
10889
|
color: var(--vscode-textLink-foreground);
|
|
10804
10890
|
}
|
|
10805
10891
|
|
|
10892
|
+
.ChatOrderedListItem{
|
|
10893
|
+
align-items: flex-start;
|
|
10894
|
+
display: flex;
|
|
10895
|
+
gap: 8px;
|
|
10896
|
+
}
|
|
10897
|
+
|
|
10898
|
+
.ChatOrderedListMarker{
|
|
10899
|
+
flex: none;
|
|
10900
|
+
min-width: 1.5em;
|
|
10901
|
+
}
|
|
10902
|
+
|
|
10903
|
+
.ChatOrderedListItemContent{
|
|
10904
|
+
flex: 1;
|
|
10905
|
+
min-width: 0;
|
|
10906
|
+
}
|
|
10907
|
+
|
|
10908
|
+
.ChatOrderedListItemPrefix{
|
|
10909
|
+
white-space: nowrap;
|
|
10910
|
+
}
|
|
10911
|
+
|
|
10806
10912
|
.ChatToolCalls .ChatOrderedList{
|
|
10807
10913
|
list-style: none;
|
|
10808
10914
|
margin: 0;
|
|
@@ -10825,6 +10931,15 @@ const getCss = (composerHeight, composerAttachmentsHeight, modelPickerHeight, li
|
|
|
10825
10931
|
min-width: 0;
|
|
10826
10932
|
}
|
|
10827
10933
|
|
|
10934
|
+
.ChatFocus .ChatMessages > .Message{
|
|
10935
|
+
inline-size: fit-content;
|
|
10936
|
+
max-inline-size: min(100%, var(--ChatFocusContentMaxWidth));
|
|
10937
|
+
}
|
|
10938
|
+
|
|
10939
|
+
.ChatFocus .ChatMessages > .Message > .ChatMessageContent{
|
|
10940
|
+
max-inline-size: 100%;
|
|
10941
|
+
}
|
|
10942
|
+
|
|
10828
10943
|
`;
|
|
10829
10944
|
return `${baseCss}
|
|
10830
10945
|
|
|
@@ -11218,16 +11333,13 @@ const getComposerAttachmentClassName = displayType => {
|
|
|
11218
11333
|
}
|
|
11219
11334
|
};
|
|
11220
11335
|
const getComposerAttachmentRemoveButtonDom = attachment => {
|
|
11221
|
-
if (attachment.displayType !== 'image') {
|
|
11222
|
-
return [];
|
|
11223
|
-
}
|
|
11224
11336
|
return [{
|
|
11225
11337
|
buttonType: 'button',
|
|
11226
11338
|
childCount: 1,
|
|
11227
11339
|
className: ChatComposerAttachmentRemoveButton,
|
|
11228
11340
|
name: getComposerAttachmentRemoveInputName(attachment.attachmentId),
|
|
11229
11341
|
onClick: HandleClick,
|
|
11230
|
-
title:
|
|
11342
|
+
title: removeAttachment(),
|
|
11231
11343
|
type: Button$1
|
|
11232
11344
|
}, {
|
|
11233
11345
|
text: 'x',
|
|
@@ -11242,6 +11354,8 @@ const getComposerAttachmentPreviewDom = attachment => {
|
|
|
11242
11354
|
alt: `Image preview for ${attachment.name}`,
|
|
11243
11355
|
childCount: 0,
|
|
11244
11356
|
className: ChatComposerAttachmentPreview,
|
|
11357
|
+
name: getComposerAttachmentInputName(attachment.attachmentId),
|
|
11358
|
+
onContextMenu: HandleContextMenuChatImageAttachment,
|
|
11245
11359
|
src: attachment.previewSrc,
|
|
11246
11360
|
type: Img
|
|
11247
11361
|
}];
|
|
@@ -11317,6 +11431,57 @@ const getChatSendAreaDom = (composerValue, composerAttachments, agentMode, agent
|
|
|
11317
11431
|
}, ...(showAgentModePicker ? getAgentModePickerVirtualDom(agentMode, agentModePickerOpen) : []), ...getChatModelPickerToggleVirtualDom(models, selectedModelId, modelPickerOpen), ...(reasoningPickerEnabled ? getReasoningEffortPickerVirtualDom(reasoningEffort, reasoningEffortPickerOpen) : []), ...(showResponsiveRunModePicker ? getRunModePickerVirtualDom(runMode, runModePickerOpen) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...(showCreatePullRequestButton ? getCreatePullRequestButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
|
|
11318
11432
|
};
|
|
11319
11433
|
|
|
11434
|
+
const focusHeaderStyle = 'align-items:center;border-bottom:1px solid var(--vscode-panel-border, transparent);display:flex;gap:12px;justify-content:space-between;padding:8px 12px;';
|
|
11435
|
+
const focusHeaderMetaStyle = 'align-items:baseline;display:flex;gap:8px;min-width:0;overflow:hidden;';
|
|
11436
|
+
const focusHeaderTitleStyle = 'margin:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;';
|
|
11437
|
+
const focusHeaderProjectStyle = 'overflow:hidden;text-overflow:ellipsis;white-space:nowrap;';
|
|
11438
|
+
const focusHeaderActionsStyle = 'display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;';
|
|
11439
|
+
const focusHeaderButtonStyle = 'white-space:nowrap;';
|
|
11440
|
+
const getFocusHeaderActionButtonDom = (label, name) => {
|
|
11441
|
+
return [{
|
|
11442
|
+
childCount: 1,
|
|
11443
|
+
className: mergeClassNames(Button, ButtonSecondary),
|
|
11444
|
+
inputType: 'button',
|
|
11445
|
+
name,
|
|
11446
|
+
onClick: HandleClick,
|
|
11447
|
+
style: focusHeaderButtonStyle,
|
|
11448
|
+
title: label,
|
|
11449
|
+
type: Button$1
|
|
11450
|
+
}, text(label)];
|
|
11451
|
+
};
|
|
11452
|
+
const getChatHeaderDomFocusMode = (selectedSessionTitle, selectedProjectName) => {
|
|
11453
|
+
const items = [[addAction(), FocusAddAction], [openInVsCode(), FocusOpenInVsCode], [commit(), FocusCommit], [openTerminal(), FocusOpenTerminal], [showDiff(), FocusShowDiff]];
|
|
11454
|
+
const hasProjectName = !!selectedProjectName;
|
|
11455
|
+
return [{
|
|
11456
|
+
childCount: 2,
|
|
11457
|
+
className: ChatFocusHeader,
|
|
11458
|
+
style: focusHeaderStyle,
|
|
11459
|
+
type: Header
|
|
11460
|
+
}, {
|
|
11461
|
+
childCount: hasProjectName ? 2 : 1,
|
|
11462
|
+
className: ChatName,
|
|
11463
|
+
style: focusHeaderMetaStyle,
|
|
11464
|
+
type: Div
|
|
11465
|
+
}, {
|
|
11466
|
+
childCount: 1,
|
|
11467
|
+
className: ChatHeaderLabel,
|
|
11468
|
+
style: focusHeaderTitleStyle,
|
|
11469
|
+
type: H2
|
|
11470
|
+
}, text(selectedSessionTitle), ...(hasProjectName ? [{
|
|
11471
|
+
childCount: 1,
|
|
11472
|
+
className: mergeClassNames(LabelDetail, ChatFocusProject),
|
|
11473
|
+
style: focusHeaderProjectStyle,
|
|
11474
|
+
type: Span
|
|
11475
|
+
}, text(selectedProjectName)] : []), {
|
|
11476
|
+
'aria-label': 'focus header actions',
|
|
11477
|
+
childCount: items.length,
|
|
11478
|
+
className: ChatFocusActions,
|
|
11479
|
+
role: ToolBar,
|
|
11480
|
+
style: focusHeaderActionsStyle,
|
|
11481
|
+
type: Div
|
|
11482
|
+
}, ...items.flatMap(([label, name]) => getFocusHeaderActionButtonDom(label, name))];
|
|
11483
|
+
};
|
|
11484
|
+
|
|
11320
11485
|
const getCustomSelectPopOverVirtualDom = (optionCount, height, optionNodes, containerClassName = '', popOverClassName = '') => {
|
|
11321
11486
|
return [{
|
|
11322
11487
|
childCount: 1,
|
|
@@ -11616,24 +11781,69 @@ const getHeadingDom = (node, useChatMathWorker) => {
|
|
|
11616
11781
|
}, ...node.children.flatMap(child => getInlineNodeDom(child, useChatMathWorker))];
|
|
11617
11782
|
};
|
|
11618
11783
|
|
|
11784
|
+
const leadingPunctuationRegex = /^([:;,.!?]+)([\s\S]*)$/;
|
|
11785
|
+
const splitLeadingPunctuation = children => {
|
|
11786
|
+
const [firstChild, secondChild, ...restChildren] = children;
|
|
11787
|
+
if (firstChild?.type !== 'bold' || secondChild?.type !== 'text') {
|
|
11788
|
+
return {
|
|
11789
|
+
prefixChildren: [],
|
|
11790
|
+
remainingChildren: children
|
|
11791
|
+
};
|
|
11792
|
+
}
|
|
11793
|
+
const match = secondChild.text.match(leadingPunctuationRegex);
|
|
11794
|
+
if (!match) {
|
|
11795
|
+
return {
|
|
11796
|
+
prefixChildren: [],
|
|
11797
|
+
remainingChildren: children
|
|
11798
|
+
};
|
|
11799
|
+
}
|
|
11800
|
+
const [, punctuation, remainingText] = match;
|
|
11801
|
+
const nextChildren = restChildren;
|
|
11802
|
+
if (remainingText) {
|
|
11803
|
+
nextChildren.unshift({
|
|
11804
|
+
text: remainingText,
|
|
11805
|
+
type: 'text'
|
|
11806
|
+
});
|
|
11807
|
+
}
|
|
11808
|
+
return {
|
|
11809
|
+
prefixChildren: [firstChild, {
|
|
11810
|
+
text: punctuation,
|
|
11811
|
+
type: 'text'
|
|
11812
|
+
}],
|
|
11813
|
+
remainingChildren: nextChildren
|
|
11814
|
+
};
|
|
11815
|
+
};
|
|
11619
11816
|
const getOrderedListItemDom = (item, useChatMathWorker, fallbackIndex, recurseOrdered, recurseUnordered) => {
|
|
11620
11817
|
const hasNestedList = (item.nestedItems?.length || 0) > 0;
|
|
11621
11818
|
const nestedListType = item.nestedListType || 'unordered-list';
|
|
11819
|
+
const {
|
|
11820
|
+
prefixChildren,
|
|
11821
|
+
remainingChildren
|
|
11822
|
+
} = splitLeadingPunctuation(item.children);
|
|
11622
11823
|
const nestedListDom = hasNestedList ? [{
|
|
11623
11824
|
childCount: item.nestedItems?.length || 0,
|
|
11624
11825
|
className: nestedListType === 'ordered-list' ? ChatOrderedList : ChatUnorderedList,
|
|
11625
11826
|
type: nestedListType === 'ordered-list' ? Ol : Ul
|
|
11626
11827
|
}, ...(item.nestedItems || []).flatMap((nestedItem, index) => nestedListType === 'ordered-list' ? recurseOrdered(nestedItem, useChatMathWorker, index + 1) : recurseUnordered(nestedItem, useChatMathWorker))] : [];
|
|
11627
11828
|
const marker = `${item.index ?? fallbackIndex}.`;
|
|
11829
|
+
const prefixDom = prefixChildren.length === 0 ? [] : [{
|
|
11830
|
+
childCount: prefixChildren.length,
|
|
11831
|
+
className: ChatOrderedListItemPrefix,
|
|
11832
|
+
type: Span
|
|
11833
|
+
}, ...prefixChildren.flatMap(child => getInlineNodeDom(child, useChatMathWorker))];
|
|
11628
11834
|
return [{
|
|
11629
|
-
childCount:
|
|
11835
|
+
childCount: 2,
|
|
11630
11836
|
className: ChatOrderedListItem,
|
|
11631
11837
|
type: Li
|
|
11632
11838
|
}, {
|
|
11633
11839
|
childCount: 1,
|
|
11634
11840
|
className: ChatOrderedListMarker,
|
|
11635
11841
|
type: Span
|
|
11636
|
-
}, text(marker),
|
|
11842
|
+
}, text(marker), {
|
|
11843
|
+
childCount: (prefixDom.length === 0 ? 0 : 1) + remainingChildren.length + (hasNestedList ? 1 : 0),
|
|
11844
|
+
className: ChatOrderedListItemContent,
|
|
11845
|
+
type: Div
|
|
11846
|
+
}, ...prefixDom, ...remainingChildren.flatMap(child => getInlineNodeDom(child, useChatMathWorker)), ...nestedListDom];
|
|
11637
11847
|
};
|
|
11638
11848
|
|
|
11639
11849
|
const getTableHeadCellDom = (cell, useChatMathWorker) => {
|
|
@@ -12839,24 +13049,26 @@ const getMessagesDom = (messages, parsedMessages, openRouterApiKeyInput, openApi
|
|
|
12839
13049
|
className: 'ChatMessages',
|
|
12840
13050
|
onContextMenu: HandleMessagesContextMenu,
|
|
12841
13051
|
onScroll: HandleMessagesScroll,
|
|
13052
|
+
role: 'log',
|
|
12842
13053
|
scrollTop: messagesScrollTop,
|
|
12843
13054
|
type: Div
|
|
12844
13055
|
}, ...displayMessages.flatMap(item => getChatMessageDom(item.message, item.parsedContent, openRouterApiKeyInput, openApiApiKeyInput, openApiApiKeyState, openApiApiKeysSettingsUrl, openApiApiKeyInputPattern, openRouterApiKeyState, useChatMathWorker))];
|
|
12845
13056
|
};
|
|
12846
13057
|
|
|
13058
|
+
const arrowLeft$1 = {
|
|
13059
|
+
childCount: 0,
|
|
13060
|
+
className: mergeClassNames(MaskIcon, MaskIconArrowLeft),
|
|
13061
|
+
type: Div
|
|
13062
|
+
};
|
|
12847
13063
|
const getBackToChatsButtonDom = () => {
|
|
12848
13064
|
return [{
|
|
12849
13065
|
childCount: 1,
|
|
12850
|
-
className:
|
|
12851
|
-
inputType: 'button',
|
|
13066
|
+
className: IconButton,
|
|
12852
13067
|
name: Back,
|
|
12853
13068
|
onClick: HandleClickBack,
|
|
12854
13069
|
title: backToChatList(),
|
|
12855
13070
|
type: Button$1
|
|
12856
|
-
},
|
|
12857
|
-
text: backToChatList(),
|
|
12858
|
-
type: Text
|
|
12859
|
-
}];
|
|
13071
|
+
}, arrowLeft$1];
|
|
12860
13072
|
};
|
|
12861
13073
|
|
|
12862
13074
|
const getProjectSessionDom = (session, selectedSessionId) => {
|
|
@@ -12999,21 +13211,24 @@ const getChatModeChatFocusVirtualDom = ({
|
|
|
12999
13211
|
voiceDictationEnabled = false
|
|
13000
13212
|
}) => {
|
|
13001
13213
|
const selectedSession = sessions.find(session => session.id === selectedSessionId);
|
|
13214
|
+
const selectedProject = projects.find(project => project.id === selectedProjectId);
|
|
13002
13215
|
const messages = selectedSession ? selectedSession.messages : [];
|
|
13216
|
+
const selectedSessionTitle = selectedSession?.title || chatTitle();
|
|
13217
|
+
const selectedProjectName = selectedProject?.name || '';
|
|
13003
13218
|
const showCreatePullRequestButton = canCreatePullRequest(selectedSession);
|
|
13004
13219
|
const isDropOverlayVisible = composerDropEnabled && composerDropActive;
|
|
13005
13220
|
const isAgentModePickerVisible = hasSpaceForAgentModePicker && agentModePickerOpen;
|
|
13006
13221
|
const isNewModelPickerVisible = modelPickerOpen;
|
|
13007
13222
|
const isRunModePickerVisible = showRunMode && hasSpaceForRunModePicker && runModePickerOpen;
|
|
13008
13223
|
const hasVisibleOverlays = isDropOverlayVisible || isAgentModePickerVisible || isNewModelPickerVisible || isRunModePickerVisible;
|
|
13009
|
-
const chatRootChildCount =
|
|
13224
|
+
const chatRootChildCount = 4 + (hasVisibleOverlays ? 1 : 0);
|
|
13010
13225
|
return [{
|
|
13011
13226
|
childCount: chatRootChildCount,
|
|
13012
13227
|
className: mergeClassNames(Viewlet, Chat, ChatFocus),
|
|
13013
13228
|
onDragEnter: HandleDragEnterChatView,
|
|
13014
13229
|
onDragOver: HandleDragOverChatView,
|
|
13015
13230
|
type: Div
|
|
13016
|
-
}, ...getProjectListDom(projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop, true), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openApiApiKeyState, openApiApiKeysSettingsUrl, openApiApiKeyInputPattern, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, composerAttachments, agentMode, agentModePickerOpen, hasSpaceForAgentModePicker, modelPickerOpen, models, selectedModelId, reasoningPickerEnabled, reasoningEffort, reasoningEffortPickerOpen, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, hasSpaceForRunModePicker, runMode, runModePickerOpen, todoListToolEnabled, todoListItems, showCreatePullRequestButton, voiceDictationEnabled), ...getChatOverlaysVirtualDom({
|
|
13231
|
+
}, ...getProjectListDom(projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop, true), ...getChatHeaderDomFocusMode(selectedSessionTitle, selectedProjectName), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openApiApiKeyState, openApiApiKeysSettingsUrl, openApiApiKeyInputPattern, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, composerAttachments, agentMode, agentModePickerOpen, hasSpaceForAgentModePicker, modelPickerOpen, models, selectedModelId, reasoningPickerEnabled, reasoningEffort, reasoningEffortPickerOpen, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, hasSpaceForRunModePicker, runMode, runModePickerOpen, todoListToolEnabled, todoListItems, showCreatePullRequestButton, voiceDictationEnabled), ...getChatOverlaysVirtualDom({
|
|
13017
13232
|
agentMode,
|
|
13018
13233
|
agentModePickerVisible: isAgentModePickerVisible,
|
|
13019
13234
|
dropOverlayVisible: isDropOverlayVisible,
|
|
@@ -14081,7 +14296,7 @@ const renderEventListeners = () => {
|
|
|
14081
14296
|
params: ['handleModelInputBlur']
|
|
14082
14297
|
}, {
|
|
14083
14298
|
name: HandleContextMenuChatImageAttachment,
|
|
14084
|
-
params: ['handleContextMenuChatImageAttachment'],
|
|
14299
|
+
params: ['handleContextMenuChatImageAttachment', TargetName, ClientX, ClientY],
|
|
14085
14300
|
preventDefault: true
|
|
14086
14301
|
}];
|
|
14087
14302
|
};
|
|
@@ -14482,6 +14697,7 @@ const commandMap = {
|
|
|
14482
14697
|
'Chat.openRunModePicker': wrapCommand(openRunModePicker),
|
|
14483
14698
|
'Chat.pasteInput': wrapCommand(pasteInput),
|
|
14484
14699
|
'Chat.registerMockResponse': wrapCommand(registerMockResponse),
|
|
14700
|
+
'Chat.removeComposerAttachment': wrapCommand(removeComposerAttachment),
|
|
14485
14701
|
'Chat.render2': render2,
|
|
14486
14702
|
'Chat.renderEventListeners': renderEventListeners,
|
|
14487
14703
|
'Chat.rerender': wrapCommand(rerender),
|