@lvce-editor/chat-view 6.13.0 → 6.14.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 +269 -133
- package/package.json +1 -1
|
@@ -1486,6 +1486,12 @@ const backToChats = () => {
|
|
|
1486
1486
|
const settings = () => {
|
|
1487
1487
|
return i18nString('Settings');
|
|
1488
1488
|
};
|
|
1489
|
+
const search = () => {
|
|
1490
|
+
return i18nString('Search');
|
|
1491
|
+
};
|
|
1492
|
+
const searchChats = () => {
|
|
1493
|
+
return i18nString('Search chats');
|
|
1494
|
+
};
|
|
1489
1495
|
const loginToBackend = () => {
|
|
1490
1496
|
return i18nString('Login to backend');
|
|
1491
1497
|
};
|
|
@@ -1528,6 +1534,9 @@ const sendMessage = () => {
|
|
|
1528
1534
|
const startVoiceDictation = () => {
|
|
1529
1535
|
return i18nString('Start voice dictation');
|
|
1530
1536
|
};
|
|
1537
|
+
const addContext = () => {
|
|
1538
|
+
return i18nString('Add Context');
|
|
1539
|
+
};
|
|
1531
1540
|
const save = () => {
|
|
1532
1541
|
return i18nString('Save');
|
|
1533
1542
|
};
|
|
@@ -1652,6 +1661,7 @@ const createDefaultState = () => {
|
|
|
1652
1661
|
const composerFontSize = 13;
|
|
1653
1662
|
const composerLineHeight = 20;
|
|
1654
1663
|
return {
|
|
1664
|
+
addContextButtonEnabled: false,
|
|
1655
1665
|
aiSessionTitleGenerationEnabled: false,
|
|
1656
1666
|
assetDir: '',
|
|
1657
1667
|
authAccessToken: '',
|
|
@@ -1715,6 +1725,9 @@ const createDefaultState = () => {
|
|
|
1715
1725
|
questionToolEnabled: false,
|
|
1716
1726
|
renamingSessionId: '',
|
|
1717
1727
|
runMode: 'local',
|
|
1728
|
+
searchEnabled: false,
|
|
1729
|
+
searchFieldVisible: false,
|
|
1730
|
+
searchValue: '',
|
|
1718
1731
|
selectedModelId: defaultModelId,
|
|
1719
1732
|
selectedProjectId: defaultProjectId,
|
|
1720
1733
|
selectedSessionId: defaultSessionId,
|
|
@@ -2546,7 +2559,7 @@ const isEqualProjectExpandedIds = (a, b) => {
|
|
|
2546
2559
|
return true;
|
|
2547
2560
|
};
|
|
2548
2561
|
const isEqual = (oldState, newState) => {
|
|
2549
|
-
return oldState.authEnabled === newState.authEnabled && oldState.authErrorMessage === newState.authErrorMessage && oldState.authStatus === newState.authStatus && oldState.composerDropActive === newState.composerDropActive && oldState.composerDropEnabled === newState.composerDropEnabled && oldState.composerValue === newState.composerValue && oldState.initial === newState.initial && isEqualProjectExpandedIds(oldState.projectExpandedIds, newState.projectExpandedIds) && oldState.projectListScrollTop === newState.projectListScrollTop && oldState.renamingSessionId === newState.renamingSessionId && oldState.selectedModelId === newState.selectedModelId && oldState.selectedProjectId === newState.selectedProjectId && oldState.selectedSessionId === newState.selectedSessionId && oldState.showRunMode === newState.showRunMode && oldState.runMode === newState.runMode && oldState.sessions === newState.sessions && oldState.tokensMax === newState.tokensMax && oldState.tokensUsed === newState.tokensUsed && oldState.usageOverviewEnabled === newState.usageOverviewEnabled && oldState.useChatMathWorker === newState.useChatMathWorker && oldState.viewMode === newState.viewMode && oldState.voiceDictationEnabled === newState.voiceDictationEnabled;
|
|
2562
|
+
return oldState.addContextButtonEnabled === newState.addContextButtonEnabled && oldState.authEnabled === newState.authEnabled && oldState.authErrorMessage === newState.authErrorMessage && oldState.authStatus === newState.authStatus && oldState.composerDropActive === newState.composerDropActive && oldState.composerDropEnabled === newState.composerDropEnabled && oldState.composerValue === newState.composerValue && oldState.initial === newState.initial && isEqualProjectExpandedIds(oldState.projectExpandedIds, newState.projectExpandedIds) && oldState.projectListScrollTop === newState.projectListScrollTop && oldState.renamingSessionId === newState.renamingSessionId && oldState.selectedModelId === newState.selectedModelId && oldState.selectedProjectId === newState.selectedProjectId && oldState.selectedSessionId === newState.selectedSessionId && oldState.showRunMode === newState.showRunMode && oldState.runMode === newState.runMode && oldState.sessions === newState.sessions && oldState.tokensMax === newState.tokensMax && oldState.tokensUsed === newState.tokensUsed && oldState.usageOverviewEnabled === newState.usageOverviewEnabled && oldState.useChatMathWorker === newState.useChatMathWorker && oldState.viewMode === newState.viewMode && oldState.voiceDictationEnabled === newState.voiceDictationEnabled;
|
|
2550
2563
|
};
|
|
2551
2564
|
|
|
2552
2565
|
const diffScrollTop = (oldState, newState) => {
|
|
@@ -7667,13 +7680,16 @@ const handleClickSend = async state => {
|
|
|
7667
7680
|
};
|
|
7668
7681
|
|
|
7669
7682
|
const Composer = 'composer';
|
|
7683
|
+
const Search = 'search';
|
|
7670
7684
|
const ComposerDropTarget = 'composer-drop-target';
|
|
7685
|
+
const AddContext = 'add-context';
|
|
7671
7686
|
const Dictate = 'dictate';
|
|
7672
7687
|
const Send = 'send';
|
|
7673
7688
|
const Back = 'back';
|
|
7674
7689
|
const Model = 'model';
|
|
7675
7690
|
const RunMode = 'runMode';
|
|
7676
7691
|
const ToggleChatFocus = 'toggle-chat-focus';
|
|
7692
|
+
const ToggleSearch = 'toggle-search';
|
|
7677
7693
|
const CreateProject = 'create-project';
|
|
7678
7694
|
const CreateSession = 'create-session';
|
|
7679
7695
|
const CreateSessionInProjectPrefix = 'create-session-in-project:';
|
|
@@ -7852,6 +7868,12 @@ const handleClick = async (state, name, id = '') => {
|
|
|
7852
7868
|
}
|
|
7853
7869
|
case name === ToggleChatFocus:
|
|
7854
7870
|
return toggleChatFocusMode(state);
|
|
7871
|
+
case name === ToggleSearch:
|
|
7872
|
+
return {
|
|
7873
|
+
...state,
|
|
7874
|
+
searchFieldVisible: !state.searchFieldVisible,
|
|
7875
|
+
searchValue: state.searchFieldVisible ? '' : state.searchValue
|
|
7876
|
+
};
|
|
7855
7877
|
case isProjectInputName(name):
|
|
7856
7878
|
{
|
|
7857
7879
|
const projectId = getProjectIdFromInputName(name);
|
|
@@ -8029,6 +8051,13 @@ const handleDropFiles = async (state, name, files = []) => {
|
|
|
8029
8051
|
return nextState;
|
|
8030
8052
|
};
|
|
8031
8053
|
|
|
8054
|
+
const handleSearchValueChange = (state, newValue) => {
|
|
8055
|
+
return {
|
|
8056
|
+
...state,
|
|
8057
|
+
searchValue: newValue
|
|
8058
|
+
};
|
|
8059
|
+
};
|
|
8060
|
+
|
|
8032
8061
|
const handleInput = async (state, name, value, inputSource = 'user') => {
|
|
8033
8062
|
const {
|
|
8034
8063
|
selectedSessionId
|
|
@@ -8045,6 +8074,9 @@ const handleInput = async (state, name, value, inputSource = 'user') => {
|
|
|
8045
8074
|
openRouterApiKeyInput: value
|
|
8046
8075
|
};
|
|
8047
8076
|
}
|
|
8077
|
+
if (name === Search) {
|
|
8078
|
+
return handleSearchValueChange(state, value);
|
|
8079
|
+
}
|
|
8048
8080
|
if (name !== Composer) {
|
|
8049
8081
|
return state;
|
|
8050
8082
|
}
|
|
@@ -8255,6 +8287,13 @@ const initialize = async () => {
|
|
|
8255
8287
|
set$4(rpc);
|
|
8256
8288
|
};
|
|
8257
8289
|
|
|
8290
|
+
const ensureBlankProject = (projects, fallbackBlankProject) => {
|
|
8291
|
+
if (projects.some(project => project.name === '_blank')) {
|
|
8292
|
+
return projects;
|
|
8293
|
+
}
|
|
8294
|
+
return [fallbackBlankProject, ...projects];
|
|
8295
|
+
};
|
|
8296
|
+
|
|
8258
8297
|
const isObject$1 = value => {
|
|
8259
8298
|
return typeof value === 'object' && value !== null;
|
|
8260
8299
|
};
|
|
@@ -8272,6 +8311,32 @@ const getSavedChatListScrollTop = savedState => {
|
|
|
8272
8311
|
return chatListScrollTop;
|
|
8273
8312
|
};
|
|
8274
8313
|
|
|
8314
|
+
const getSavedComposerValue = savedState => {
|
|
8315
|
+
if (!isObject$1(savedState)) {
|
|
8316
|
+
return undefined;
|
|
8317
|
+
}
|
|
8318
|
+
const {
|
|
8319
|
+
composerValue
|
|
8320
|
+
} = savedState;
|
|
8321
|
+
if (typeof composerValue !== 'string') {
|
|
8322
|
+
return undefined;
|
|
8323
|
+
}
|
|
8324
|
+
return composerValue;
|
|
8325
|
+
};
|
|
8326
|
+
|
|
8327
|
+
const getSavedLastNormalViewMode = savedState => {
|
|
8328
|
+
if (!isObject$1(savedState)) {
|
|
8329
|
+
return undefined;
|
|
8330
|
+
}
|
|
8331
|
+
const {
|
|
8332
|
+
lastNormalViewMode
|
|
8333
|
+
} = savedState;
|
|
8334
|
+
if (lastNormalViewMode !== 'list' && lastNormalViewMode !== 'detail') {
|
|
8335
|
+
return undefined;
|
|
8336
|
+
}
|
|
8337
|
+
return lastNormalViewMode;
|
|
8338
|
+
};
|
|
8339
|
+
|
|
8275
8340
|
const getSavedMessagesScrollTop = savedState => {
|
|
8276
8341
|
if (!isObject$1(savedState)) {
|
|
8277
8342
|
return undefined;
|
|
@@ -8285,6 +8350,58 @@ const getSavedMessagesScrollTop = savedState => {
|
|
|
8285
8350
|
return messagesScrollTop;
|
|
8286
8351
|
};
|
|
8287
8352
|
|
|
8353
|
+
const getSavedProjectExpandedIds = savedState => {
|
|
8354
|
+
if (!isObject$1(savedState)) {
|
|
8355
|
+
return undefined;
|
|
8356
|
+
}
|
|
8357
|
+
const {
|
|
8358
|
+
projectExpandedIds
|
|
8359
|
+
} = savedState;
|
|
8360
|
+
if (!Array.isArray(projectExpandedIds)) {
|
|
8361
|
+
return undefined;
|
|
8362
|
+
}
|
|
8363
|
+
const ids = projectExpandedIds.filter(id => typeof id === 'string');
|
|
8364
|
+
if (ids.length === 0) {
|
|
8365
|
+
return undefined;
|
|
8366
|
+
}
|
|
8367
|
+
return ids;
|
|
8368
|
+
};
|
|
8369
|
+
|
|
8370
|
+
const getSavedProjectListScrollTop = savedState => {
|
|
8371
|
+
if (!isObject$1(savedState)) {
|
|
8372
|
+
return undefined;
|
|
8373
|
+
}
|
|
8374
|
+
const {
|
|
8375
|
+
projectListScrollTop
|
|
8376
|
+
} = savedState;
|
|
8377
|
+
if (typeof projectListScrollTop !== 'number') {
|
|
8378
|
+
return undefined;
|
|
8379
|
+
}
|
|
8380
|
+
return projectListScrollTop;
|
|
8381
|
+
};
|
|
8382
|
+
|
|
8383
|
+
const getSavedProjects = savedState => {
|
|
8384
|
+
if (!isObject$1(savedState)) {
|
|
8385
|
+
return undefined;
|
|
8386
|
+
}
|
|
8387
|
+
const {
|
|
8388
|
+
projects
|
|
8389
|
+
} = savedState;
|
|
8390
|
+
if (!Array.isArray(projects)) {
|
|
8391
|
+
return undefined;
|
|
8392
|
+
}
|
|
8393
|
+
const validProjects = projects.filter(project => {
|
|
8394
|
+
if (!isObject$1(project)) {
|
|
8395
|
+
return false;
|
|
8396
|
+
}
|
|
8397
|
+
return typeof project.id === 'string' && typeof project.name === 'string' && typeof project.uri === 'string';
|
|
8398
|
+
});
|
|
8399
|
+
if (validProjects.length === 0) {
|
|
8400
|
+
return undefined;
|
|
8401
|
+
}
|
|
8402
|
+
return validProjects;
|
|
8403
|
+
};
|
|
8404
|
+
|
|
8288
8405
|
const getSavedSelectedModelId = savedState => {
|
|
8289
8406
|
if (!isObject$1(savedState)) {
|
|
8290
8407
|
return undefined;
|
|
@@ -8298,6 +8415,19 @@ const getSavedSelectedModelId = savedState => {
|
|
|
8298
8415
|
return selectedModelId;
|
|
8299
8416
|
};
|
|
8300
8417
|
|
|
8418
|
+
const getSavedSelectedProjectId = savedState => {
|
|
8419
|
+
if (!isObject$1(savedState)) {
|
|
8420
|
+
return undefined;
|
|
8421
|
+
}
|
|
8422
|
+
const {
|
|
8423
|
+
selectedProjectId
|
|
8424
|
+
} = savedState;
|
|
8425
|
+
if (typeof selectedProjectId !== 'string') {
|
|
8426
|
+
return undefined;
|
|
8427
|
+
}
|
|
8428
|
+
return selectedProjectId;
|
|
8429
|
+
};
|
|
8430
|
+
|
|
8301
8431
|
const getSavedSelectedSessionId = savedState => {
|
|
8302
8432
|
if (!isObject$1(savedState)) {
|
|
8303
8433
|
return undefined;
|
|
@@ -8435,6 +8565,15 @@ const loadPassIncludeObfuscation = async () => {
|
|
|
8435
8565
|
}
|
|
8436
8566
|
};
|
|
8437
8567
|
|
|
8568
|
+
const loadSearchEnabled = async () => {
|
|
8569
|
+
try {
|
|
8570
|
+
const savedSearchEnabled = await get('chatView.searchEnabled');
|
|
8571
|
+
return typeof savedSearchEnabled === 'boolean' ? savedSearchEnabled : false;
|
|
8572
|
+
} catch {
|
|
8573
|
+
return false;
|
|
8574
|
+
}
|
|
8575
|
+
};
|
|
8576
|
+
|
|
8438
8577
|
const loadStreamingEnabled = async () => {
|
|
8439
8578
|
try {
|
|
8440
8579
|
const savedStreamingEnabled = await get('chatView.streamingEnabled');
|
|
@@ -8499,7 +8638,7 @@ const loadVoiceDictationEnabled = async () => {
|
|
|
8499
8638
|
};
|
|
8500
8639
|
|
|
8501
8640
|
const loadPreferences = async () => {
|
|
8502
|
-
const [aiSessionTitleGenerationEnabled, authAccessToken, authEnabled, authRefreshToken, backendUrl, composerDropEnabled, openApiApiKey, openRouterApiKey, emitStreamingFunctionCallEvents, streamingEnabled, todoListToolEnabled, passIncludeObfuscation, useChatCoordinatorWorker, useChatMathWorker, useChatNetworkWorkerForRequests, useChatToolWorker, voiceDictationEnabled] = await Promise.all([loadAiSessionTitleGenerationEnabled(), loadBackendAccessToken(), loadAuthEnabled(), loadBackendRefreshToken(), loadBackendUrl(), loadComposerDropEnabled(), loadOpenApiApiKey(), loadOpenRouterApiKey(), loadEmitStreamingFunctionCallEvents(), loadStreamingEnabled(), loadTodoListToolEnabled(), loadPassIncludeObfuscation(), loadUseChatCoordinatorWorker(), loadUseChatMathWorker(), loadUseChatNetworkWorkerForRequests(), loadUseChatToolWorker(), loadVoiceDictationEnabled()]);
|
|
8641
|
+
const [aiSessionTitleGenerationEnabled, authAccessToken, authEnabled, authRefreshToken, backendUrl, composerDropEnabled, openApiApiKey, openRouterApiKey, emitStreamingFunctionCallEvents, searchEnabled, streamingEnabled, todoListToolEnabled, passIncludeObfuscation, useChatCoordinatorWorker, useChatMathWorker, useChatNetworkWorkerForRequests, useChatToolWorker, voiceDictationEnabled] = await Promise.all([loadAiSessionTitleGenerationEnabled(), loadBackendAccessToken(), loadAuthEnabled(), loadBackendRefreshToken(), loadBackendUrl(), loadComposerDropEnabled(), loadOpenApiApiKey(), loadOpenRouterApiKey(), loadEmitStreamingFunctionCallEvents(), loadSearchEnabled(), loadStreamingEnabled(), loadTodoListToolEnabled(), loadPassIncludeObfuscation(), loadUseChatCoordinatorWorker(), loadUseChatMathWorker(), loadUseChatNetworkWorkerForRequests(), loadUseChatToolWorker(), loadVoiceDictationEnabled()]);
|
|
8503
8642
|
return {
|
|
8504
8643
|
aiSessionTitleGenerationEnabled,
|
|
8505
8644
|
authAccessToken,
|
|
@@ -8511,6 +8650,7 @@ const loadPreferences = async () => {
|
|
|
8511
8650
|
openApiApiKey,
|
|
8512
8651
|
openRouterApiKey,
|
|
8513
8652
|
passIncludeObfuscation,
|
|
8653
|
+
searchEnabled,
|
|
8514
8654
|
streamingEnabled,
|
|
8515
8655
|
todoListToolEnabled,
|
|
8516
8656
|
useChatCoordinatorWorker,
|
|
@@ -8551,97 +8691,7 @@ const toSummarySession = session => {
|
|
|
8551
8691
|
projectId: session.projectId
|
|
8552
8692
|
};
|
|
8553
8693
|
};
|
|
8554
|
-
|
|
8555
|
-
if (!isObject$1(savedState)) {
|
|
8556
|
-
return undefined;
|
|
8557
|
-
}
|
|
8558
|
-
const {
|
|
8559
|
-
selectedProjectId
|
|
8560
|
-
} = savedState;
|
|
8561
|
-
if (typeof selectedProjectId !== 'string') {
|
|
8562
|
-
return undefined;
|
|
8563
|
-
}
|
|
8564
|
-
return selectedProjectId;
|
|
8565
|
-
};
|
|
8566
|
-
const getSavedProjects = savedState => {
|
|
8567
|
-
if (!isObject$1(savedState)) {
|
|
8568
|
-
return undefined;
|
|
8569
|
-
}
|
|
8570
|
-
const {
|
|
8571
|
-
projects
|
|
8572
|
-
} = savedState;
|
|
8573
|
-
if (!Array.isArray(projects)) {
|
|
8574
|
-
return undefined;
|
|
8575
|
-
}
|
|
8576
|
-
const validProjects = projects.filter(project => {
|
|
8577
|
-
if (!isObject$1(project)) {
|
|
8578
|
-
return false;
|
|
8579
|
-
}
|
|
8580
|
-
return typeof project.id === 'string' && typeof project.name === 'string' && typeof project.uri === 'string';
|
|
8581
|
-
});
|
|
8582
|
-
if (validProjects.length === 0) {
|
|
8583
|
-
return undefined;
|
|
8584
|
-
}
|
|
8585
|
-
return validProjects;
|
|
8586
|
-
};
|
|
8587
|
-
const ensureBlankProject = (projects, fallbackBlankProject) => {
|
|
8588
|
-
if (projects.some(project => project.name === '_blank')) {
|
|
8589
|
-
return projects;
|
|
8590
|
-
}
|
|
8591
|
-
return [fallbackBlankProject, ...projects];
|
|
8592
|
-
};
|
|
8593
|
-
const getSavedProjectListScrollTop = savedState => {
|
|
8594
|
-
if (!isObject$1(savedState)) {
|
|
8595
|
-
return undefined;
|
|
8596
|
-
}
|
|
8597
|
-
const {
|
|
8598
|
-
projectListScrollTop
|
|
8599
|
-
} = savedState;
|
|
8600
|
-
if (typeof projectListScrollTop !== 'number') {
|
|
8601
|
-
return undefined;
|
|
8602
|
-
}
|
|
8603
|
-
return projectListScrollTop;
|
|
8604
|
-
};
|
|
8605
|
-
const getSavedProjectExpandedIds = savedState => {
|
|
8606
|
-
if (!isObject$1(savedState)) {
|
|
8607
|
-
return undefined;
|
|
8608
|
-
}
|
|
8609
|
-
const {
|
|
8610
|
-
projectExpandedIds
|
|
8611
|
-
} = savedState;
|
|
8612
|
-
if (!Array.isArray(projectExpandedIds)) {
|
|
8613
|
-
return undefined;
|
|
8614
|
-
}
|
|
8615
|
-
const ids = projectExpandedIds.filter(id => typeof id === 'string');
|
|
8616
|
-
if (ids.length === 0) {
|
|
8617
|
-
return undefined;
|
|
8618
|
-
}
|
|
8619
|
-
return ids;
|
|
8620
|
-
};
|
|
8621
|
-
const getSavedLastNormalViewMode = savedState => {
|
|
8622
|
-
if (!isObject$1(savedState)) {
|
|
8623
|
-
return undefined;
|
|
8624
|
-
}
|
|
8625
|
-
const {
|
|
8626
|
-
lastNormalViewMode
|
|
8627
|
-
} = savedState;
|
|
8628
|
-
if (lastNormalViewMode !== 'list' && lastNormalViewMode !== 'detail') {
|
|
8629
|
-
return undefined;
|
|
8630
|
-
}
|
|
8631
|
-
return lastNormalViewMode;
|
|
8632
|
-
};
|
|
8633
|
-
const getSavedComposerValue = savedState => {
|
|
8634
|
-
if (!isObject$1(savedState)) {
|
|
8635
|
-
return undefined;
|
|
8636
|
-
}
|
|
8637
|
-
const {
|
|
8638
|
-
composerValue
|
|
8639
|
-
} = savedState;
|
|
8640
|
-
if (typeof composerValue !== 'string') {
|
|
8641
|
-
return undefined;
|
|
8642
|
-
}
|
|
8643
|
-
return composerValue;
|
|
8644
|
-
};
|
|
8694
|
+
|
|
8645
8695
|
const loadContent = async (state, savedState) => {
|
|
8646
8696
|
const savedSelectedModelId = getSavedSelectedModelId(savedState);
|
|
8647
8697
|
const savedViewMode = getSavedViewMode(savedState);
|
|
@@ -8657,6 +8707,7 @@ const loadContent = async (state, savedState) => {
|
|
|
8657
8707
|
openApiApiKey,
|
|
8658
8708
|
openRouterApiKey,
|
|
8659
8709
|
passIncludeObfuscation,
|
|
8710
|
+
searchEnabled,
|
|
8660
8711
|
streamingEnabled,
|
|
8661
8712
|
todoListToolEnabled,
|
|
8662
8713
|
useChatCoordinatorWorker,
|
|
@@ -8736,6 +8787,9 @@ const loadContent = async (state, savedState) => {
|
|
|
8736
8787
|
projectExpandedIds,
|
|
8737
8788
|
projectListScrollTop,
|
|
8738
8789
|
projects,
|
|
8790
|
+
searchEnabled,
|
|
8791
|
+
searchFieldVisible: false,
|
|
8792
|
+
searchValue: '',
|
|
8739
8793
|
selectedModelId,
|
|
8740
8794
|
selectedProjectId,
|
|
8741
8795
|
selectedSessionId,
|
|
@@ -8859,10 +8913,11 @@ const registerMockResponse = (state, mockResponse) => {
|
|
|
8859
8913
|
};
|
|
8860
8914
|
|
|
8861
8915
|
const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessageLineHeight, chatMessageFontFamily, textAreaPaddingTop, textAreaPaddingLeft, textAreaPaddingRight, textAreaPaddingBottom, chatSendAreaPaddingTop, chatSendAreaPaddingLeft, chatSendAreaPaddingRight, chatSendAreaPaddingBottom, renderHtmlCss) => {
|
|
8916
|
+
const chatSendAreaHeight = composerHeight + chatSendAreaPaddingTop + chatSendAreaPaddingBottom;
|
|
8862
8917
|
const baseCss = `:root {
|
|
8863
8918
|
--ChatInputBoxHeight: ${composerHeight}px;
|
|
8864
8919
|
--ChatTextAreaHeight: ${composerHeight}px;
|
|
8865
|
-
--ChatSendAreaHeight: ${
|
|
8920
|
+
--ChatSendAreaHeight: ${chatSendAreaHeight}px;
|
|
8866
8921
|
--ChatTextAreaPaddingTop: ${textAreaPaddingTop}px;
|
|
8867
8922
|
--ChatTextAreaPaddingLeft: ${textAreaPaddingLeft}px;
|
|
8868
8923
|
--ChatTextAreaPaddingRight: ${textAreaPaddingRight}px;
|
|
@@ -9177,6 +9232,7 @@ const TokenTag = 'TokenTag';
|
|
|
9177
9232
|
const TokenAttribute = 'TokenAttribute';
|
|
9178
9233
|
const TokenValue = 'TokenValue';
|
|
9179
9234
|
const TokenProperty = 'TokenProperty';
|
|
9235
|
+
const SearchFieldContainer = 'SearchFieldContainer';
|
|
9180
9236
|
const Select = 'Select';
|
|
9181
9237
|
const StrikeThrough = 'StrikeThrough';
|
|
9182
9238
|
const Viewlet = 'Viewlet';
|
|
@@ -9211,6 +9267,7 @@ const HandleProjectListContextMenu = 33;
|
|
|
9211
9267
|
const HandleClickDictationButton = 34;
|
|
9212
9268
|
const HandleMissingApiKeySubmit = 35;
|
|
9213
9269
|
const HandleRunModeChange = 36;
|
|
9270
|
+
const HandleSearchInput = 37;
|
|
9214
9271
|
|
|
9215
9272
|
const getModelLabel = model => {
|
|
9216
9273
|
if (model.provider === 'openRouter') {
|
|
@@ -9297,6 +9354,18 @@ const getSendButtonDom = (isSendDisabled, voiceDictationEnabled) => {
|
|
|
9297
9354
|
type: Div
|
|
9298
9355
|
}];
|
|
9299
9356
|
};
|
|
9357
|
+
const getAddContextButtonDom = () => {
|
|
9358
|
+
return [{
|
|
9359
|
+
childCount: 1,
|
|
9360
|
+
className: IconButton,
|
|
9361
|
+
name: AddContext,
|
|
9362
|
+
title: addContext(),
|
|
9363
|
+
type: Button$1
|
|
9364
|
+
}, {
|
|
9365
|
+
text: addContext(),
|
|
9366
|
+
type: Text
|
|
9367
|
+
}];
|
|
9368
|
+
};
|
|
9300
9369
|
|
|
9301
9370
|
const clampToPercentage = (tokensUsed, tokensMax) => {
|
|
9302
9371
|
if (tokensMax <= 0) {
|
|
@@ -9333,9 +9402,9 @@ const getUsageOverviewDom = (tokensUsed, tokensMax) => {
|
|
|
9333
9402
|
}, text(usageLabel)];
|
|
9334
9403
|
};
|
|
9335
9404
|
|
|
9336
|
-
const getChatSendAreaDom = (composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled = false) => {
|
|
9405
|
+
const getChatSendAreaDom = (composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled = false) => {
|
|
9337
9406
|
const isSendDisabled = composerValue.trim() === '';
|
|
9338
|
-
const controlsCount = 2 + (usageOverviewEnabled ? 1 : 0) + (showRunMode ? 1 : 0);
|
|
9407
|
+
const controlsCount = 2 + (usageOverviewEnabled ? 1 : 0) + (showRunMode ? 1 : 0) + (addContextButtonEnabled ? 1 : 0);
|
|
9339
9408
|
const hasTodoList = todoListToolEnabled && todoListItems.length > 0;
|
|
9340
9409
|
const todoHeaderText = `Todos (${todoListItems.filter(item => item.status === 'completed').length}/${todoListItems.length})`;
|
|
9341
9410
|
const getTodoItemClassName = status => {
|
|
@@ -9387,7 +9456,7 @@ const getChatSendAreaDom = (composerValue, models, selectedModelId, usageOvervie
|
|
|
9387
9456
|
childCount: voiceDictationEnabled ? controlsCount + 1 : controlsCount,
|
|
9388
9457
|
className: ChatSendAreaBottom,
|
|
9389
9458
|
type: Div
|
|
9390
|
-
}, ...getChatSelectVirtualDom(models, selectedModelId), ...(showRunMode ? getRunModeSelectVirtualDom(runMode) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
|
|
9459
|
+
}, ...getChatSelectVirtualDom(models, selectedModelId), ...(showRunMode ? getRunModeSelectVirtualDom(runMode) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
|
|
9391
9460
|
};
|
|
9392
9461
|
|
|
9393
9462
|
const getImageAltText = alt => {
|
|
@@ -9787,41 +9856,38 @@ const getMissingApiKeyDom = ({
|
|
|
9787
9856
|
inputName,
|
|
9788
9857
|
inputPattern,
|
|
9789
9858
|
inputRequired = false,
|
|
9790
|
-
inputValue,
|
|
9791
9859
|
openSettingsButtonName,
|
|
9792
9860
|
placeholder,
|
|
9793
9861
|
saveButtonDisabled = false,
|
|
9794
9862
|
saveButtonName,
|
|
9795
|
-
saveButtonText = save()
|
|
9796
|
-
saveButtonType = 'button',
|
|
9797
|
-
useForm = false
|
|
9863
|
+
saveButtonText = save()
|
|
9798
9864
|
}) => {
|
|
9799
9865
|
return [{
|
|
9800
9866
|
childCount: 2,
|
|
9801
|
-
method:
|
|
9802
|
-
onSubmit:
|
|
9803
|
-
type:
|
|
9867
|
+
method: 'GET',
|
|
9868
|
+
onSubmit: HandleMissingApiKeySubmit,
|
|
9869
|
+
type: Form
|
|
9804
9870
|
}, {
|
|
9805
9871
|
childCount: 0,
|
|
9806
9872
|
className: InputBox,
|
|
9807
9873
|
name: inputName,
|
|
9808
9874
|
onInput: HandleInput,
|
|
9809
|
-
|
|
9875
|
+
...(inputPattern ? {
|
|
9876
|
+
pattern: inputPattern
|
|
9877
|
+
} : {}),
|
|
9810
9878
|
placeholder,
|
|
9811
9879
|
required: inputRequired,
|
|
9812
|
-
type: Input
|
|
9813
|
-
value: inputValue
|
|
9880
|
+
type: Input
|
|
9814
9881
|
}, {
|
|
9815
9882
|
childCount: 2,
|
|
9816
9883
|
className: Actions,
|
|
9817
9884
|
type: Div
|
|
9818
9885
|
}, {
|
|
9819
|
-
buttonType: saveButtonType,
|
|
9820
9886
|
childCount: 1,
|
|
9821
9887
|
className: mergeClassNames(Button, ButtonPrimary),
|
|
9822
9888
|
disabled: saveButtonDisabled,
|
|
9889
|
+
inputType: 'submit',
|
|
9823
9890
|
name: saveButtonName,
|
|
9824
|
-
onClick: useForm ? undefined : HandleClick,
|
|
9825
9891
|
type: Button$1
|
|
9826
9892
|
}, text(saveButtonText), {
|
|
9827
9893
|
childCount: 1,
|
|
@@ -9833,34 +9899,28 @@ const getMissingApiKeyDom = ({
|
|
|
9833
9899
|
}, text(getApiKeyText)];
|
|
9834
9900
|
};
|
|
9835
9901
|
|
|
9836
|
-
const getMissingOpenApiApiKeyDom =
|
|
9902
|
+
const getMissingOpenApiApiKeyDom = () => {
|
|
9837
9903
|
return getMissingApiKeyDom({
|
|
9838
9904
|
getApiKeyText: getOpenApiApiKey(),
|
|
9839
9905
|
inputName: OpenApiApiKeyInput,
|
|
9840
9906
|
inputPattern: '^sk-.+',
|
|
9841
9907
|
inputRequired: true,
|
|
9842
|
-
inputValue: openApiApiKeyInput,
|
|
9843
9908
|
openSettingsButtonName: OpenOpenApiApiKeyWebsite,
|
|
9844
9909
|
placeholder: openApiApiKeyPlaceholder(),
|
|
9845
|
-
saveButtonName: SaveOpenApiApiKey
|
|
9846
|
-
saveButtonType: 'submit',
|
|
9847
|
-
useForm: true
|
|
9910
|
+
saveButtonName: SaveOpenApiApiKey
|
|
9848
9911
|
});
|
|
9849
9912
|
};
|
|
9850
9913
|
|
|
9851
|
-
const getMissingOpenRouterApiKeyDom = (
|
|
9914
|
+
const getMissingOpenRouterApiKeyDom = (openRouterApiKeyState = 'idle') => {
|
|
9852
9915
|
const isSaving = openRouterApiKeyState === 'saving';
|
|
9853
9916
|
return getMissingApiKeyDom({
|
|
9854
9917
|
getApiKeyText: getOpenRouterApiKey(),
|
|
9855
9918
|
inputName: OpenRouterApiKeyInput,
|
|
9856
|
-
inputValue: openRouterApiKeyInput,
|
|
9857
9919
|
openSettingsButtonName: OpenOpenRouterApiKeySettings,
|
|
9858
9920
|
placeholder: openRouterApiKeyPlaceholder(),
|
|
9859
9921
|
saveButtonDisabled: isSaving,
|
|
9860
9922
|
saveButtonName: SaveOpenRouterApiKey,
|
|
9861
|
-
saveButtonText: isSaving ? saving() : save()
|
|
9862
|
-
saveButtonType: 'submit',
|
|
9863
|
-
useForm: true
|
|
9923
|
+
saveButtonText: isSaving ? saving() : save()
|
|
9864
9924
|
});
|
|
9865
9925
|
};
|
|
9866
9926
|
|
|
@@ -10534,6 +10594,7 @@ const getToolCallWriteFileVirtualDom = toolCall => {
|
|
|
10534
10594
|
}
|
|
10535
10595
|
const fileName = getFileNameFromUri(target.title);
|
|
10536
10596
|
const statusLabel = getToolCallStatusLabel(toolCall);
|
|
10597
|
+
const showDiffStats = toolCall.status !== 'error' && toolCall.status !== 'not-found';
|
|
10537
10598
|
const {
|
|
10538
10599
|
linesAdded,
|
|
10539
10600
|
linesDeleted
|
|
@@ -10543,7 +10604,7 @@ const getToolCallWriteFileVirtualDom = toolCall => {
|
|
|
10543
10604
|
onClick: HandleClickReadFile
|
|
10544
10605
|
} : {};
|
|
10545
10606
|
return [{
|
|
10546
|
-
childCount: statusLabel ? 6 : 5,
|
|
10607
|
+
childCount: showDiffStats ? statusLabel ? 6 : 5 : statusLabel ? 4 : 3,
|
|
10547
10608
|
className: ChatOrderedListItem,
|
|
10548
10609
|
title: target.title,
|
|
10549
10610
|
type: Li
|
|
@@ -10560,7 +10621,7 @@ const getToolCallWriteFileVirtualDom = toolCall => {
|
|
|
10560
10621
|
childCount: 1,
|
|
10561
10622
|
className: ChatToolCallFileName,
|
|
10562
10623
|
type: Span
|
|
10563
|
-
}, text(fileName), {
|
|
10624
|
+
}, text(fileName), ...(showDiffStats ? [{
|
|
10564
10625
|
childCount: 1,
|
|
10565
10626
|
className: Insertion,
|
|
10566
10627
|
type: Span
|
|
@@ -10568,7 +10629,7 @@ const getToolCallWriteFileVirtualDom = toolCall => {
|
|
|
10568
10629
|
childCount: 1,
|
|
10569
10630
|
className: Deletion,
|
|
10570
10631
|
type: Span
|
|
10571
|
-
}, text(` -${linesDeleted}`), ...(statusLabel ? [text(statusLabel)] : [])];
|
|
10632
|
+
}, text(` -${linesDeleted}`)] : []), ...(statusLabel ? [text(statusLabel)] : [])];
|
|
10572
10633
|
};
|
|
10573
10634
|
|
|
10574
10635
|
const getToolCallDom = toolCall => {
|
|
@@ -10635,7 +10696,7 @@ const getToolCallsDom = message => {
|
|
|
10635
10696
|
}, ...message.toolCalls.flatMap(getToolCallDom)];
|
|
10636
10697
|
};
|
|
10637
10698
|
|
|
10638
|
-
const getChatMessageDom = (message, parsedMessageContent,
|
|
10699
|
+
const getChatMessageDom = (message, parsedMessageContent, _openRouterApiKeyInput, _openApiApiKeyInput = '', openRouterApiKeyState = 'idle', useChatMathWorker = false) => {
|
|
10639
10700
|
const roleClassName = message.role === 'user' ? MessageUser : MessageAssistant;
|
|
10640
10701
|
const isOpenApiApiKeyMissingMessage = message.role === 'assistant' && message.text === openApiApiKeyRequiredMessage;
|
|
10641
10702
|
const isOpenRouterApiKeyMissingMessage = message.role === 'assistant' && message.text === openRouterApiKeyRequiredMessage;
|
|
@@ -10653,7 +10714,7 @@ const getChatMessageDom = (message, parsedMessageContent, openRouterApiKeyInput,
|
|
|
10653
10714
|
childCount: extraChildCount,
|
|
10654
10715
|
className: ChatMessageContent,
|
|
10655
10716
|
type: Div
|
|
10656
|
-
}, ...toolCallsDom, ...messageDom, ...(isOpenApiApiKeyMissingMessage ? getMissingOpenApiApiKeyDom(
|
|
10717
|
+
}, ...toolCallsDom, ...messageDom, ...(isOpenApiApiKeyMissingMessage ? getMissingOpenApiApiKeyDom() : []), ...(isOpenRouterApiKeyMissingMessage ? getMissingOpenRouterApiKeyDom(openRouterApiKeyState) : []), ...(isOpenRouterRequestFailedMessage ? getOpenRouterRequestFailedDom() : []), ...(isOpenRouterTooManyRequestsMessage ? getOpenRouterTooManyRequestsDom() : [])];
|
|
10657
10718
|
};
|
|
10658
10719
|
|
|
10659
10720
|
const getEmptyMessagesDom = () => {
|
|
@@ -10806,6 +10867,7 @@ const getProjectListDom = (projects, sessions, projectExpandedIds, selectedProje
|
|
|
10806
10867
|
};
|
|
10807
10868
|
|
|
10808
10869
|
const getChatModeChatFocusVirtualDom = ({
|
|
10870
|
+
addContextButtonEnabled,
|
|
10809
10871
|
authEnabled = false,
|
|
10810
10872
|
authErrorMessage = '',
|
|
10811
10873
|
authStatus = 'signed-out',
|
|
@@ -10848,7 +10910,7 @@ const getChatModeChatFocusVirtualDom = ({
|
|
|
10848
10910
|
onDragEnter: HandleDragEnterChatView,
|
|
10849
10911
|
onDragOver: HandleDragOverChatView,
|
|
10850
10912
|
type: Div
|
|
10851
|
-
}, ...getProjectListDom(projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
|
|
10913
|
+
}, ...getProjectListDom(projects, sessions, projectExpandedIds, selectedProjectId, selectedSessionId, projectListScrollTop), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
|
|
10852
10914
|
childCount: 1,
|
|
10853
10915
|
className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
|
|
10854
10916
|
name: ComposerDropTarget,
|
|
@@ -10894,7 +10956,7 @@ const getHeaderActionVirtualDom = item => {
|
|
|
10894
10956
|
}];
|
|
10895
10957
|
};
|
|
10896
10958
|
|
|
10897
|
-
const getChatHeaderActionsDom = (viewMode, authEnabled = false, authStatus = 'signed-out') => {
|
|
10959
|
+
const getChatHeaderActionsDom = (viewMode, authEnabled = false, authStatus = 'signed-out', searchEnabled = false) => {
|
|
10898
10960
|
const toggleTitle = viewMode === 'chat-focus' ? normalChatMode() : chatFocusMode();
|
|
10899
10961
|
const isSigningIn = authStatus === 'signing-in';
|
|
10900
10962
|
const authAction = authEnabled && authStatus !== 'signed-in' ? {
|
|
@@ -10915,7 +10977,12 @@ const getChatHeaderActionsDom = (viewMode, authEnabled = false, authStatus = 'si
|
|
|
10915
10977
|
name: ToggleChatFocus,
|
|
10916
10978
|
onClick: HandleClick,
|
|
10917
10979
|
title: toggleTitle
|
|
10918
|
-
}, {
|
|
10980
|
+
}, ...(searchEnabled ? [{
|
|
10981
|
+
icon: 'MaskIcon MaskIconSearch',
|
|
10982
|
+
name: ToggleSearch,
|
|
10983
|
+
onClick: HandleClick,
|
|
10984
|
+
title: search()
|
|
10985
|
+
}] : []), {
|
|
10919
10986
|
icon: 'MaskIcon MaskIconDebugPause',
|
|
10920
10987
|
name: SessionDebug,
|
|
10921
10988
|
onClick: HandleClickSessionDebug,
|
|
@@ -10965,6 +11032,7 @@ const getChatHeaderDomDetailMode = (selectedSessionTitle, authEnabled = false, a
|
|
|
10965
11032
|
};
|
|
10966
11033
|
|
|
10967
11034
|
const getChatModeDetailVirtualDom = ({
|
|
11035
|
+
addContextButtonEnabled,
|
|
10968
11036
|
authEnabled = false,
|
|
10969
11037
|
authErrorMessage = '',
|
|
10970
11038
|
authStatus = 'signed-out',
|
|
@@ -11004,7 +11072,7 @@ const getChatModeDetailVirtualDom = ({
|
|
|
11004
11072
|
onDragEnter: HandleDragEnterChatView,
|
|
11005
11073
|
onDragOver: HandleDragOverChatView,
|
|
11006
11074
|
type: Div
|
|
11007
|
-
}, ...getChatHeaderDomDetailMode(selectedSessionTitle, authEnabled, authStatus, authErrorMessage), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
|
|
11075
|
+
}, ...getChatHeaderDomDetailMode(selectedSessionTitle, authEnabled, authStatus, authErrorMessage), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
|
|
11008
11076
|
childCount: 1,
|
|
11009
11077
|
className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
|
|
11010
11078
|
name: ComposerDropTarget,
|
|
@@ -11018,17 +11086,32 @@ const getChatModeDetailVirtualDom = ({
|
|
|
11018
11086
|
}] : [])];
|
|
11019
11087
|
};
|
|
11020
11088
|
|
|
11021
|
-
const getChatHeaderListModeDom = (authEnabled = false, authStatus = 'signed-out', authErrorMessage = '') => {
|
|
11089
|
+
const getChatHeaderListModeDom = (authEnabled = false, authStatus = 'signed-out', authErrorMessage = '', searchEnabled = false, searchFieldVisible = false, searchValue = '') => {
|
|
11022
11090
|
const hasAuthError = authEnabled && !!authErrorMessage;
|
|
11091
|
+
const hasSearchField = searchEnabled && searchFieldVisible;
|
|
11092
|
+
const headerChildCount = 2 + (hasAuthError ? 1 : 0) + (hasSearchField ? 1 : 0);
|
|
11023
11093
|
return [{
|
|
11024
|
-
childCount:
|
|
11094
|
+
childCount: headerChildCount,
|
|
11025
11095
|
className: ChatHeader,
|
|
11026
11096
|
type: Div
|
|
11027
11097
|
}, {
|
|
11028
11098
|
childCount: 1,
|
|
11029
11099
|
className: Label,
|
|
11030
11100
|
type: Span
|
|
11031
|
-
}, text(chats()), ...getChatHeaderActionsDom('list', authEnabled, authStatus), ...(
|
|
11101
|
+
}, text(chats()), ...getChatHeaderActionsDom('list', authEnabled, authStatus, searchEnabled), ...(hasSearchField ? [{
|
|
11102
|
+
childCount: 1,
|
|
11103
|
+
className: SearchFieldContainer,
|
|
11104
|
+
type: Div
|
|
11105
|
+
}, {
|
|
11106
|
+
childCount: 0,
|
|
11107
|
+
className: InputBox,
|
|
11108
|
+
inputType: 'search',
|
|
11109
|
+
name: Search,
|
|
11110
|
+
onInput: HandleSearchInput,
|
|
11111
|
+
placeholder: searchChats(),
|
|
11112
|
+
type: Input,
|
|
11113
|
+
value: searchValue
|
|
11114
|
+
}] : []), ...(hasAuthError ? [{
|
|
11032
11115
|
childCount: 1,
|
|
11033
11116
|
className: ChatAuthError,
|
|
11034
11117
|
type: Span
|
|
@@ -11091,6 +11174,7 @@ const getChatListDom = (sessions, selectedSessionId, chatListScrollTop = 0) => {
|
|
|
11091
11174
|
};
|
|
11092
11175
|
|
|
11093
11176
|
const getChatModeListVirtualDom = ({
|
|
11177
|
+
addContextButtonEnabled,
|
|
11094
11178
|
authEnabled = false,
|
|
11095
11179
|
authErrorMessage = '',
|
|
11096
11180
|
authStatus = 'signed-out',
|
|
@@ -11104,6 +11188,9 @@ const getChatModeListVirtualDom = ({
|
|
|
11104
11188
|
composerValue,
|
|
11105
11189
|
models,
|
|
11106
11190
|
runMode,
|
|
11191
|
+
searchEnabled = false,
|
|
11192
|
+
searchFieldVisible = false,
|
|
11193
|
+
searchValue = '',
|
|
11107
11194
|
selectedModelId,
|
|
11108
11195
|
selectedSessionId,
|
|
11109
11196
|
sessions,
|
|
@@ -11116,13 +11203,15 @@ const getChatModeListVirtualDom = ({
|
|
|
11116
11203
|
voiceDictationEnabled = false
|
|
11117
11204
|
}) => {
|
|
11118
11205
|
const isDropOverlayVisible = composerDropEnabled && composerDropActive;
|
|
11206
|
+
const searchValueTrimmed = searchValue.trim().toLowerCase();
|
|
11207
|
+
const visibleSessions = searchEnabled && searchValueTrimmed ? sessions.filter(session => session.title.toLowerCase().includes(searchValueTrimmed)) : sessions;
|
|
11119
11208
|
return [{
|
|
11120
11209
|
childCount: isDropOverlayVisible ? 4 : 3,
|
|
11121
11210
|
className: mergeClassNames(Viewlet, Chat),
|
|
11122
11211
|
onDragEnter: HandleDragEnterChatView,
|
|
11123
11212
|
onDragOver: HandleDragOverChatView,
|
|
11124
11213
|
type: Div
|
|
11125
|
-
}, ...getChatHeaderListModeDom(authEnabled, authStatus, authErrorMessage), ...getChatListDom(
|
|
11214
|
+
}, ...getChatHeaderListModeDom(authEnabled, authStatus, authErrorMessage, searchEnabled, searchFieldVisible, searchValue), ...getChatListDom(visibleSessions, selectedSessionId, chatListScrollTop), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
|
|
11126
11215
|
childCount: 1,
|
|
11127
11216
|
className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
|
|
11128
11217
|
name: ComposerDropTarget,
|
|
@@ -11217,6 +11306,7 @@ const getFallbackParsedMessages = sessions => {
|
|
|
11217
11306
|
};
|
|
11218
11307
|
const getChatVirtualDom = options => {
|
|
11219
11308
|
const {
|
|
11309
|
+
addContextButtonEnabled,
|
|
11220
11310
|
authEnabled = false,
|
|
11221
11311
|
authErrorMessage = '',
|
|
11222
11312
|
authStatus = 'signed-out',
|
|
@@ -11238,6 +11328,9 @@ const getChatVirtualDom = options => {
|
|
|
11238
11328
|
projectListScrollTop = 0,
|
|
11239
11329
|
projects = [],
|
|
11240
11330
|
runMode,
|
|
11331
|
+
searchEnabled = false,
|
|
11332
|
+
searchFieldVisible = false,
|
|
11333
|
+
searchValue = '',
|
|
11241
11334
|
selectedModelId,
|
|
11242
11335
|
selectedProjectId = '',
|
|
11243
11336
|
selectedSessionId,
|
|
@@ -11256,6 +11349,7 @@ const getChatVirtualDom = options => {
|
|
|
11256
11349
|
switch (viewMode) {
|
|
11257
11350
|
case 'chat-focus':
|
|
11258
11351
|
return getChatModeChatFocusVirtualDom({
|
|
11352
|
+
addContextButtonEnabled,
|
|
11259
11353
|
authEnabled,
|
|
11260
11354
|
authErrorMessage,
|
|
11261
11355
|
authStatus,
|
|
@@ -11291,6 +11385,7 @@ const getChatVirtualDom = options => {
|
|
|
11291
11385
|
});
|
|
11292
11386
|
case 'detail':
|
|
11293
11387
|
return getChatModeDetailVirtualDom({
|
|
11388
|
+
addContextButtonEnabled,
|
|
11294
11389
|
authEnabled,
|
|
11295
11390
|
authErrorMessage,
|
|
11296
11391
|
authStatus,
|
|
@@ -11322,6 +11417,7 @@ const getChatVirtualDom = options => {
|
|
|
11322
11417
|
});
|
|
11323
11418
|
case 'list':
|
|
11324
11419
|
return getChatModeListVirtualDom({
|
|
11420
|
+
addContextButtonEnabled,
|
|
11325
11421
|
authEnabled,
|
|
11326
11422
|
authErrorMessage,
|
|
11327
11423
|
authStatus,
|
|
@@ -11335,6 +11431,9 @@ const getChatVirtualDom = options => {
|
|
|
11335
11431
|
composerValue,
|
|
11336
11432
|
models,
|
|
11337
11433
|
runMode,
|
|
11434
|
+
searchEnabled,
|
|
11435
|
+
searchFieldVisible,
|
|
11436
|
+
searchValue,
|
|
11338
11437
|
selectedModelId,
|
|
11339
11438
|
selectedSessionId,
|
|
11340
11439
|
sessions,
|
|
@@ -11353,6 +11452,7 @@ const getChatVirtualDom = options => {
|
|
|
11353
11452
|
|
|
11354
11453
|
const renderItems = (oldState, newState) => {
|
|
11355
11454
|
const {
|
|
11455
|
+
addContextButtonEnabled,
|
|
11356
11456
|
authEnabled,
|
|
11357
11457
|
authErrorMessage,
|
|
11358
11458
|
authStatus,
|
|
@@ -11375,6 +11475,9 @@ const renderItems = (oldState, newState) => {
|
|
|
11375
11475
|
projectListScrollTop,
|
|
11376
11476
|
projects,
|
|
11377
11477
|
runMode,
|
|
11478
|
+
searchEnabled,
|
|
11479
|
+
searchFieldVisible,
|
|
11480
|
+
searchValue,
|
|
11378
11481
|
selectedModelId,
|
|
11379
11482
|
selectedProjectId,
|
|
11380
11483
|
selectedSessionId,
|
|
@@ -11393,6 +11496,7 @@ const renderItems = (oldState, newState) => {
|
|
|
11393
11496
|
return [SetDom2, uid, []];
|
|
11394
11497
|
}
|
|
11395
11498
|
const dom = getChatVirtualDom({
|
|
11499
|
+
addContextButtonEnabled,
|
|
11396
11500
|
authEnabled,
|
|
11397
11501
|
authErrorMessage,
|
|
11398
11502
|
authStatus,
|
|
@@ -11414,6 +11518,9 @@ const renderItems = (oldState, newState) => {
|
|
|
11414
11518
|
projectListScrollTop,
|
|
11415
11519
|
projects,
|
|
11416
11520
|
runMode,
|
|
11521
|
+
searchEnabled,
|
|
11522
|
+
searchFieldVisible,
|
|
11523
|
+
searchValue,
|
|
11417
11524
|
selectedModelId,
|
|
11418
11525
|
selectedProjectId,
|
|
11419
11526
|
selectedSessionId,
|
|
@@ -11603,6 +11710,9 @@ const renderEventListeners = () => {
|
|
|
11603
11710
|
}, {
|
|
11604
11711
|
name: HandleInput,
|
|
11605
11712
|
params: ['handleInput', TargetName, TargetValue]
|
|
11713
|
+
}, {
|
|
11714
|
+
name: HandleSearchInput,
|
|
11715
|
+
params: ['handleSearchValueChange', TargetValue]
|
|
11606
11716
|
}, {
|
|
11607
11717
|
name: HandleDragEnter,
|
|
11608
11718
|
params: ['handleDragEnter', TargetName, 'Array.from(event.dataTransfer?.files || []).length > 0'],
|
|
@@ -11707,6 +11817,8 @@ const saveState = state => {
|
|
|
11707
11817
|
projectListScrollTop,
|
|
11708
11818
|
projects,
|
|
11709
11819
|
renamingSessionId,
|
|
11820
|
+
searchFieldVisible,
|
|
11821
|
+
searchValue,
|
|
11710
11822
|
selectedModelId,
|
|
11711
11823
|
selectedProjectId,
|
|
11712
11824
|
selectedSessionId,
|
|
@@ -11722,6 +11834,8 @@ const saveState = state => {
|
|
|
11722
11834
|
projectListScrollTop,
|
|
11723
11835
|
projects,
|
|
11724
11836
|
renamingSessionId,
|
|
11837
|
+
searchFieldVisible,
|
|
11838
|
+
searchValue,
|
|
11725
11839
|
selectedModelId,
|
|
11726
11840
|
selectedProjectId,
|
|
11727
11841
|
selectedSessionId,
|
|
@@ -11729,6 +11843,13 @@ const saveState = state => {
|
|
|
11729
11843
|
};
|
|
11730
11844
|
};
|
|
11731
11845
|
|
|
11846
|
+
const setAddContextButtonEnabled = (state, addContextButtonEnabled) => {
|
|
11847
|
+
return {
|
|
11848
|
+
...state,
|
|
11849
|
+
addContextButtonEnabled
|
|
11850
|
+
};
|
|
11851
|
+
};
|
|
11852
|
+
|
|
11732
11853
|
const setAuthEnabled = (state, authEnabled) => {
|
|
11733
11854
|
return {
|
|
11734
11855
|
...state,
|
|
@@ -11759,9 +11880,12 @@ const dummySessions = [{
|
|
|
11759
11880
|
const setChatList = state => {
|
|
11760
11881
|
return {
|
|
11761
11882
|
...state,
|
|
11883
|
+
searchEnabled: true,
|
|
11884
|
+
searchFieldVisible: false,
|
|
11885
|
+
searchValue: '',
|
|
11762
11886
|
selectedSessionId: dummySessions[0].id,
|
|
11763
11887
|
sessions: dummySessions,
|
|
11764
|
-
viewMode: '
|
|
11888
|
+
viewMode: 'list'
|
|
11765
11889
|
};
|
|
11766
11890
|
};
|
|
11767
11891
|
|
|
@@ -11779,6 +11903,15 @@ const setQuestionToolEnabled = (state, questionToolEnabled) => {
|
|
|
11779
11903
|
};
|
|
11780
11904
|
};
|
|
11781
11905
|
|
|
11906
|
+
const setSearchEnabled = (state, searchEnabled) => {
|
|
11907
|
+
return {
|
|
11908
|
+
...state,
|
|
11909
|
+
searchEnabled,
|
|
11910
|
+
searchFieldVisible: searchEnabled ? state.searchFieldVisible : false,
|
|
11911
|
+
searchValue: searchEnabled ? state.searchValue : ''
|
|
11912
|
+
};
|
|
11913
|
+
};
|
|
11914
|
+
|
|
11782
11915
|
const setShowRunMode = (state, showRunMode) => {
|
|
11783
11916
|
return {
|
|
11784
11917
|
...state,
|
|
@@ -11890,6 +12023,7 @@ const commandMap = {
|
|
|
11890
12023
|
'Chat.handleProjectListContextMenu': wrapCommand(handleProjectListContextMenu),
|
|
11891
12024
|
'Chat.handleProjectListScroll': wrapCommand(handleProjectListScroll),
|
|
11892
12025
|
'Chat.handleRunModeChange': wrapCommand(handleRunModeChange),
|
|
12026
|
+
'Chat.handleSearchValueChange': wrapCommand(handleSearchValueChange),
|
|
11893
12027
|
'Chat.handleSubmit': wrapCommand(handleSubmit),
|
|
11894
12028
|
'Chat.initialize': initialize,
|
|
11895
12029
|
'Chat.loadContent': wrapCommand(loadContent),
|
|
@@ -11910,12 +12044,14 @@ const commandMap = {
|
|
|
11910
12044
|
'Chat.reset': wrapCommand(reset),
|
|
11911
12045
|
'Chat.resize': wrapCommand(resize),
|
|
11912
12046
|
'Chat.saveState': wrapGetter(saveState),
|
|
12047
|
+
'Chat.setAddContextButtonEnabled': wrapCommand(setAddContextButtonEnabled),
|
|
11913
12048
|
'Chat.setAuthEnabled': wrapCommand(setAuthEnabled),
|
|
11914
12049
|
'Chat.setBackendUrl': wrapCommand(setBackendUrl),
|
|
11915
12050
|
'Chat.setChatList': wrapCommand(setChatList),
|
|
11916
12051
|
'Chat.setEmitStreamingFunctionCallEvents': wrapCommand(setEmitStreamingFunctionCallEvents),
|
|
11917
12052
|
'Chat.setOpenRouterApiKey': wrapCommand(setOpenRouterApiKey),
|
|
11918
12053
|
'Chat.setQuestionToolEnabled': wrapCommand(setQuestionToolEnabled),
|
|
12054
|
+
'Chat.setSearchEnabled': wrapCommand(setSearchEnabled),
|
|
11919
12055
|
'Chat.setShowRunMode': wrapCommand(setShowRunMode),
|
|
11920
12056
|
'Chat.setStreamingEnabled': wrapCommand(setStreamingEnabled),
|
|
11921
12057
|
'Chat.setTodoListToolEnabled': wrapCommand(setTodoListToolEnabled),
|