@lvce-editor/chat-view 6.22.0 → 6.24.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 +353 -247
- package/package.json +1 -1
|
@@ -1197,9 +1197,7 @@ const Shift = 1 << 10 >>> 0;
|
|
|
1197
1197
|
|
|
1198
1198
|
const Chat$1 = 97;
|
|
1199
1199
|
|
|
1200
|
-
const Separator = 1;
|
|
1201
1200
|
const None = 0;
|
|
1202
|
-
const RestoreFocus = 6;
|
|
1203
1201
|
|
|
1204
1202
|
const ChatNetworkWorker = 6002;
|
|
1205
1203
|
const ChatToolWorker = 6005;
|
|
@@ -1593,7 +1591,7 @@ const chats = () => {
|
|
|
1593
1591
|
const newChat = () => {
|
|
1594
1592
|
return i18nString('New Chat');
|
|
1595
1593
|
};
|
|
1596
|
-
const addProject = () => {
|
|
1594
|
+
const addProject$1 = () => {
|
|
1597
1595
|
return i18nString('Add Project');
|
|
1598
1596
|
};
|
|
1599
1597
|
const debug = () => {
|
|
@@ -3079,22 +3077,12 @@ const getKeyBindings = () => {
|
|
|
3079
3077
|
};
|
|
3080
3078
|
|
|
3081
3079
|
const Copy = 'Copy';
|
|
3082
|
-
const CopyPath = 'Copy Path';
|
|
3083
|
-
const CopyRelativePath = 'Copy Relative Path';
|
|
3084
3080
|
const Cut = 'Cut';
|
|
3085
|
-
const Delete = 'Delete';
|
|
3086
|
-
const OpenContainingFolder = 'Open Containing Folder';
|
|
3087
|
-
const OpenInIntegratedTerminal = 'Open in integrated Terminal';
|
|
3088
3081
|
const Paste = 'Paste';
|
|
3089
3082
|
const Rename = 'Rename';
|
|
3090
3083
|
const Archive = 'Archive';
|
|
3084
|
+
const AddProject = 'Add Project...';
|
|
3091
3085
|
|
|
3092
|
-
const openContainingFolder = () => {
|
|
3093
|
-
return i18nString(OpenContainingFolder);
|
|
3094
|
-
};
|
|
3095
|
-
const openInIntegratedTerminal = () => {
|
|
3096
|
-
return i18nString(OpenInIntegratedTerminal);
|
|
3097
|
-
};
|
|
3098
3086
|
const cut = () => {
|
|
3099
3087
|
return i18nString(Cut);
|
|
3100
3088
|
};
|
|
@@ -3104,20 +3092,14 @@ const copy = () => {
|
|
|
3104
3092
|
const paste = () => {
|
|
3105
3093
|
return i18nString(Paste);
|
|
3106
3094
|
};
|
|
3107
|
-
const copyPath = () => {
|
|
3108
|
-
return i18nString(CopyPath);
|
|
3109
|
-
};
|
|
3110
|
-
const copyRelativePath = () => {
|
|
3111
|
-
return i18nString(CopyRelativePath);
|
|
3112
|
-
};
|
|
3113
3095
|
const rename = () => {
|
|
3114
3096
|
return i18nString(Rename);
|
|
3115
3097
|
};
|
|
3116
3098
|
const archive = () => {
|
|
3117
3099
|
return i18nString(Archive);
|
|
3118
3100
|
};
|
|
3119
|
-
const
|
|
3120
|
-
return i18nString(
|
|
3101
|
+
const addProject = () => {
|
|
3102
|
+
return i18nString(AddProject);
|
|
3121
3103
|
};
|
|
3122
3104
|
|
|
3123
3105
|
const getMenuEntriesChatHeader = () => {
|
|
@@ -3251,7 +3233,7 @@ const menuEntryAddProject = {
|
|
|
3251
3233
|
command: 'Chat.handleClick',
|
|
3252
3234
|
flags: None,
|
|
3253
3235
|
id: 'addProject',
|
|
3254
|
-
label: addProject()
|
|
3236
|
+
label: addProject$1()
|
|
3255
3237
|
};
|
|
3256
3238
|
const getMenuEntriesChatProjectList = (projectId = '') => {
|
|
3257
3239
|
if (!projectId) {
|
|
@@ -3266,84 +3248,25 @@ const getMenuEntriesChatProjectList = (projectId = '') => {
|
|
|
3266
3248
|
}, menuEntryAddProject];
|
|
3267
3249
|
};
|
|
3268
3250
|
|
|
3251
|
+
const getMenuEntriesProjectAddButton = () => {
|
|
3252
|
+
return [{
|
|
3253
|
+
args: [CreateProject],
|
|
3254
|
+
command: 'Chat.handleClick',
|
|
3255
|
+
flags: None,
|
|
3256
|
+
id: 'addProject',
|
|
3257
|
+
label: addProject()
|
|
3258
|
+
}];
|
|
3259
|
+
};
|
|
3260
|
+
|
|
3269
3261
|
const MenuChatList = 2178;
|
|
3270
3262
|
const MenuChatHeader = 2179;
|
|
3271
3263
|
const MenuChatInput = 2180;
|
|
3272
|
-
const
|
|
3264
|
+
const MenuProjectAddButton = 2181;
|
|
3265
|
+
const MenuChatProjectList = 2182;
|
|
3273
3266
|
const getMenuEntryIds = () => {
|
|
3274
|
-
return [Chat$1, MenuChatList, MenuChatHeader, MenuChatInput, MenuChatProjectList];
|
|
3267
|
+
return [Chat$1, MenuChatList, MenuChatHeader, MenuChatInput, MenuProjectAddButton, MenuChatProjectList];
|
|
3275
3268
|
};
|
|
3276
3269
|
|
|
3277
|
-
const menuEntrySeparator = {
|
|
3278
|
-
command: '',
|
|
3279
|
-
flags: Separator,
|
|
3280
|
-
id: 'separator',
|
|
3281
|
-
label: ''
|
|
3282
|
-
};
|
|
3283
|
-
|
|
3284
|
-
const menuEntryOpenContainingFolder = {
|
|
3285
|
-
command: 'Explorer.openContainingFolder',
|
|
3286
|
-
flags: RestoreFocus,
|
|
3287
|
-
id: 'openContainingFolder',
|
|
3288
|
-
label: openContainingFolder()
|
|
3289
|
-
};
|
|
3290
|
-
const menuEntryOpenInIntegratedTerminal = {
|
|
3291
|
-
command: /* TODO */'-1',
|
|
3292
|
-
flags: None,
|
|
3293
|
-
id: 'openInIntegratedTerminal',
|
|
3294
|
-
label: openInIntegratedTerminal()
|
|
3295
|
-
};
|
|
3296
|
-
const menuEntryCut = {
|
|
3297
|
-
command: 'Explorer.handleCut',
|
|
3298
|
-
flags: RestoreFocus,
|
|
3299
|
-
id: 'cut',
|
|
3300
|
-
label: cut()
|
|
3301
|
-
};
|
|
3302
|
-
const menuEntryCopy = {
|
|
3303
|
-
command: 'Explorer.handleCopy',
|
|
3304
|
-
flags: RestoreFocus,
|
|
3305
|
-
id: 'copy',
|
|
3306
|
-
label: copy()
|
|
3307
|
-
};
|
|
3308
|
-
const menuEntryPaste = {
|
|
3309
|
-
command: 'Explorer.handlePaste',
|
|
3310
|
-
flags: None,
|
|
3311
|
-
id: 'paste',
|
|
3312
|
-
label: paste()
|
|
3313
|
-
};
|
|
3314
|
-
const menuEntryCopyPath = {
|
|
3315
|
-
command: 'Explorer.copyPath',
|
|
3316
|
-
flags: RestoreFocus,
|
|
3317
|
-
id: 'copyPath',
|
|
3318
|
-
label: copyPath()
|
|
3319
|
-
};
|
|
3320
|
-
const menuEntryCopyAsE2eTest = {
|
|
3321
|
-
command: 'Chat.copyAsE2eTest',
|
|
3322
|
-
flags: None,
|
|
3323
|
-
id: 'copyAsE2eTest',
|
|
3324
|
-
label: copyPath()
|
|
3325
|
-
};
|
|
3326
|
-
const menuEntryCopyRelativePath = {
|
|
3327
|
-
command: 'Explorer.copyRelativePath',
|
|
3328
|
-
flags: RestoreFocus,
|
|
3329
|
-
id: 'copyRelativePath',
|
|
3330
|
-
label: copyRelativePath()
|
|
3331
|
-
};
|
|
3332
|
-
const menuEntryRename = {
|
|
3333
|
-
command: 'Explorer.renameDirent',
|
|
3334
|
-
flags: None,
|
|
3335
|
-
id: 'rename',
|
|
3336
|
-
label: rename()
|
|
3337
|
-
};
|
|
3338
|
-
const menuEntryDelete = {
|
|
3339
|
-
command: 'Explorer.removeDirent',
|
|
3340
|
-
flags: None,
|
|
3341
|
-
id: 'delete',
|
|
3342
|
-
label: deleteItem()
|
|
3343
|
-
};
|
|
3344
|
-
const getMenuEntriesFile = () => {
|
|
3345
|
-
return [menuEntryCopyAsE2eTest, menuEntryOpenContainingFolder, menuEntryOpenInIntegratedTerminal, menuEntrySeparator, menuEntryCut, menuEntryCopy, menuEntryPaste, menuEntrySeparator, menuEntryCopyPath, menuEntryCopyRelativePath, menuEntrySeparator, menuEntryRename, menuEntryDelete];
|
|
3346
|
-
};
|
|
3347
3270
|
const getMenuEntries = (menuId, props) => {
|
|
3348
3271
|
switch (props.menuId) {
|
|
3349
3272
|
case MenuChatHeader:
|
|
@@ -3354,8 +3277,10 @@ const getMenuEntries = (menuId, props) => {
|
|
|
3354
3277
|
return getMenuEntriesChatList();
|
|
3355
3278
|
case MenuChatProjectList:
|
|
3356
3279
|
return getMenuEntriesChatProjectList(props.projectId);
|
|
3280
|
+
case MenuProjectAddButton:
|
|
3281
|
+
return getMenuEntriesProjectAddButton();
|
|
3357
3282
|
default:
|
|
3358
|
-
return
|
|
3283
|
+
return [];
|
|
3359
3284
|
}
|
|
3360
3285
|
};
|
|
3361
3286
|
|
|
@@ -3375,7 +3300,13 @@ const handleChatHeaderContextMenu = async state => {
|
|
|
3375
3300
|
return state;
|
|
3376
3301
|
};
|
|
3377
3302
|
|
|
3378
|
-
const handleChatInputContextMenu = async state => {
|
|
3303
|
+
const handleChatInputContextMenu = async (state, eventX, eventY) => {
|
|
3304
|
+
const {
|
|
3305
|
+
uid
|
|
3306
|
+
} = state;
|
|
3307
|
+
await showContextMenu2(uid, MenuChatInput, eventX, eventY, {
|
|
3308
|
+
menuId: MenuChatInput
|
|
3309
|
+
});
|
|
3379
3310
|
return state;
|
|
3380
3311
|
};
|
|
3381
3312
|
|
|
@@ -3415,7 +3346,12 @@ const handleChatListContextMenu = async (state, eventX, eventY) => {
|
|
|
3415
3346
|
menuId: MenuChatList,
|
|
3416
3347
|
sessionId: item.id
|
|
3417
3348
|
});
|
|
3418
|
-
return
|
|
3349
|
+
return {
|
|
3350
|
+
...state,
|
|
3351
|
+
focus: 'list',
|
|
3352
|
+
focused: true,
|
|
3353
|
+
listFocusedIndex: index
|
|
3354
|
+
};
|
|
3419
3355
|
};
|
|
3420
3356
|
|
|
3421
3357
|
const generateSessionId = () => {
|
|
@@ -8550,11 +8486,11 @@ const handleMessagesContextMenu = async (state, button, x, y) => {
|
|
|
8550
8486
|
return state;
|
|
8551
8487
|
};
|
|
8552
8488
|
|
|
8553
|
-
const
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
return
|
|
8489
|
+
const handleMissingOpenAiApiKeyFormSubmit = async state => {
|
|
8490
|
+
return handleClickSaveOpenApiApiKey(state);
|
|
8491
|
+
};
|
|
8492
|
+
const handleMissingOpenRouterApiKeyFormSubmit = async state => {
|
|
8493
|
+
return handleClickSaveOpenRouterApiKey(state);
|
|
8558
8494
|
};
|
|
8559
8495
|
|
|
8560
8496
|
const handleModelChange = async (state, value) => {
|
|
@@ -8573,47 +8509,60 @@ const handleNewline = async state => {
|
|
|
8573
8509
|
return handleInput(state, Composer, `${composerValue}\n`);
|
|
8574
8510
|
};
|
|
8575
8511
|
|
|
8576
|
-
const
|
|
8512
|
+
const handleProjectAddButtonContextMenu = async (state, button, x, y) => {
|
|
8513
|
+
const {
|
|
8514
|
+
uid
|
|
8515
|
+
} = state;
|
|
8516
|
+
await showContextMenu2(uid, MenuProjectAddButton, x, y, {
|
|
8517
|
+
menuId: MenuProjectAddButton
|
|
8518
|
+
});
|
|
8519
|
+
return state;
|
|
8520
|
+
};
|
|
8521
|
+
|
|
8522
|
+
const getProjectIdAtIndex = (state, index) => {
|
|
8523
|
+
const {
|
|
8524
|
+
projectExpandedIds,
|
|
8525
|
+
projects,
|
|
8526
|
+
sessions
|
|
8527
|
+
} = state;
|
|
8577
8528
|
const blankProjectId = projects.find(project => project.name === '_blank')?.id || projects[0]?.id || '';
|
|
8578
|
-
|
|
8529
|
+
let currentIndex = 0;
|
|
8579
8530
|
for (const project of projects) {
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
const
|
|
8586
|
-
|
|
8587
|
-
|
|
8531
|
+
if (currentIndex === index) {
|
|
8532
|
+
return project.id;
|
|
8533
|
+
}
|
|
8534
|
+
currentIndex++;
|
|
8535
|
+
if (projectExpandedIds.includes(project.id)) {
|
|
8536
|
+
for (const session of sessions) {
|
|
8537
|
+
const sessionProjectId = session.projectId || blankProjectId;
|
|
8538
|
+
if (sessionProjectId !== project.id) {
|
|
8539
|
+
continue;
|
|
8540
|
+
}
|
|
8541
|
+
if (currentIndex === index) {
|
|
8542
|
+
return project.id;
|
|
8543
|
+
}
|
|
8544
|
+
currentIndex++;
|
|
8588
8545
|
}
|
|
8589
8546
|
}
|
|
8590
8547
|
}
|
|
8591
|
-
return
|
|
8548
|
+
return '';
|
|
8592
8549
|
};
|
|
8593
|
-
const
|
|
8550
|
+
const handleProjectListContextMenu = async (state, button, x, y) => {
|
|
8594
8551
|
const {
|
|
8595
8552
|
headerHeight,
|
|
8596
8553
|
listItemHeight,
|
|
8597
|
-
projectExpandedIds,
|
|
8598
8554
|
projectListScrollTop,
|
|
8599
|
-
projects,
|
|
8600
|
-
sessions,
|
|
8601
|
-
y
|
|
8602
|
-
} = state;
|
|
8603
|
-
const relativeY = eventY - y - headerHeight + projectListScrollTop;
|
|
8604
|
-
if (relativeY < 0) {
|
|
8605
|
-
return '';
|
|
8606
|
-
}
|
|
8607
|
-
const index = Math.floor(relativeY / listItemHeight);
|
|
8608
|
-
const projectRowIds = getProjectRowIds(projects, sessions, projectExpandedIds);
|
|
8609
|
-
return projectRowIds[index] || '';
|
|
8610
|
-
};
|
|
8611
|
-
const handleProjectListContextMenu = async (state, button, eventX, eventY) => {
|
|
8612
|
-
const {
|
|
8613
8555
|
uid
|
|
8614
8556
|
} = state;
|
|
8615
|
-
const
|
|
8616
|
-
|
|
8557
|
+
const index = Math.floor((y - headerHeight + projectListScrollTop) / listItemHeight);
|
|
8558
|
+
if (index < 0) {
|
|
8559
|
+
return state;
|
|
8560
|
+
}
|
|
8561
|
+
const projectId = getProjectIdAtIndex(state, index);
|
|
8562
|
+
if (!projectId) {
|
|
8563
|
+
return state;
|
|
8564
|
+
}
|
|
8565
|
+
await showContextMenu2(uid, MenuChatProjectList, x, y, {
|
|
8617
8566
|
menuId: MenuChatProjectList,
|
|
8618
8567
|
projectId
|
|
8619
8568
|
});
|
|
@@ -9363,13 +9312,25 @@ const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessage
|
|
|
9363
9312
|
border-color: darkcyan;
|
|
9364
9313
|
}
|
|
9365
9314
|
|
|
9315
|
+
.SendButtonDisabled{
|
|
9316
|
+
background: var(--vscode-button-secondaryBackground);
|
|
9317
|
+
color: var(--vscode-disabledForeground);
|
|
9318
|
+
cursor: default;
|
|
9319
|
+
}
|
|
9320
|
+
|
|
9321
|
+
.ChatModelPicker{
|
|
9322
|
+
border: 1px solid white;
|
|
9323
|
+
}
|
|
9324
|
+
|
|
9366
9325
|
.ChatListItem{
|
|
9367
9326
|
display:flex;
|
|
9368
9327
|
align-items:center;
|
|
9328
|
+
box-shadow: inset 0 0 0 1px transparent;
|
|
9369
9329
|
}
|
|
9370
9330
|
|
|
9371
9331
|
.ChatListItemFocused{
|
|
9372
9332
|
background: var(--vscode-list-activeSelectionBackground);
|
|
9333
|
+
box-shadow: inset 0 0 0 1px var(--vscode-focusBorder);
|
|
9373
9334
|
color: var(--vscode-list-activeSelectionForeground);
|
|
9374
9335
|
}
|
|
9375
9336
|
|
|
@@ -9381,6 +9342,10 @@ const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessage
|
|
|
9381
9342
|
padding-top: 10px;
|
|
9382
9343
|
}
|
|
9383
9344
|
|
|
9345
|
+
a.Button{
|
|
9346
|
+
text-decoration: none;
|
|
9347
|
+
}
|
|
9348
|
+
|
|
9384
9349
|
.ChatHeaderLabel{
|
|
9385
9350
|
margin: 0;
|
|
9386
9351
|
font-size: 14px;
|
|
@@ -9425,6 +9390,46 @@ const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessage
|
|
|
9425
9390
|
text-overflow: ellipsis;
|
|
9426
9391
|
}
|
|
9427
9392
|
|
|
9393
|
+
.ChatModelPickerList{
|
|
9394
|
+
scrollbar-width: thin;
|
|
9395
|
+
scrollbar-color: var(--vscode-scrollbarSlider-background) transparent;
|
|
9396
|
+
}
|
|
9397
|
+
|
|
9398
|
+
.ChatModelPickerList::-webkit-scrollbar{
|
|
9399
|
+
width: 10px;
|
|
9400
|
+
}
|
|
9401
|
+
|
|
9402
|
+
.ChatModelPickerList::-webkit-scrollbar-track{
|
|
9403
|
+
background: transparent;
|
|
9404
|
+
}
|
|
9405
|
+
|
|
9406
|
+
.ChatModelPickerList::-webkit-scrollbar-thumb{
|
|
9407
|
+
background: var(--vscode-scrollbarSlider-background);
|
|
9408
|
+
border: 2px solid transparent;
|
|
9409
|
+
border-radius: 999px;
|
|
9410
|
+
background-clip: content-box;
|
|
9411
|
+
}
|
|
9412
|
+
|
|
9413
|
+
.ChatModelPickerList::-webkit-scrollbar-thumb:hover{
|
|
9414
|
+
background: var(--vscode-scrollbarSlider-hoverBackground);
|
|
9415
|
+
border: 2px solid transparent;
|
|
9416
|
+
background-clip: content-box;
|
|
9417
|
+
}
|
|
9418
|
+
|
|
9419
|
+
.ChatModelPickerList::-webkit-scrollbar-thumb:active{
|
|
9420
|
+
background: var(--vscode-scrollbarSlider-activeBackground);
|
|
9421
|
+
border: 2px solid transparent;
|
|
9422
|
+
background-clip: content-box;
|
|
9423
|
+
}
|
|
9424
|
+
|
|
9425
|
+
.ChatModelPickerItem{
|
|
9426
|
+
display: block;
|
|
9427
|
+
width: 100%;
|
|
9428
|
+
white-space: nowrap;
|
|
9429
|
+
overflow: hidden;
|
|
9430
|
+
text-overflow: ellipsis;
|
|
9431
|
+
}
|
|
9432
|
+
|
|
9428
9433
|
`;
|
|
9429
9434
|
return `${baseCss}
|
|
9430
9435
|
|
|
@@ -9523,6 +9528,14 @@ const ChatTodoListItemCompleted = 'ChatTodoListItemCompleted';
|
|
|
9523
9528
|
const Chat = 'Chat';
|
|
9524
9529
|
const ChatHeader = 'ChatHeader';
|
|
9525
9530
|
const ChatHeaderLabel = 'ChatHeaderLabel';
|
|
9531
|
+
const MaskIconDebugPause = 'MaskIconDebugPause';
|
|
9532
|
+
const MaskIconAccount = 'MaskIconAccount';
|
|
9533
|
+
const MaskIconAdd = 'MaskIconAdd';
|
|
9534
|
+
const MaskIconClose = 'MaskIconClose';
|
|
9535
|
+
const MaskIconLayoutPanelLeft = 'MaskIconLayoutPanelLeft';
|
|
9536
|
+
const MaskIconSearch = 'MaskIconSearch';
|
|
9537
|
+
const MaskIconSettingsGear = 'MaskIconSettingsGear';
|
|
9538
|
+
const MaskIconSignOut = 'MaskIconSignOut';
|
|
9526
9539
|
const Button = 'Button';
|
|
9527
9540
|
const ButtonPrimary = 'ButtonPrimary';
|
|
9528
9541
|
const ButtonSecondary = 'ButtonSecondary';
|
|
@@ -9565,6 +9578,7 @@ const MarkdownQuote = 'MarkdownQuote';
|
|
|
9565
9578
|
const MarkdownMathBlock = 'MarkdownMathBlock';
|
|
9566
9579
|
const MarkdownTable = 'MarkdownTable';
|
|
9567
9580
|
const ChatTableWrapper = 'ChatTableWrapper';
|
|
9581
|
+
const MaskIcon = 'MaskIcon';
|
|
9568
9582
|
const Message = 'Message';
|
|
9569
9583
|
const MissingApiKeyForm = 'MissingApiKeyForm';
|
|
9570
9584
|
const ChatMessageContent = 'ChatMessageContent';
|
|
@@ -9630,15 +9644,17 @@ const HandleDrop = 29;
|
|
|
9630
9644
|
const HandleDragEnterChatView = 30;
|
|
9631
9645
|
const HandleDragOverChatView = 31;
|
|
9632
9646
|
const HandleProjectListScroll = 32;
|
|
9633
|
-
const HandleProjectListContextMenu = 33;
|
|
9634
9647
|
const HandleClickDictationButton = 34;
|
|
9635
|
-
const
|
|
9648
|
+
const HandleMissingOpenAiApiKeyFormSubmit = 35;
|
|
9636
9649
|
const HandleRunModeChange = 36;
|
|
9637
9650
|
const HandleSearchInput = 37;
|
|
9638
9651
|
const HandleChatWelcomeContextMenu = 39;
|
|
9639
9652
|
const HandleChatHeaderContextMenu = 40;
|
|
9640
9653
|
const HandleChatInputContextMenu = 41;
|
|
9641
9654
|
const HandleContextMenuChatSendAreaBottom = 42;
|
|
9655
|
+
const HandleProjectAddButtonContextMenu = 43;
|
|
9656
|
+
const HandleProjectListContextMenu = 44;
|
|
9657
|
+
const HandleMissingOpenRouterApiKeyFormSubmit = 45;
|
|
9642
9658
|
|
|
9643
9659
|
const getModelLabel = model => {
|
|
9644
9660
|
if (model.provider === 'openRouter') {
|
|
@@ -9650,13 +9666,11 @@ const getModelLabel = model => {
|
|
|
9650
9666
|
return model.name;
|
|
9651
9667
|
};
|
|
9652
9668
|
|
|
9653
|
-
const
|
|
9669
|
+
const getChatModelPickerToggleVirtualDom = (models, selectedModelId, modelPickerOpen) => {
|
|
9654
9670
|
const selectedModel = models.find(model => model.id === selectedModelId);
|
|
9655
9671
|
const selectedModelLabel = selectedModel ? selectedModel.name : selectedModelId;
|
|
9656
|
-
const normalizedSearch = modelPickerSearchValue.trim().toLowerCase();
|
|
9657
|
-
const visibleModels = normalizedSearch ? models.filter(model => getModelLabel(model).toLowerCase().includes(normalizedSearch)) : models;
|
|
9658
9672
|
return [{
|
|
9659
|
-
childCount:
|
|
9673
|
+
childCount: 1,
|
|
9660
9674
|
className: ChatModelPickerContainer,
|
|
9661
9675
|
type: Div
|
|
9662
9676
|
}, {
|
|
@@ -9665,12 +9679,26 @@ const getChatModelPickerVirtualDom = (models, selectedModelId, modelPickerOpen,
|
|
|
9665
9679
|
name: ModelPickerToggle,
|
|
9666
9680
|
onClick: HandleClick,
|
|
9667
9681
|
title: selectedModelLabel,
|
|
9668
|
-
type:
|
|
9682
|
+
type: Div
|
|
9669
9683
|
}, {
|
|
9684
|
+
childCount: 1,
|
|
9685
|
+
type: Span
|
|
9686
|
+
}, text(selectedModelLabel), {
|
|
9670
9687
|
childCount: 0,
|
|
9671
|
-
className: 'MaskIcon MaskIconChevronUp',
|
|
9688
|
+
className: modelPickerOpen ? 'MaskIcon MaskIconChevronUp' : 'MaskIcon MaskIconChevronDown',
|
|
9689
|
+
role: 'none',
|
|
9690
|
+
type: Div
|
|
9691
|
+
}];
|
|
9692
|
+
};
|
|
9693
|
+
const getChatModelPickerPopOverVirtualDom = (models, selectedModelId, modelPickerSearchValue) => {
|
|
9694
|
+
const normalizedSearch = modelPickerSearchValue.trim().toLowerCase();
|
|
9695
|
+
const visibleModels = normalizedSearch ? models.filter(model => getModelLabel(model).toLowerCase().includes(normalizedSearch)) : models;
|
|
9696
|
+
return [{
|
|
9697
|
+
childCount: 2,
|
|
9698
|
+
className: ChatModelPickerContainer,
|
|
9699
|
+
style: 'position:absolute;',
|
|
9672
9700
|
type: Div
|
|
9673
|
-
},
|
|
9701
|
+
}, {
|
|
9674
9702
|
childCount: 3 + visibleModels.length,
|
|
9675
9703
|
className: ChatModelPicker,
|
|
9676
9704
|
type: Div
|
|
@@ -9681,6 +9709,7 @@ const getChatModelPickerVirtualDom = (models, selectedModelId, modelPickerOpen,
|
|
|
9681
9709
|
}, {
|
|
9682
9710
|
childCount: 0,
|
|
9683
9711
|
className: InputBox,
|
|
9712
|
+
inputType: 'search',
|
|
9684
9713
|
name: ModelPickerSearch,
|
|
9685
9714
|
onInput: HandleInput,
|
|
9686
9715
|
placeholder: 'Search models',
|
|
@@ -9700,14 +9729,14 @@ const getChatModelPickerVirtualDom = (models, selectedModelId, modelPickerOpen,
|
|
|
9700
9729
|
}, {
|
|
9701
9730
|
childCount: visibleModels.length,
|
|
9702
9731
|
className: ChatModelPickerList,
|
|
9703
|
-
type:
|
|
9732
|
+
type: Ul
|
|
9704
9733
|
}, ...visibleModels.flatMap(model => [{
|
|
9705
9734
|
childCount: 1,
|
|
9706
9735
|
className: `${ChatModelPickerItem}${model.id === selectedModelId ? ` ${ChatModelPickerItemSelected}` : ''}`,
|
|
9707
9736
|
name: getModelPickerItemInputName(model.id),
|
|
9708
9737
|
onClick: HandleClick,
|
|
9709
|
-
type:
|
|
9710
|
-
}, text(getModelLabel(model))])]
|
|
9738
|
+
type: Li
|
|
9739
|
+
}, text(getModelLabel(model))])];
|
|
9711
9740
|
};
|
|
9712
9741
|
|
|
9713
9742
|
const getModelOptionDOm = (model, selectedModelId) => {
|
|
@@ -9781,7 +9810,8 @@ const getSendButtonDom = (isSendDisabled, voiceDictationEnabled) => {
|
|
|
9781
9810
|
type: Button$1
|
|
9782
9811
|
}, {
|
|
9783
9812
|
childCount: 0,
|
|
9784
|
-
className: 'MaskIcon
|
|
9813
|
+
className: 'MaskIcon MaskIconArrowUp',
|
|
9814
|
+
role: 'none',
|
|
9785
9815
|
type: Div
|
|
9786
9816
|
}];
|
|
9787
9817
|
};
|
|
@@ -9847,20 +9877,20 @@ const getUsageOverviewDom = (tokensUsed, tokensMax) => {
|
|
|
9847
9877
|
}, text(usageLabel)];
|
|
9848
9878
|
};
|
|
9849
9879
|
|
|
9850
|
-
const
|
|
9880
|
+
const getTodoItemClassName = status => {
|
|
9881
|
+
if (status === 'completed') {
|
|
9882
|
+
return `${ChatTodoListItem} ${ChatTodoListItemCompleted} completed`;
|
|
9883
|
+
}
|
|
9884
|
+
if (status === 'inProgress') {
|
|
9885
|
+
return `${ChatTodoListItem} ${ChatTodoListItemInProgress} inProgress`;
|
|
9886
|
+
}
|
|
9887
|
+
return `${ChatTodoListItem} ${ChatTodoListItemTodo} todo`;
|
|
9888
|
+
};
|
|
9889
|
+
const getChatSendAreaDom = (composerValue, modelPickerOpen, modelPickerSearchValue, models, newChatModelPickerEnabled, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled = false) => {
|
|
9851
9890
|
const isSendDisabled = composerValue.trim() === '';
|
|
9852
|
-
const controlsCount = 2 + (usageOverviewEnabled ? 1 : 0) + (showRunMode ? 1 : 0) + (addContextButtonEnabled ? 1 : 0)
|
|
9891
|
+
const controlsCount = 2 + (usageOverviewEnabled ? 1 : 0) + (showRunMode ? 1 : 0) + (addContextButtonEnabled ? 1 : 0);
|
|
9853
9892
|
const hasTodoList = todoListToolEnabled && todoListItems.length > 0;
|
|
9854
9893
|
const todoHeaderText = `Todos (${todoListItems.filter(item => item.status === 'completed').length}/${todoListItems.length})`;
|
|
9855
|
-
const getTodoItemClassName = status => {
|
|
9856
|
-
if (status === 'completed') {
|
|
9857
|
-
return `${ChatTodoListItem} ${ChatTodoListItemCompleted} completed`;
|
|
9858
|
-
}
|
|
9859
|
-
if (status === 'inProgress') {
|
|
9860
|
-
return `${ChatTodoListItem} ${ChatTodoListItemInProgress} inProgress`;
|
|
9861
|
-
}
|
|
9862
|
-
return `${ChatTodoListItem} ${ChatTodoListItemTodo} todo`;
|
|
9863
|
-
};
|
|
9864
9894
|
return [{
|
|
9865
9895
|
childCount: 1,
|
|
9866
9896
|
className: ChatSendArea,
|
|
@@ -9903,7 +9933,14 @@ const getChatSendAreaDom = (composerValue, modelPickerOpen, modelPickerSearchVal
|
|
|
9903
9933
|
className: ChatSendAreaBottom,
|
|
9904
9934
|
onContextMenu: HandleContextMenuChatSendAreaBottom,
|
|
9905
9935
|
type: Div
|
|
9906
|
-
}, ...(newChatModelPickerEnabled ?
|
|
9936
|
+
}, ...(newChatModelPickerEnabled ? getChatModelPickerToggleVirtualDom(models, selectedModelId, modelPickerOpen) : getChatSelectVirtualDom(models, selectedModelId)), ...(showRunMode ? getRunModeSelectVirtualDom(runMode) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
|
|
9937
|
+
};
|
|
9938
|
+
|
|
9939
|
+
const getBoldInlineNodeDom = (inlineNode, useChatMathWorker, renderInlineNodeDom) => {
|
|
9940
|
+
return [{
|
|
9941
|
+
childCount: inlineNode.children.length,
|
|
9942
|
+
type: Strong
|
|
9943
|
+
}, ...inlineNode.children.flatMap(child => renderInlineNodeDom(child, useChatMathWorker))];
|
|
9907
9944
|
};
|
|
9908
9945
|
|
|
9909
9946
|
const getImageAltText = alt => {
|
|
@@ -9912,55 +9949,37 @@ const getImageAltText = alt => {
|
|
|
9912
9949
|
}
|
|
9913
9950
|
return `${alt} (image could not be loaded)`;
|
|
9914
9951
|
};
|
|
9952
|
+
|
|
9953
|
+
const getImageInlineNodeDom = inlineNode => {
|
|
9954
|
+
return [{
|
|
9955
|
+
alt: getImageAltText(inlineNode.alt),
|
|
9956
|
+
childCount: 0,
|
|
9957
|
+
className: ImageElement,
|
|
9958
|
+
src: inlineNode.src,
|
|
9959
|
+
type: Img
|
|
9960
|
+
}];
|
|
9961
|
+
};
|
|
9962
|
+
|
|
9963
|
+
const getInlineCodeInlineNodeDom = inlineNode => {
|
|
9964
|
+
return [{
|
|
9965
|
+
childCount: 1,
|
|
9966
|
+
type: Code
|
|
9967
|
+
}, text(inlineNode.text)];
|
|
9968
|
+
};
|
|
9969
|
+
|
|
9970
|
+
const getItalicInlineNodeDom = (inlineNode, useChatMathWorker, renderInlineNodeDom) => {
|
|
9971
|
+
return [{
|
|
9972
|
+
childCount: inlineNode.children.length,
|
|
9973
|
+
type: Em
|
|
9974
|
+
}, ...inlineNode.children.flatMap(child => renderInlineNodeDom(child, useChatMathWorker))];
|
|
9975
|
+
};
|
|
9976
|
+
|
|
9915
9977
|
const isFileReferenceUri = href => {
|
|
9916
9978
|
const normalized = href.trim().toLowerCase();
|
|
9917
9979
|
return normalized.startsWith('file://') || normalized.startsWith('vscode-references://');
|
|
9918
9980
|
};
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
return [text(inlineNode.text)];
|
|
9922
|
-
}
|
|
9923
|
-
if (inlineNode.type === 'image') {
|
|
9924
|
-
return [{
|
|
9925
|
-
alt: getImageAltText(inlineNode.alt),
|
|
9926
|
-
childCount: 0,
|
|
9927
|
-
className: ImageElement,
|
|
9928
|
-
src: inlineNode.src,
|
|
9929
|
-
type: Img
|
|
9930
|
-
}];
|
|
9931
|
-
}
|
|
9932
|
-
if (inlineNode.type === 'bold') {
|
|
9933
|
-
return [{
|
|
9934
|
-
childCount: inlineNode.children.length,
|
|
9935
|
-
type: Strong
|
|
9936
|
-
}, ...inlineNode.children.flatMap(child => getInlineNodeDom(child, useChatMathWorker))];
|
|
9937
|
-
}
|
|
9938
|
-
if (inlineNode.type === 'italic') {
|
|
9939
|
-
return [{
|
|
9940
|
-
childCount: inlineNode.children.length,
|
|
9941
|
-
type: Em
|
|
9942
|
-
}, ...inlineNode.children.flatMap(child => getInlineNodeDom(child, useChatMathWorker))];
|
|
9943
|
-
}
|
|
9944
|
-
if (inlineNode.type === 'strikethrough') {
|
|
9945
|
-
return [{
|
|
9946
|
-
childCount: inlineNode.children.length,
|
|
9947
|
-
className: StrikeThrough,
|
|
9948
|
-
type: Span
|
|
9949
|
-
}, ...inlineNode.children.flatMap(child => getInlineNodeDom(child, useChatMathWorker))];
|
|
9950
|
-
}
|
|
9951
|
-
if (inlineNode.type === 'inline-code') {
|
|
9952
|
-
return [{
|
|
9953
|
-
childCount: 1,
|
|
9954
|
-
type: Code
|
|
9955
|
-
}, text(inlineNode.text)];
|
|
9956
|
-
}
|
|
9957
|
-
if (inlineNode.type === 'math-inline') {
|
|
9958
|
-
const fallback = inlineNode.displayMode ? `$$${inlineNode.text}$$` : `$${inlineNode.text}$`;
|
|
9959
|
-
return [text(fallback)];
|
|
9960
|
-
}
|
|
9961
|
-
if (inlineNode.type === 'math-inline-dom') {
|
|
9962
|
-
return inlineNode.dom;
|
|
9963
|
-
}
|
|
9981
|
+
|
|
9982
|
+
const getLinkInlineNodeDom = inlineNode => {
|
|
9964
9983
|
if (isFileReferenceUri(inlineNode.href)) {
|
|
9965
9984
|
return [{
|
|
9966
9985
|
childCount: 1,
|
|
@@ -9983,6 +10002,48 @@ const getInlineNodeDom = (inlineNode, useChatMathWorker = false) => {
|
|
|
9983
10002
|
}, text(inlineNode.text)];
|
|
9984
10003
|
};
|
|
9985
10004
|
|
|
10005
|
+
const getMathInlineNodeDom = inlineNode => {
|
|
10006
|
+
const fallback = inlineNode.displayMode ? `$$${inlineNode.text}$$` : `$${inlineNode.text}$`;
|
|
10007
|
+
return [text(fallback)];
|
|
10008
|
+
};
|
|
10009
|
+
|
|
10010
|
+
const getStrikethroughInlineNodeDom = (inlineNode, useChatMathWorker, renderInlineNodeDom) => {
|
|
10011
|
+
return [{
|
|
10012
|
+
childCount: inlineNode.children.length,
|
|
10013
|
+
className: StrikeThrough,
|
|
10014
|
+
type: Span
|
|
10015
|
+
}, ...inlineNode.children.flatMap(child => renderInlineNodeDom(child, useChatMathWorker))];
|
|
10016
|
+
};
|
|
10017
|
+
|
|
10018
|
+
const getTextInlineNodeDom = inlineNode => {
|
|
10019
|
+
return [text(inlineNode.text)];
|
|
10020
|
+
};
|
|
10021
|
+
|
|
10022
|
+
const getInlineNodeDom = (inlineNode, useChatMathWorker = false) => {
|
|
10023
|
+
switch (inlineNode.type) {
|
|
10024
|
+
case 'bold':
|
|
10025
|
+
return getBoldInlineNodeDom(inlineNode, useChatMathWorker, getInlineNodeDom);
|
|
10026
|
+
case 'image':
|
|
10027
|
+
return getImageInlineNodeDom(inlineNode);
|
|
10028
|
+
case 'inline-code':
|
|
10029
|
+
return getInlineCodeInlineNodeDom(inlineNode);
|
|
10030
|
+
case 'italic':
|
|
10031
|
+
return getItalicInlineNodeDom(inlineNode, useChatMathWorker, getInlineNodeDom);
|
|
10032
|
+
case 'link':
|
|
10033
|
+
return getLinkInlineNodeDom(inlineNode);
|
|
10034
|
+
case 'math-inline':
|
|
10035
|
+
return getMathInlineNodeDom(inlineNode);
|
|
10036
|
+
case 'math-inline-dom':
|
|
10037
|
+
return inlineNode.dom;
|
|
10038
|
+
case 'strikethrough':
|
|
10039
|
+
return getStrikethroughInlineNodeDom(inlineNode, useChatMathWorker, getInlineNodeDom);
|
|
10040
|
+
case 'text':
|
|
10041
|
+
return getTextInlineNodeDom(inlineNode);
|
|
10042
|
+
}
|
|
10043
|
+
const exhaustiveCheck = inlineNode;
|
|
10044
|
+
return exhaustiveCheck;
|
|
10045
|
+
};
|
|
10046
|
+
|
|
9986
10047
|
const jsRules = [{
|
|
9987
10048
|
className: TokenComment,
|
|
9988
10049
|
regex: /\/\/[^\n]*/
|
|
@@ -10309,11 +10370,41 @@ const getMessageContentDom = (nodes, useChatMathWorker = false) => {
|
|
|
10309
10370
|
return nodes.flatMap(node => getMessageNodeDom(node, useChatMathWorker));
|
|
10310
10371
|
};
|
|
10311
10372
|
|
|
10373
|
+
const getMissingApiActionsDom = ({
|
|
10374
|
+
getApiKeyText,
|
|
10375
|
+
openSettingsButtonName,
|
|
10376
|
+
openSettingsUrl,
|
|
10377
|
+
saveButtonDisabled = false,
|
|
10378
|
+
saveButtonName,
|
|
10379
|
+
saveButtonText = save()
|
|
10380
|
+
}) => {
|
|
10381
|
+
return [{
|
|
10382
|
+
childCount: 2,
|
|
10383
|
+
className: Actions,
|
|
10384
|
+
type: Div
|
|
10385
|
+
}, {
|
|
10386
|
+
childCount: 1,
|
|
10387
|
+
className: mergeClassNames(Button, ButtonPrimary),
|
|
10388
|
+
disabled: saveButtonDisabled,
|
|
10389
|
+
inputType: 'submit',
|
|
10390
|
+
name: saveButtonName,
|
|
10391
|
+
type: Button$1
|
|
10392
|
+
}, text(saveButtonText), {
|
|
10393
|
+
childCount: 1,
|
|
10394
|
+
className: mergeClassNames(Button, ButtonSecondary),
|
|
10395
|
+
href: openSettingsUrl,
|
|
10396
|
+
name: openSettingsButtonName,
|
|
10397
|
+
rel: 'noopener noreferrer',
|
|
10398
|
+
target: '_blank',
|
|
10399
|
+
type: A
|
|
10400
|
+
}, text(getApiKeyText)];
|
|
10401
|
+
};
|
|
10312
10402
|
const getMissingApiKeyDom = ({
|
|
10313
10403
|
getApiKeyText,
|
|
10314
10404
|
inputName,
|
|
10315
10405
|
inputPattern,
|
|
10316
10406
|
inputRequired = false,
|
|
10407
|
+
onSubmit,
|
|
10317
10408
|
openSettingsButtonName,
|
|
10318
10409
|
openSettingsUrl,
|
|
10319
10410
|
placeholder,
|
|
@@ -10325,7 +10416,7 @@ const getMissingApiKeyDom = ({
|
|
|
10325
10416
|
childCount: 2,
|
|
10326
10417
|
className: MissingApiKeyForm,
|
|
10327
10418
|
method: 'GET',
|
|
10328
|
-
onSubmit
|
|
10419
|
+
onSubmit,
|
|
10329
10420
|
type: Form
|
|
10330
10421
|
}, {
|
|
10331
10422
|
autocapitalize: 'off',
|
|
@@ -10342,26 +10433,14 @@ const getMissingApiKeyDom = ({
|
|
|
10342
10433
|
required: inputRequired,
|
|
10343
10434
|
spellcheck: false,
|
|
10344
10435
|
type: Input
|
|
10345
|
-
}, {
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
inputType: 'submit',
|
|
10354
|
-
name: saveButtonName,
|
|
10355
|
-
type: Button$1
|
|
10356
|
-
}, text(saveButtonText), {
|
|
10357
|
-
childCount: 1,
|
|
10358
|
-
className: mergeClassNames(Button, ButtonSecondary),
|
|
10359
|
-
href: openSettingsUrl,
|
|
10360
|
-
name: openSettingsButtonName,
|
|
10361
|
-
rel: 'noopener noreferrer',
|
|
10362
|
-
target: '_blank',
|
|
10363
|
-
type: A
|
|
10364
|
-
}, text(getApiKeyText)];
|
|
10436
|
+
}, ...getMissingApiActionsDom({
|
|
10437
|
+
getApiKeyText,
|
|
10438
|
+
openSettingsButtonName,
|
|
10439
|
+
openSettingsUrl,
|
|
10440
|
+
saveButtonDisabled,
|
|
10441
|
+
saveButtonName,
|
|
10442
|
+
saveButtonText
|
|
10443
|
+
})];
|
|
10365
10444
|
};
|
|
10366
10445
|
|
|
10367
10446
|
const getMissingOpenApiApiKeyDom = () => {
|
|
@@ -10370,6 +10449,7 @@ const getMissingOpenApiApiKeyDom = () => {
|
|
|
10370
10449
|
inputName: OpenApiApiKeyInput,
|
|
10371
10450
|
inputPattern: '^sk-.+',
|
|
10372
10451
|
inputRequired: true,
|
|
10452
|
+
onSubmit: HandleMissingOpenAiApiKeyFormSubmit,
|
|
10373
10453
|
openSettingsButtonName: OpenOpenApiApiKeyWebsite,
|
|
10374
10454
|
openSettingsUrl: 'https://platform.openai.com/api-keys',
|
|
10375
10455
|
placeholder: openApiApiKeyPlaceholder(),
|
|
@@ -10382,6 +10462,7 @@ const getMissingOpenRouterApiKeyDom = (openRouterApiKeyState = 'idle') => {
|
|
|
10382
10462
|
return getMissingApiKeyDom({
|
|
10383
10463
|
getApiKeyText: getOpenRouterApiKey(),
|
|
10384
10464
|
inputName: OpenRouterApiKeyInput,
|
|
10465
|
+
onSubmit: HandleMissingOpenRouterApiKeyFormSubmit,
|
|
10385
10466
|
openSettingsButtonName: OpenOpenRouterApiKeySettings,
|
|
10386
10467
|
openSettingsUrl: 'https://openrouter.ai/settings/keys',
|
|
10387
10468
|
placeholder: openRouterApiKeyPlaceholder(),
|
|
@@ -11268,6 +11349,7 @@ const getProjectSessionDom = (session, selectedSessionId) => {
|
|
|
11268
11349
|
className: ProjectSessionItemLabel,
|
|
11269
11350
|
name: getSessionInputName(session.id),
|
|
11270
11351
|
onClick: HandleClick,
|
|
11352
|
+
onContextMenu: HandleProjectListContextMenu,
|
|
11271
11353
|
tabIndex: 0,
|
|
11272
11354
|
type: Div
|
|
11273
11355
|
}, text(session.title)];
|
|
@@ -11288,6 +11370,7 @@ const getProjectGroupDom = (project, sessions, projectExpandedIds, selectedProje
|
|
|
11288
11370
|
className: ProjectListItemLabel,
|
|
11289
11371
|
name: getProjectInputName(project.id),
|
|
11290
11372
|
onClick: HandleClick,
|
|
11373
|
+
onContextMenu: HandleProjectListContextMenu,
|
|
11291
11374
|
tabIndex: 0,
|
|
11292
11375
|
type: Div
|
|
11293
11376
|
}, {
|
|
@@ -11312,7 +11395,7 @@ const getProjectGroupDom = (project, sessions, projectExpandedIds, selectedProje
|
|
|
11312
11395
|
type: Button$1
|
|
11313
11396
|
}, text('+'), ...(expanded ? sessions.flatMap(session => getProjectSessionDom(session, selectedSessionId)) : [])];
|
|
11314
11397
|
};
|
|
11315
|
-
const getProjectListDom = (projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop) => {
|
|
11398
|
+
const getProjectListDom = (projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop, showBackToChatsButton = false) => {
|
|
11316
11399
|
const blankProjectId = projects.find(project => project.name === '_blank')?.id || projects[0]?.id || '';
|
|
11317
11400
|
const projectGroups = projects.map(project => {
|
|
11318
11401
|
const projectSessions = sessions.filter(session => {
|
|
@@ -11322,13 +11405,12 @@ const getProjectListDom = (projects, sessions, projectExpandedIds, selectedProje
|
|
|
11322
11405
|
return getProjectGroupDom(project, projectSessions, projectExpandedIds, selectedProjectId, selectedSessionId);
|
|
11323
11406
|
});
|
|
11324
11407
|
return [{
|
|
11325
|
-
childCount: 2,
|
|
11408
|
+
childCount: 2 + (showBackToChatsButton ? 1 : 0),
|
|
11326
11409
|
className: ProjectSidebar,
|
|
11327
11410
|
type: Div
|
|
11328
11411
|
}, {
|
|
11329
11412
|
childCount: projects.length,
|
|
11330
11413
|
className: ProjectList,
|
|
11331
|
-
onContextMenu: HandleProjectListContextMenu,
|
|
11332
11414
|
onScroll: HandleProjectListScroll,
|
|
11333
11415
|
scrollTop: projectListScrollTop,
|
|
11334
11416
|
type: Div
|
|
@@ -11337,9 +11419,10 @@ const getProjectListDom = (projects, sessions, projectExpandedIds, selectedProje
|
|
|
11337
11419
|
className: ProjectAddButton,
|
|
11338
11420
|
name: CreateProject,
|
|
11339
11421
|
onClick: HandleClick,
|
|
11422
|
+
onContextMenu: HandleProjectAddButtonContextMenu,
|
|
11340
11423
|
tabIndex: 0,
|
|
11341
11424
|
type: Button$1
|
|
11342
|
-
}, text('+ Add Project')];
|
|
11425
|
+
}, text('+ Add Project'), ...(showBackToChatsButton ? getBackToChatsButtonDom() : [])];
|
|
11343
11426
|
};
|
|
11344
11427
|
|
|
11345
11428
|
const getChatModeChatFocusVirtualDom = ({
|
|
@@ -11383,13 +11466,15 @@ const getChatModeChatFocusVirtualDom = ({
|
|
|
11383
11466
|
const selectedSession = sessions.find(session => session.id === selectedSessionId);
|
|
11384
11467
|
const messages = selectedSession ? selectedSession.messages : [];
|
|
11385
11468
|
const isDropOverlayVisible = composerDropEnabled && composerDropActive;
|
|
11469
|
+
const isNewModelPickerVisible = newChatModelPickerEnabled && modelPickerOpen;
|
|
11470
|
+
const chatRootChildCount = 3 + (isDropOverlayVisible ? 1 : 0) + (isNewModelPickerVisible ? 1 : 0);
|
|
11386
11471
|
return [{
|
|
11387
|
-
childCount:
|
|
11472
|
+
childCount: chatRootChildCount,
|
|
11388
11473
|
className: mergeClassNames(Viewlet, Chat, 'ChatFocus'),
|
|
11389
11474
|
onDragEnter: HandleDragEnterChatView,
|
|
11390
11475
|
onDragOver: HandleDragOverChatView,
|
|
11391
11476
|
type: Div
|
|
11392
|
-
}, ...getProjectListDom(projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, modelPickerOpen, modelPickerSearchValue, models, newChatModelPickerEnabled, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled
|
|
11477
|
+
}, ...getProjectListDom(projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop, true), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, modelPickerOpen, modelPickerSearchValue, models, newChatModelPickerEnabled, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
|
|
11393
11478
|
childCount: 1,
|
|
11394
11479
|
className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
|
|
11395
11480
|
name: ComposerDropTarget,
|
|
@@ -11400,7 +11485,7 @@ const getChatModeChatFocusVirtualDom = ({
|
|
|
11400
11485
|
}, {
|
|
11401
11486
|
text: attachImageAsContext(),
|
|
11402
11487
|
type: Text
|
|
11403
|
-
}] : [])];
|
|
11488
|
+
}] : []), ...(isNewModelPickerVisible ? getChatModelPickerPopOverVirtualDom(models, selectedModelId, modelPickerSearchValue) : [])];
|
|
11404
11489
|
};
|
|
11405
11490
|
|
|
11406
11491
|
const getBackButtonVirtualDom = () => {
|
|
@@ -11440,44 +11525,44 @@ const getChatHeaderActionsDom = (viewMode, authEnabled = false, authStatus = 'si
|
|
|
11440
11525
|
const isSigningIn = authStatus === 'signing-in';
|
|
11441
11526
|
const authAction = authEnabled && authStatus !== 'signed-in' ? {
|
|
11442
11527
|
disabled: isSigningIn,
|
|
11443
|
-
icon:
|
|
11528
|
+
icon: mergeClassNames(MaskIcon, MaskIconAccount),
|
|
11444
11529
|
name: Login,
|
|
11445
11530
|
onClick: HandleClick,
|
|
11446
11531
|
title: isSigningIn ? loggingInToBackend() : loginToBackend()
|
|
11447
11532
|
} : authEnabled ? {
|
|
11448
11533
|
disabled: false,
|
|
11449
|
-
icon:
|
|
11534
|
+
icon: mergeClassNames(MaskIcon, MaskIconSignOut),
|
|
11450
11535
|
name: Logout,
|
|
11451
11536
|
onClick: HandleClick,
|
|
11452
11537
|
title: logoutFromBackend()
|
|
11453
11538
|
} : undefined;
|
|
11454
11539
|
const items = [{
|
|
11455
|
-
icon:
|
|
11540
|
+
icon: mergeClassNames(MaskIcon, MaskIconLayoutPanelLeft),
|
|
11456
11541
|
name: ToggleChatFocus,
|
|
11457
11542
|
onClick: HandleClick,
|
|
11458
11543
|
title: toggleTitle
|
|
11459
11544
|
}, ...(searchEnabled ? [{
|
|
11460
|
-
icon:
|
|
11545
|
+
icon: mergeClassNames(MaskIcon, MaskIconSearch),
|
|
11461
11546
|
name: ToggleSearch,
|
|
11462
11547
|
onClick: HandleClick,
|
|
11463
11548
|
title: search()
|
|
11464
11549
|
}] : []), {
|
|
11465
|
-
icon:
|
|
11550
|
+
icon: mergeClassNames(MaskIcon, MaskIconDebugPause),
|
|
11466
11551
|
name: SessionDebug,
|
|
11467
11552
|
onClick: HandleClickSessionDebug,
|
|
11468
11553
|
title: debug()
|
|
11469
11554
|
}, {
|
|
11470
|
-
icon:
|
|
11555
|
+
icon: mergeClassNames(MaskIcon, MaskIconAdd),
|
|
11471
11556
|
name: CreateSession,
|
|
11472
11557
|
onClick: HandleClickNew,
|
|
11473
11558
|
title: newChat()
|
|
11474
11559
|
}, {
|
|
11475
|
-
icon:
|
|
11560
|
+
icon: mergeClassNames(MaskIcon, MaskIconSettingsGear),
|
|
11476
11561
|
name: Settings,
|
|
11477
11562
|
onClick: HandleClickSettings,
|
|
11478
11563
|
title: settings()
|
|
11479
11564
|
}, ...(authAction ? [authAction] : []), {
|
|
11480
|
-
icon:
|
|
11565
|
+
icon: mergeClassNames(MaskIcon, MaskIconClose),
|
|
11481
11566
|
name: CloseChat,
|
|
11482
11567
|
onClick: HandleClickClose,
|
|
11483
11568
|
title: closeChat()
|
|
@@ -11550,8 +11635,10 @@ const getChatModeDetailVirtualDom = ({
|
|
|
11550
11635
|
const selectedSessionTitle = selectedSession?.title || chatTitle();
|
|
11551
11636
|
const messages = selectedSession ? selectedSession.messages : [];
|
|
11552
11637
|
const isDropOverlayVisible = composerDropEnabled && composerDropActive;
|
|
11638
|
+
const isNewModelPickerVisible = newChatModelPickerEnabled && modelPickerOpen;
|
|
11639
|
+
const chatRootChildCount = 3 + (isDropOverlayVisible ? 1 : 0) + (isNewModelPickerVisible ? 1 : 0);
|
|
11553
11640
|
return [{
|
|
11554
|
-
childCount:
|
|
11641
|
+
childCount: chatRootChildCount,
|
|
11555
11642
|
className: mergeClassNames(Viewlet, Chat),
|
|
11556
11643
|
onDragEnter: HandleDragEnterChatView,
|
|
11557
11644
|
onDragOver: HandleDragOverChatView,
|
|
@@ -11567,7 +11654,7 @@ const getChatModeDetailVirtualDom = ({
|
|
|
11567
11654
|
}, {
|
|
11568
11655
|
text: attachImageAsContext(),
|
|
11569
11656
|
type: Text
|
|
11570
|
-
}] : [])];
|
|
11657
|
+
}] : []), ...(isNewModelPickerVisible ? getChatModelPickerPopOverVirtualDom(models, selectedModelId, modelPickerSearchValue) : [])];
|
|
11571
11658
|
};
|
|
11572
11659
|
|
|
11573
11660
|
const getChatHeaderListModeDom = (authEnabled = false, authStatus = 'signed-out', authErrorMessage = '', searchEnabled = false, searchFieldVisible = false, searchValue = '') => {
|
|
@@ -11721,10 +11808,12 @@ const getChatModeListVirtualDom = ({
|
|
|
11721
11808
|
voiceDictationEnabled = false
|
|
11722
11809
|
}) => {
|
|
11723
11810
|
const isDropOverlayVisible = composerDropEnabled && composerDropActive;
|
|
11811
|
+
const isNewModelPickerVisible = newChatModelPickerEnabled && modelPickerOpen;
|
|
11812
|
+
const chatRootChildCount = 3 + (isDropOverlayVisible ? 1 : 0) + (isNewModelPickerVisible ? 1 : 0);
|
|
11724
11813
|
const searchValueTrimmed = searchValue.trim().toLowerCase();
|
|
11725
11814
|
const visibleSessions = searchEnabled && searchValueTrimmed ? sessions.filter(session => session.title.toLowerCase().includes(searchValueTrimmed)) : sessions;
|
|
11726
11815
|
return [{
|
|
11727
|
-
childCount:
|
|
11816
|
+
childCount: chatRootChildCount,
|
|
11728
11817
|
className: mergeClassNames(Viewlet, Chat),
|
|
11729
11818
|
onDragEnter: HandleDragEnterChatView,
|
|
11730
11819
|
onDragOver: HandleDragOverChatView,
|
|
@@ -11740,7 +11829,7 @@ const getChatModeListVirtualDom = ({
|
|
|
11740
11829
|
}, {
|
|
11741
11830
|
text: attachImageAsContext(),
|
|
11742
11831
|
type: Text
|
|
11743
|
-
}] : [])];
|
|
11832
|
+
}] : []), ...(isNewModelPickerVisible ? getChatModelPickerPopOverVirtualDom(models, selectedModelId, modelPickerSearchValue) : [])];
|
|
11744
11833
|
};
|
|
11745
11834
|
|
|
11746
11835
|
const getChatModeUnsupportedVirtualDom = () => {
|
|
@@ -12295,6 +12384,10 @@ const renderEventListeners = () => {
|
|
|
12295
12384
|
}, {
|
|
12296
12385
|
name: HandleProjectListScroll,
|
|
12297
12386
|
params: ['handleProjectListScroll', 'event.target.scrollTop']
|
|
12387
|
+
}, {
|
|
12388
|
+
name: HandleProjectAddButtonContextMenu,
|
|
12389
|
+
params: ['handleProjectAddButtonContextMenu'],
|
|
12390
|
+
preventDefault: true
|
|
12298
12391
|
}, {
|
|
12299
12392
|
name: HandleProjectListContextMenu,
|
|
12300
12393
|
params: ['handleProjectListContextMenu'],
|
|
@@ -12330,8 +12423,12 @@ const renderEventListeners = () => {
|
|
|
12330
12423
|
params: ['handleSubmit'],
|
|
12331
12424
|
preventDefault: true
|
|
12332
12425
|
}, {
|
|
12333
|
-
name:
|
|
12334
|
-
params: ['
|
|
12426
|
+
name: HandleMissingOpenAiApiKeyFormSubmit,
|
|
12427
|
+
params: ['handleMissingOpenAiApiKeyFormSubmit'],
|
|
12428
|
+
preventDefault: true
|
|
12429
|
+
}, {
|
|
12430
|
+
name: HandleMissingOpenRouterApiKeyFormSubmit,
|
|
12431
|
+
params: ['handleMissingOpenRouterApiKeyFormSubmit'],
|
|
12335
12432
|
preventDefault: true
|
|
12336
12433
|
}];
|
|
12337
12434
|
};
|
|
@@ -12360,11 +12457,18 @@ const reset = async state => {
|
|
|
12360
12457
|
};
|
|
12361
12458
|
};
|
|
12362
12459
|
|
|
12363
|
-
const resize = (state, dimensions) => {
|
|
12364
|
-
|
|
12460
|
+
const resize = async (state, dimensions, getComposerHeightFn = getComposerHeight) => {
|
|
12461
|
+
const nextState = {
|
|
12365
12462
|
...state,
|
|
12366
12463
|
...dimensions
|
|
12367
12464
|
};
|
|
12465
|
+
if (dimensions.width !== undefined && dimensions.width !== state.width && nextState.composerValue) {
|
|
12466
|
+
return {
|
|
12467
|
+
...nextState,
|
|
12468
|
+
composerHeight: await getComposerHeightFn(nextState, nextState.composerValue, nextState.width)
|
|
12469
|
+
};
|
|
12470
|
+
}
|
|
12471
|
+
return nextState;
|
|
12368
12472
|
};
|
|
12369
12473
|
|
|
12370
12474
|
const saveState = state => {
|
|
@@ -12612,8 +12716,10 @@ const commandMap = {
|
|
|
12612
12716
|
'Chat.handleKeyDown': wrapCommand(handleKeyDown),
|
|
12613
12717
|
'Chat.handleMessagesContextMenu': wrapCommand(handleMessagesContextMenu),
|
|
12614
12718
|
'Chat.handleMessagesScroll': wrapCommand(handleMessagesScroll),
|
|
12615
|
-
'Chat.
|
|
12719
|
+
'Chat.handleMissingOpenAiApiKeyFormSubmit': wrapCommand(handleMissingOpenAiApiKeyFormSubmit),
|
|
12720
|
+
'Chat.handleMissingOpenRouterApiKeyFormSubmit': wrapCommand(handleMissingOpenRouterApiKeyFormSubmit),
|
|
12616
12721
|
'Chat.handleModelChange': wrapCommand(handleModelChange),
|
|
12722
|
+
'Chat.handleProjectAddButtonContextMenu': wrapCommand(handleProjectAddButtonContextMenu),
|
|
12617
12723
|
'Chat.handleProjectListContextMenu': wrapCommand(handleProjectListContextMenu),
|
|
12618
12724
|
'Chat.handleProjectListScroll': wrapCommand(handleProjectListScroll),
|
|
12619
12725
|
'Chat.handleRunModeChange': wrapCommand(handleRunModeChange),
|