@lvce-editor/chat-view 6.12.0 → 6.13.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 +321 -330
- package/package.json +1 -1
|
@@ -1730,6 +1730,7 @@ const createDefaultState = () => {
|
|
|
1730
1730
|
textAreaPaddingLeft: 12,
|
|
1731
1731
|
textAreaPaddingRight: 12,
|
|
1732
1732
|
textAreaPaddingTop: 0,
|
|
1733
|
+
todoListToolEnabled: false,
|
|
1733
1734
|
tokensMax: 0,
|
|
1734
1735
|
tokensUsed: 0,
|
|
1735
1736
|
uid: 0,
|
|
@@ -7186,12 +7187,38 @@ const getSseEventType = value => {
|
|
|
7186
7187
|
return value && typeof value === 'object' && Reflect.get(value, 'type') === 'response.completed' ? 'sse-response-completed' : 'sse-response-part';
|
|
7187
7188
|
};
|
|
7188
7189
|
|
|
7190
|
+
const getMessageById = (messages, messageId) => {
|
|
7191
|
+
return messages.find(message => message.id === messageId);
|
|
7192
|
+
};
|
|
7193
|
+
|
|
7194
|
+
const getNextHandleTextChunkState = (latestState, parsedMessages, sessions) => {
|
|
7195
|
+
return {
|
|
7196
|
+
...latestState,
|
|
7197
|
+
...(latestState.messagesAutoScrollEnabled ? {
|
|
7198
|
+
messagesScrollTop: getNextAutoScrollTop(latestState.messagesScrollTop)
|
|
7199
|
+
} : {}),
|
|
7200
|
+
parsedMessages,
|
|
7201
|
+
sessions
|
|
7202
|
+
};
|
|
7203
|
+
};
|
|
7204
|
+
|
|
7205
|
+
const getSelectedSession = (sessions, selectedSessionId) => {
|
|
7206
|
+
return sessions.find(session => session.id === selectedSessionId);
|
|
7207
|
+
};
|
|
7208
|
+
|
|
7209
|
+
const setAndRerenderHandleTextChunkState = async (uid, previousState, nextState) => {
|
|
7210
|
+
set$1(uid, previousState, nextState);
|
|
7211
|
+
// @ts-ignore
|
|
7212
|
+
await invoke$1('Chat.rerender');
|
|
7213
|
+
};
|
|
7214
|
+
|
|
7189
7215
|
const getToolCallMergeKey = toolCall => {
|
|
7190
7216
|
if (toolCall.id) {
|
|
7191
7217
|
return `id:${toolCall.id}`;
|
|
7192
7218
|
}
|
|
7193
7219
|
return `value:${toolCall.name}:${toolCall.arguments}`;
|
|
7194
7220
|
};
|
|
7221
|
+
|
|
7195
7222
|
const mergeToolCalls = (existing = [], incoming) => {
|
|
7196
7223
|
if (incoming.length === 0) {
|
|
7197
7224
|
return existing;
|
|
@@ -7213,8 +7240,9 @@ const mergeToolCalls = (existing = [], incoming) => {
|
|
|
7213
7240
|
}
|
|
7214
7241
|
return merged;
|
|
7215
7242
|
};
|
|
7216
|
-
|
|
7217
|
-
|
|
7243
|
+
|
|
7244
|
+
const updateMessageToolCallsInSelectedSession = (sessions, parsedMessages, selectedSessionId, messageId, toolCalls) => {
|
|
7245
|
+
let nextParsedMessages = parsedMessages;
|
|
7218
7246
|
const updatedSessions = sessions.map(session => {
|
|
7219
7247
|
if (session.id !== selectedSessionId) {
|
|
7220
7248
|
return session;
|
|
@@ -7225,26 +7253,47 @@ const updateMessageTextInSelectedSession = async (sessions, parsedMessages, sele
|
|
|
7225
7253
|
if (message.id !== messageId) {
|
|
7226
7254
|
return message;
|
|
7227
7255
|
}
|
|
7228
|
-
updatedMessage = {
|
|
7256
|
+
const updatedMessage = {
|
|
7229
7257
|
...message,
|
|
7230
|
-
|
|
7231
|
-
text
|
|
7258
|
+
toolCalls: mergeToolCalls(message.toolCalls, toolCalls)
|
|
7232
7259
|
};
|
|
7260
|
+
nextParsedMessages = copyParsedMessageContent(nextParsedMessages, message.id, updatedMessage.id);
|
|
7233
7261
|
return updatedMessage;
|
|
7234
7262
|
})
|
|
7235
7263
|
};
|
|
7236
7264
|
});
|
|
7237
|
-
let nextParsedMessages = parsedMessages;
|
|
7238
|
-
if (updatedMessage) {
|
|
7239
|
-
nextParsedMessages = await parseAndStoreMessageContent(parsedMessages, updatedMessage);
|
|
7240
|
-
}
|
|
7241
7265
|
return {
|
|
7242
7266
|
parsedMessages: nextParsedMessages,
|
|
7243
7267
|
sessions: updatedSessions
|
|
7244
7268
|
};
|
|
7245
7269
|
};
|
|
7246
|
-
|
|
7247
|
-
|
|
7270
|
+
|
|
7271
|
+
const handleToolCallsChunkFunction = async (uid, assistantMessageId, toolCalls, handleTextChunkState) => {
|
|
7272
|
+
const selectedSession = getSelectedSession(handleTextChunkState.latestState.sessions, handleTextChunkState.latestState.selectedSessionId);
|
|
7273
|
+
if (!selectedSession) {
|
|
7274
|
+
return {
|
|
7275
|
+
latestState: handleTextChunkState.latestState,
|
|
7276
|
+
previousState: handleTextChunkState.previousState
|
|
7277
|
+
};
|
|
7278
|
+
}
|
|
7279
|
+
const assistantMessage = getMessageById(selectedSession.messages, assistantMessageId);
|
|
7280
|
+
if (!assistantMessage) {
|
|
7281
|
+
return {
|
|
7282
|
+
latestState: handleTextChunkState.latestState,
|
|
7283
|
+
previousState: handleTextChunkState.previousState
|
|
7284
|
+
};
|
|
7285
|
+
}
|
|
7286
|
+
const updated = updateMessageToolCallsInSelectedSession(handleTextChunkState.latestState.sessions, handleTextChunkState.latestState.parsedMessages, handleTextChunkState.latestState.selectedSessionId, assistantMessageId, toolCalls);
|
|
7287
|
+
const nextState = getNextHandleTextChunkState(handleTextChunkState.latestState, updated.parsedMessages, updated.sessions);
|
|
7288
|
+
await setAndRerenderHandleTextChunkState(uid, handleTextChunkState.previousState, nextState);
|
|
7289
|
+
return {
|
|
7290
|
+
latestState: nextState,
|
|
7291
|
+
previousState: nextState
|
|
7292
|
+
};
|
|
7293
|
+
};
|
|
7294
|
+
|
|
7295
|
+
const updateMessageTextInSelectedSession = async (sessions, parsedMessages, selectedSessionId, messageId, text, inProgress) => {
|
|
7296
|
+
let updatedMessage;
|
|
7248
7297
|
const updatedSessions = sessions.map(session => {
|
|
7249
7298
|
if (session.id !== selectedSessionId) {
|
|
7250
7299
|
return session;
|
|
@@ -7255,15 +7304,19 @@ const updateMessageToolCallsInSelectedSession = (sessions, parsedMessages, selec
|
|
|
7255
7304
|
if (message.id !== messageId) {
|
|
7256
7305
|
return message;
|
|
7257
7306
|
}
|
|
7258
|
-
|
|
7307
|
+
updatedMessage = {
|
|
7259
7308
|
...message,
|
|
7260
|
-
|
|
7309
|
+
inProgress,
|
|
7310
|
+
text
|
|
7261
7311
|
};
|
|
7262
|
-
nextParsedMessages = copyParsedMessageContent(nextParsedMessages, message.id, updatedMessage.id);
|
|
7263
7312
|
return updatedMessage;
|
|
7264
7313
|
})
|
|
7265
7314
|
};
|
|
7266
7315
|
});
|
|
7316
|
+
let nextParsedMessages = parsedMessages;
|
|
7317
|
+
if (updatedMessage) {
|
|
7318
|
+
nextParsedMessages = await parseAndStoreMessageContent(parsedMessages, updatedMessage);
|
|
7319
|
+
}
|
|
7267
7320
|
return {
|
|
7268
7321
|
parsedMessages: nextParsedMessages,
|
|
7269
7322
|
sessions: updatedSessions
|
|
@@ -7302,38 +7355,6 @@ const handleTextChunkFunction = async (uid, assistantMessageId, chunk, handleTex
|
|
|
7302
7355
|
previousState: nextState
|
|
7303
7356
|
};
|
|
7304
7357
|
};
|
|
7305
|
-
const handleToolCallsChunkFunction = async (uid, assistantMessageId, toolCalls, handleTextChunkState) => {
|
|
7306
|
-
const selectedSession = handleTextChunkState.latestState.sessions.find(session => session.id === handleTextChunkState.latestState.selectedSessionId);
|
|
7307
|
-
if (!selectedSession) {
|
|
7308
|
-
return {
|
|
7309
|
-
latestState: handleTextChunkState.latestState,
|
|
7310
|
-
previousState: handleTextChunkState.previousState
|
|
7311
|
-
};
|
|
7312
|
-
}
|
|
7313
|
-
const assistantMessage = selectedSession.messages.find(message => message.id === assistantMessageId);
|
|
7314
|
-
if (!assistantMessage) {
|
|
7315
|
-
return {
|
|
7316
|
-
latestState: handleTextChunkState.latestState,
|
|
7317
|
-
previousState: handleTextChunkState.previousState
|
|
7318
|
-
};
|
|
7319
|
-
}
|
|
7320
|
-
const updated = updateMessageToolCallsInSelectedSession(handleTextChunkState.latestState.sessions, handleTextChunkState.latestState.parsedMessages, handleTextChunkState.latestState.selectedSessionId, assistantMessageId, toolCalls);
|
|
7321
|
-
const nextState = {
|
|
7322
|
-
...handleTextChunkState.latestState,
|
|
7323
|
-
...(handleTextChunkState.latestState.messagesAutoScrollEnabled ? {
|
|
7324
|
-
messagesScrollTop: getNextAutoScrollTop(handleTextChunkState.latestState.messagesScrollTop)
|
|
7325
|
-
} : {}),
|
|
7326
|
-
parsedMessages: updated.parsedMessages,
|
|
7327
|
-
sessions: updated.sessions
|
|
7328
|
-
};
|
|
7329
|
-
set$1(uid, handleTextChunkState.previousState, nextState);
|
|
7330
|
-
// @ts-ignore
|
|
7331
|
-
await invoke$1('Chat.rerender');
|
|
7332
|
-
return {
|
|
7333
|
-
latestState: nextState,
|
|
7334
|
-
previousState: nextState
|
|
7335
|
-
};
|
|
7336
|
-
};
|
|
7337
7358
|
|
|
7338
7359
|
const hasLegacyStreamingToolCalls = parsed => {
|
|
7339
7360
|
if (!parsed || typeof parsed !== 'object') {
|
|
@@ -8423,6 +8444,15 @@ const loadStreamingEnabled = async () => {
|
|
|
8423
8444
|
}
|
|
8424
8445
|
};
|
|
8425
8446
|
|
|
8447
|
+
const loadTodoListToolEnabled = async () => {
|
|
8448
|
+
try {
|
|
8449
|
+
const savedTodoListToolEnabled = await get('chatView.todoListToolEnabled');
|
|
8450
|
+
return typeof savedTodoListToolEnabled === 'boolean' ? savedTodoListToolEnabled : false;
|
|
8451
|
+
} catch {
|
|
8452
|
+
return false;
|
|
8453
|
+
}
|
|
8454
|
+
};
|
|
8455
|
+
|
|
8426
8456
|
const loadUseChatCoordinatorWorker = async () => {
|
|
8427
8457
|
try {
|
|
8428
8458
|
const savedUseChatCoordinatorWorker = await get('chatView.useChatCoordinatorWorker');
|
|
@@ -8469,7 +8499,7 @@ const loadVoiceDictationEnabled = async () => {
|
|
|
8469
8499
|
};
|
|
8470
8500
|
|
|
8471
8501
|
const loadPreferences = async () => {
|
|
8472
|
-
const [aiSessionTitleGenerationEnabled, authAccessToken, authEnabled, authRefreshToken, backendUrl, composerDropEnabled, openApiApiKey, openRouterApiKey, emitStreamingFunctionCallEvents, streamingEnabled, passIncludeObfuscation, useChatCoordinatorWorker, useChatMathWorker, useChatNetworkWorkerForRequests, useChatToolWorker, voiceDictationEnabled] = await Promise.all([loadAiSessionTitleGenerationEnabled(), loadBackendAccessToken(), loadAuthEnabled(), loadBackendRefreshToken(), loadBackendUrl(), loadComposerDropEnabled(), loadOpenApiApiKey(), loadOpenRouterApiKey(), loadEmitStreamingFunctionCallEvents(), loadStreamingEnabled(), loadPassIncludeObfuscation(), loadUseChatCoordinatorWorker(), loadUseChatMathWorker(), loadUseChatNetworkWorkerForRequests(), loadUseChatToolWorker(), loadVoiceDictationEnabled()]);
|
|
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()]);
|
|
8473
8503
|
return {
|
|
8474
8504
|
aiSessionTitleGenerationEnabled,
|
|
8475
8505
|
authAccessToken,
|
|
@@ -8482,6 +8512,7 @@ const loadPreferences = async () => {
|
|
|
8482
8512
|
openRouterApiKey,
|
|
8483
8513
|
passIncludeObfuscation,
|
|
8484
8514
|
streamingEnabled,
|
|
8515
|
+
todoListToolEnabled,
|
|
8485
8516
|
useChatCoordinatorWorker,
|
|
8486
8517
|
useChatMathWorker,
|
|
8487
8518
|
useChatNetworkWorkerForRequests,
|
|
@@ -8627,6 +8658,7 @@ const loadContent = async (state, savedState) => {
|
|
|
8627
8658
|
openRouterApiKey,
|
|
8628
8659
|
passIncludeObfuscation,
|
|
8629
8660
|
streamingEnabled,
|
|
8661
|
+
todoListToolEnabled,
|
|
8630
8662
|
useChatCoordinatorWorker,
|
|
8631
8663
|
useChatMathWorker,
|
|
8632
8664
|
useChatNetworkWorkerForRequests,
|
|
@@ -8709,6 +8741,7 @@ const loadContent = async (state, savedState) => {
|
|
|
8709
8741
|
selectedSessionId,
|
|
8710
8742
|
sessions,
|
|
8711
8743
|
streamingEnabled,
|
|
8744
|
+
todoListToolEnabled,
|
|
8712
8745
|
useChatCoordinatorWorker,
|
|
8713
8746
|
useChatMathWorker,
|
|
8714
8747
|
useChatNetworkWorkerForRequests,
|
|
@@ -8842,343 +8875,167 @@ const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessage
|
|
|
8842
8875
|
--ChatMessageFontSize: ${chatMessageFontSize}px;
|
|
8843
8876
|
--ChatMessageLineHeight: ${chatMessageLineHeight}px;
|
|
8844
8877
|
--ChatMessageFontFamily: ${chatMessageFontFamily};
|
|
8845
|
-
}
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
.ChatSendArea{
|
|
8849
|
-
height: var(--ChatSendAreaHeight);
|
|
8850
|
-
padding: var(--ChatSendAreaPaddingTop) var(--ChatSendAreaPaddingRight) var(--ChatSendAreaPaddingBottom) var(--ChatSendAreaPaddingLeft);
|
|
8851
|
-
}
|
|
8852
|
-
|
|
8853
|
-
.Viewlet.Chat.ChatFocus {
|
|
8854
|
-
background: linear-gradient(180deg, var(--ColorViewBackground, #1d2229) 0%, #1f252d 100%);
|
|
8855
|
-
display: grid;
|
|
8856
|
-
grid-template-columns: 320px 1fr;
|
|
8857
|
-
grid-template-rows: auto 1fr auto;
|
|
8858
|
-
}
|
|
8859
|
-
|
|
8860
|
-
.Chat.ChatFocus .ChatHeader {
|
|
8861
|
-
grid-column: 1 / 3;
|
|
8862
|
-
}
|
|
8878
|
+
}`;
|
|
8879
|
+
if (!renderHtmlCss.trim()) {
|
|
8880
|
+
return `${baseCss}
|
|
8863
8881
|
|
|
8864
|
-
.
|
|
8865
|
-
|
|
8866
|
-
|
|
8882
|
+
.ChatTodoList {
|
|
8883
|
+
background: var(--vscode-editorWidget-background);
|
|
8884
|
+
border: 1px solid var(--vscode-editorWidget-border);
|
|
8885
|
+
border-radius: 6px;
|
|
8886
|
+
margin-bottom: 8px;
|
|
8887
|
+
overflow: hidden;
|
|
8867
8888
|
}
|
|
8868
8889
|
|
|
8869
|
-
.
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
grid-column: 1;
|
|
8876
|
-
grid-row: 2 / 4;
|
|
8877
|
-
min-height: 0;
|
|
8890
|
+
.ChatTodoListHeader {
|
|
8891
|
+
border-bottom: 1px solid var(--vscode-editorWidget-border);
|
|
8892
|
+
color: var(--vscode-descriptionForeground);
|
|
8893
|
+
font-size: 12px;
|
|
8894
|
+
line-height: 18px;
|
|
8895
|
+
padding: 6px 10px;
|
|
8878
8896
|
}
|
|
8879
8897
|
|
|
8880
|
-
.
|
|
8881
|
-
|
|
8898
|
+
.ChatTodoListItems {
|
|
8899
|
+
list-style: none;
|
|
8900
|
+
margin: 0;
|
|
8901
|
+
max-height: 180px;
|
|
8882
8902
|
overflow: auto;
|
|
8883
|
-
padding:
|
|
8884
|
-
scrollbar-color: color-mix(in srgb, var(--ColorScrollBarSliderBackground, #4b5563) 78%, transparent)
|
|
8885
|
-
color-mix(in srgb, var(--ColorSideBarBackground, #232b35) 92%, transparent);
|
|
8886
|
-
scrollbar-width: thin;
|
|
8887
|
-
}
|
|
8888
|
-
|
|
8889
|
-
.Chat.ChatFocus .ProjectList::-webkit-scrollbar {
|
|
8890
|
-
height: 10px;
|
|
8891
|
-
width: 10px;
|
|
8892
|
-
}
|
|
8893
|
-
|
|
8894
|
-
.Chat.ChatFocus .ProjectList::-webkit-scrollbar-track {
|
|
8895
|
-
background: color-mix(in srgb, var(--ColorSideBarBackground, #232b35) 94%, transparent);
|
|
8896
|
-
border-radius: 999px;
|
|
8903
|
+
padding: 4px 0;
|
|
8897
8904
|
}
|
|
8898
8905
|
|
|
8899
|
-
.
|
|
8900
|
-
background: color-mix(in srgb, var(--ColorScrollBarSliderBackground, #4b5563) 70%, transparent);
|
|
8901
|
-
border: 2px solid color-mix(in srgb, var(--ColorSideBarBackground, #232b35) 94%, transparent);
|
|
8902
|
-
border-radius: 999px;
|
|
8903
|
-
}
|
|
8904
|
-
|
|
8905
|
-
.Chat.ChatFocus .ProjectList::-webkit-scrollbar-thumb:hover {
|
|
8906
|
-
background: color-mix(in srgb, var(--ColorScrollBarSliderHoverBackground, #667284) 80%, transparent);
|
|
8907
|
-
}
|
|
8908
|
-
|
|
8909
|
-
.ProjectListGroup {
|
|
8910
|
-
border: 1px solid transparent;
|
|
8911
|
-
border-radius: 8px;
|
|
8912
|
-
margin-bottom: 6px;
|
|
8913
|
-
overflow: hidden;
|
|
8914
|
-
}
|
|
8915
|
-
|
|
8916
|
-
.ProjectListItem {
|
|
8917
|
-
align-items: center;
|
|
8918
|
-
display: flex;
|
|
8919
|
-
gap: 6px;
|
|
8920
|
-
min-height: calc(var(--ChatListItemHeight) - 2px);
|
|
8921
|
-
}
|
|
8922
|
-
|
|
8923
|
-
.ProjectListItemLabel {
|
|
8906
|
+
.ChatTodoListItem {
|
|
8924
8907
|
align-items: center;
|
|
8925
|
-
|
|
8926
|
-
color: var(--ColorForeground, #d5dbe3);
|
|
8927
|
-
cursor: pointer;
|
|
8908
|
+
color: var(--vscode-foreground);
|
|
8928
8909
|
display: flex;
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
overflow: hidden;
|
|
8910
|
+
font-size: 12px;
|
|
8911
|
+
line-height: 18px;
|
|
8912
|
+
min-height: 24px;
|
|
8933
8913
|
padding: 0 10px;
|
|
8934
|
-
text-overflow: ellipsis;
|
|
8935
|
-
transition: background-color 80ms ease, color 80ms ease;
|
|
8936
|
-
white-space: nowrap;
|
|
8937
8914
|
}
|
|
8938
8915
|
|
|
8939
|
-
.
|
|
8940
|
-
color:
|
|
8916
|
+
.ChatTodoListItem::before {
|
|
8917
|
+
color: var(--vscode-descriptionForeground);
|
|
8918
|
+
content: "○";
|
|
8941
8919
|
display: inline-block;
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
margin-right: 4px;
|
|
8945
|
-
text-align: center;
|
|
8946
|
-
width: 12px;
|
|
8920
|
+
margin-right: 8px;
|
|
8921
|
+
width: 1em;
|
|
8947
8922
|
}
|
|
8948
8923
|
|
|
8949
|
-
.
|
|
8950
|
-
|
|
8924
|
+
.ChatTodoListItemTodo::before {
|
|
8925
|
+
content: "○";
|
|
8951
8926
|
}
|
|
8952
8927
|
|
|
8953
|
-
.
|
|
8954
|
-
|
|
8955
|
-
background: color-mix(in srgb, var(--ColorListHoverBackground, #38414b) 50%, transparent);
|
|
8928
|
+
.ChatTodoListItem.todo::before {
|
|
8929
|
+
content: "○";
|
|
8956
8930
|
}
|
|
8957
8931
|
|
|
8958
|
-
.
|
|
8959
|
-
color: var(--
|
|
8932
|
+
.ChatTodoListItemInProgress::before {
|
|
8933
|
+
color: var(--vscode-textLink-foreground);
|
|
8934
|
+
content: "◐";
|
|
8960
8935
|
}
|
|
8961
8936
|
|
|
8962
|
-
.
|
|
8963
|
-
|
|
8964
|
-
|
|
8937
|
+
.ChatTodoListItem.inProgress::before {
|
|
8938
|
+
color: var(--vscode-textLink-foreground);
|
|
8939
|
+
content: "◐";
|
|
8965
8940
|
}
|
|
8966
8941
|
|
|
8967
|
-
.
|
|
8968
|
-
|
|
8969
|
-
background: color-mix(in srgb, var(--ColorButtonSecondaryBackground, #3a434f) 76%, transparent);
|
|
8970
|
-
border: 0;
|
|
8971
|
-
border-radius: 5px;
|
|
8972
|
-
color: var(--ColorForeground, #d0d8e2);
|
|
8973
|
-
cursor: pointer;
|
|
8974
|
-
display: inline-flex;
|
|
8975
|
-
font-size: 13px;
|
|
8976
|
-
font-weight: 500;
|
|
8977
|
-
height: 18px;
|
|
8978
|
-
justify-content: center;
|
|
8979
|
-
opacity: 0;
|
|
8980
|
-
padding: 0;
|
|
8981
|
-
transition: opacity 90ms ease, background-color 90ms ease;
|
|
8982
|
-
visibility: hidden;
|
|
8983
|
-
width: 18px;
|
|
8942
|
+
.ChatTodoListItemCompleted {
|
|
8943
|
+
color: var(--vscode-disabledForeground);
|
|
8984
8944
|
}
|
|
8985
8945
|
|
|
8986
|
-
.
|
|
8987
|
-
|
|
8988
|
-
opacity: 1;
|
|
8989
|
-
visibility: visible;
|
|
8946
|
+
.ChatTodoListItem.completed {
|
|
8947
|
+
color: var(--vscode-disabledForeground);
|
|
8990
8948
|
}
|
|
8991
8949
|
|
|
8992
|
-
.
|
|
8993
|
-
|
|
8994
|
-
|
|
8950
|
+
.ChatTodoListItemCompleted::before {
|
|
8951
|
+
color: var(--vscode-testing-iconPassed);
|
|
8952
|
+
content: "✓";
|
|
8995
8953
|
}
|
|
8996
8954
|
|
|
8997
|
-
.
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
}
|
|
8955
|
+
.ChatTodoListItem.completed::before {
|
|
8956
|
+
color: var(--vscode-testing-iconPassed);
|
|
8957
|
+
content: "✓";
|
|
8958
|
+
}`;
|
|
8959
|
+
}
|
|
8960
|
+
return `${baseCss}
|
|
9002
8961
|
|
|
9003
|
-
.
|
|
8962
|
+
.ChatTodoList {
|
|
8963
|
+
background: var(--vscode-editorWidget-background);
|
|
8964
|
+
border: 1px solid var(--vscode-editorWidget-border);
|
|
9004
8965
|
border-radius: 6px;
|
|
9005
|
-
|
|
9006
|
-
cursor: pointer;
|
|
9007
|
-
display: block;
|
|
9008
|
-
flex: 1;
|
|
9009
|
-
font-size: 12.5px;
|
|
8966
|
+
margin-bottom: 8px;
|
|
9010
8967
|
overflow: hidden;
|
|
9011
|
-
padding: 0 10px 0 28px;
|
|
9012
|
-
text-overflow: ellipsis;
|
|
9013
|
-
transition: background-color 80ms ease, color 80ms ease;
|
|
9014
|
-
white-space: nowrap;
|
|
9015
|
-
}
|
|
9016
|
-
|
|
9017
|
-
.ProjectSessionItemSelected {
|
|
9018
|
-
background: color-mix(in srgb, var(--ColorListInactiveSelectionBackground, #353f4a) 86%, #2c3540 14%);
|
|
9019
|
-
}
|
|
9020
|
-
|
|
9021
|
-
.ProjectSessionItem:not(.ProjectSessionItemSelected):hover,
|
|
9022
|
-
.ProjectSessionItem:not(.ProjectSessionItemSelected):focus-within {
|
|
9023
|
-
background: color-mix(in srgb, var(--ColorListHoverBackground, #38414c) 46%, transparent);
|
|
9024
8968
|
}
|
|
9025
8969
|
|
|
9026
|
-
.
|
|
9027
|
-
|
|
8970
|
+
.ChatTodoListHeader {
|
|
8971
|
+
border-bottom: 1px solid var(--vscode-editorWidget-border);
|
|
8972
|
+
color: var(--vscode-descriptionForeground);
|
|
8973
|
+
font-size: 12px;
|
|
8974
|
+
line-height: 18px;
|
|
8975
|
+
padding: 6px 10px;
|
|
9028
8976
|
}
|
|
9029
8977
|
|
|
9030
|
-
.
|
|
9031
|
-
|
|
9032
|
-
border: 0;
|
|
9033
|
-
border-top: 1px solid color-mix(in srgb, var(--ColorBorder, #3a3d41) 70%, transparent);
|
|
9034
|
-
color: var(--ColorForeground, #d2d9e2);
|
|
9035
|
-
cursor: pointer;
|
|
9036
|
-
font-size: 12.5px;
|
|
9037
|
-
letter-spacing: 0.01em;
|
|
9038
|
-
margin-top: auto;
|
|
9039
|
-
min-height: var(--ChatListItemHeight);
|
|
9040
|
-
padding: 0 12px;
|
|
9041
|
-
text-align: left;
|
|
9042
|
-
transition: background-color 80ms ease;
|
|
9043
|
-
}
|
|
9044
|
-
|
|
9045
|
-
.Chat.ChatFocus .ProjectAddButton:hover,
|
|
9046
|
-
.Chat.ChatFocus .ProjectAddButton:focus-visible {
|
|
9047
|
-
background: color-mix(in srgb, var(--ColorButtonSecondaryHoverBackground, #2a3039) 78%, transparent);
|
|
9048
|
-
}
|
|
9049
|
-
|
|
9050
|
-
.ChatList,
|
|
9051
|
-
.ChatListEmpty,
|
|
9052
|
-
.ChatMessages {
|
|
8978
|
+
.ChatTodoListItems {
|
|
8979
|
+
list-style: none;
|
|
9053
8980
|
margin: 0;
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
.Chat.ChatFocus .ChatList,
|
|
9059
|
-
.Chat.ChatFocus .ChatListEmpty {
|
|
9060
|
-
display: none;
|
|
9061
|
-
}
|
|
9062
|
-
|
|
9063
|
-
.Chat.ChatFocus .ChatMessages {
|
|
9064
|
-
grid-column: 2;
|
|
9065
|
-
grid-row: 2;
|
|
9066
|
-
}
|
|
9067
|
-
|
|
9068
|
-
.Chat.ChatFocus .ChatSendArea {
|
|
9069
|
-
grid-column: 2;
|
|
9070
|
-
grid-row: 3;
|
|
9071
|
-
height: var(--ChatSendAreaHeight);
|
|
9072
|
-
min-height: var(--ChatSendAreaHeight);
|
|
9073
|
-
}
|
|
9074
|
-
|
|
9075
|
-
.Chat .MultilineInputBox {
|
|
9076
|
-
height: var(--ChatTextAreaHeight);
|
|
9077
|
-
min-height: var(--ChatTextAreaHeight);
|
|
9078
|
-
padding: var(--ChatTextAreaPaddingTop) var(--ChatTextAreaPaddingRight) var(--ChatTextAreaPaddingBottom) var(--ChatTextAreaPaddingLeft);
|
|
8981
|
+
max-height: 180px;
|
|
8982
|
+
overflow: auto;
|
|
8983
|
+
padding: 4px 0;
|
|
9079
8984
|
}
|
|
9080
8985
|
|
|
9081
|
-
.
|
|
9082
|
-
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
calc(100% - 10px) 50%,
|
|
9090
|
-
calc(100% - 6px) 50%;
|
|
9091
|
-
background-repeat: no-repeat;
|
|
9092
|
-
background-size:
|
|
9093
|
-
4px 4px,
|
|
9094
|
-
4px 4px;
|
|
9095
|
-
max-width: 60px;
|
|
9096
|
-
padding-right: 16px;
|
|
8986
|
+
.ChatTodoListItem {
|
|
8987
|
+
align-items: center;
|
|
8988
|
+
color: var(--vscode-foreground);
|
|
8989
|
+
display: flex;
|
|
8990
|
+
font-size: 12px;
|
|
8991
|
+
line-height: 18px;
|
|
8992
|
+
min-height: 24px;
|
|
8993
|
+
padding: 0 10px;
|
|
9097
8994
|
}
|
|
9098
8995
|
|
|
9099
|
-
.
|
|
8996
|
+
.ChatTodoListItem::before {
|
|
8997
|
+
color: var(--vscode-descriptionForeground);
|
|
8998
|
+
content: "○";
|
|
9100
8999
|
display: inline-block;
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
}
|
|
9104
|
-
|
|
9105
|
-
.MarkdownQuote {
|
|
9106
|
-
border-left: 3px solid var(--ColorBorder, #3a3d41);
|
|
9107
|
-
margin: 8px 0;
|
|
9108
|
-
padding-left: 12px;
|
|
9109
|
-
}
|
|
9110
|
-
|
|
9111
|
-
.MarkdownMathBlock {
|
|
9112
|
-
margin: 8px 0;
|
|
9113
|
-
overflow-x: auto;
|
|
9114
|
-
overflow-y: hidden;
|
|
9115
|
-
}
|
|
9116
|
-
|
|
9117
|
-
.ChatMessageContent hr,
|
|
9118
|
-
.ChatToolCallRenderHtmlBody hr {
|
|
9119
|
-
border: 0;
|
|
9120
|
-
border-top: 1px solid color-mix(in srgb, var(--ColorBorder, #3a3d41) 78%, transparent);
|
|
9121
|
-
display: block;
|
|
9122
|
-
height: 0;
|
|
9123
|
-
margin: 12px 0;
|
|
9124
|
-
width: 100%;
|
|
9000
|
+
margin-right: 8px;
|
|
9001
|
+
width: 1em;
|
|
9125
9002
|
}
|
|
9126
9003
|
|
|
9127
|
-
.
|
|
9128
|
-
|
|
9004
|
+
.ChatTodoListItemTodo::before {
|
|
9005
|
+
content: "○";
|
|
9129
9006
|
}
|
|
9130
9007
|
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
color: var(--ColorSymbolIconColorForeground, #7f8794);
|
|
9008
|
+
.ChatTodoListItem.todo::before {
|
|
9009
|
+
content: "○";
|
|
9134
9010
|
}
|
|
9135
9011
|
|
|
9136
|
-
.
|
|
9137
|
-
color: var(--
|
|
9012
|
+
.ChatTodoListItemInProgress::before {
|
|
9013
|
+
color: var(--vscode-textLink-foreground);
|
|
9014
|
+
content: "◐";
|
|
9138
9015
|
}
|
|
9139
9016
|
|
|
9140
|
-
.
|
|
9141
|
-
|
|
9142
|
-
|
|
9017
|
+
.ChatTodoListItem.inProgress::before {
|
|
9018
|
+
color: var(--vscode-textLink-foreground);
|
|
9019
|
+
content: "◐";
|
|
9143
9020
|
}
|
|
9144
9021
|
|
|
9145
|
-
.
|
|
9146
|
-
|
|
9147
|
-
color: var(--ColorChartsPurple, #ca9ee6);
|
|
9022
|
+
.ChatTodoListItemCompleted {
|
|
9023
|
+
color: var(--vscode-disabledForeground);
|
|
9148
9024
|
}
|
|
9149
9025
|
|
|
9150
|
-
.
|
|
9151
|
-
|
|
9152
|
-
color: var(--ColorChartsOrange, #ef9f76);
|
|
9026
|
+
.ChatTodoListItem.completed {
|
|
9027
|
+
color: var(--vscode-disabledForeground);
|
|
9153
9028
|
}
|
|
9154
9029
|
|
|
9155
|
-
.
|
|
9156
|
-
|
|
9030
|
+
.ChatTodoListItemCompleted::before {
|
|
9031
|
+
color: var(--vscode-testing-iconPassed);
|
|
9032
|
+
content: "✓";
|
|
9157
9033
|
}
|
|
9158
9034
|
|
|
9159
|
-
.
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
gap: 6px;
|
|
9163
|
-
}
|
|
9164
|
-
|
|
9165
|
-
.ChatToolCallQuestionOption {
|
|
9166
|
-
background: color-mix(in srgb, var(--ColorBadgeBackground, #2f3640) 70%, transparent);
|
|
9167
|
-
border: 1px solid color-mix(in srgb, var(--ColorBorder, #3a3d41) 70%, transparent);
|
|
9168
|
-
border-radius: 999px;
|
|
9169
|
-
color: var(--ColorForeground, #d5dbe3);
|
|
9170
|
-
display: inline-block;
|
|
9171
|
-
max-width: 100%;
|
|
9172
|
-
overflow: hidden;
|
|
9173
|
-
padding: 2px 8px;
|
|
9174
|
-
text-overflow: ellipsis;
|
|
9175
|
-
white-space: nowrap;
|
|
9035
|
+
.ChatTodoListItem.completed::before {
|
|
9036
|
+
color: var(--vscode-testing-iconPassed);
|
|
9037
|
+
content: "✓";
|
|
9176
9038
|
}
|
|
9177
|
-
`;
|
|
9178
|
-
if (!renderHtmlCss.trim()) {
|
|
9179
|
-
return baseCss;
|
|
9180
|
-
}
|
|
9181
|
-
return `${baseCss}
|
|
9182
9039
|
|
|
9183
9040
|
/* render_html tool css */
|
|
9184
9041
|
${renderHtmlCss}`;
|
|
@@ -9245,6 +9102,13 @@ const ChatViewDropOverlayActive = 'ChatViewDropOverlayActive';
|
|
|
9245
9102
|
const SendButtonDisabled = 'SendButtonDisabled';
|
|
9246
9103
|
const ChatSendAreaBottom = 'ChatSendAreaBottom';
|
|
9247
9104
|
const ChatSendAreaContent = 'ChatSendAreaContent';
|
|
9105
|
+
const ChatTodoList = 'ChatTodoList';
|
|
9106
|
+
const ChatTodoListHeader = 'ChatTodoListHeader';
|
|
9107
|
+
const ChatTodoListItems = 'ChatTodoListItems';
|
|
9108
|
+
const ChatTodoListItem = 'ChatTodoListItem';
|
|
9109
|
+
const ChatTodoListItemTodo = 'ChatTodoListItemTodo';
|
|
9110
|
+
const ChatTodoListItemInProgress = 'ChatTodoListItemInProgress';
|
|
9111
|
+
const ChatTodoListItemCompleted = 'ChatTodoListItemCompleted';
|
|
9248
9112
|
const Chat = 'Chat';
|
|
9249
9113
|
const ChatHeader = 'ChatHeader';
|
|
9250
9114
|
const Button = 'Button';
|
|
@@ -9286,6 +9150,7 @@ const ChatMessageContent = 'ChatMessageContent';
|
|
|
9286
9150
|
const ChatToolCalls = 'ChatToolCalls';
|
|
9287
9151
|
const ChatToolCallsLabel = 'ChatToolCallsLabel';
|
|
9288
9152
|
const ChatToolCallReadFileLink = 'ChatToolCallReadFileLink';
|
|
9153
|
+
const ChatToolCallFileName = 'ChatToolCallFileName';
|
|
9289
9154
|
const ChatToolCallQuestionOption = 'ChatToolCallQuestionOption';
|
|
9290
9155
|
const ChatToolCallQuestionOptions = 'ChatToolCallQuestionOptions';
|
|
9291
9156
|
const ChatToolCallQuestionText = 'ChatToolCallQuestionText';
|
|
@@ -9468,19 +9333,48 @@ const getUsageOverviewDom = (tokensUsed, tokensMax) => {
|
|
|
9468
9333
|
}, text(usageLabel)];
|
|
9469
9334
|
};
|
|
9470
9335
|
|
|
9471
|
-
const getChatSendAreaDom = (composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, voiceDictationEnabled = false) => {
|
|
9336
|
+
const getChatSendAreaDom = (composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled = false) => {
|
|
9472
9337
|
const isSendDisabled = composerValue.trim() === '';
|
|
9473
9338
|
const controlsCount = 2 + (usageOverviewEnabled ? 1 : 0) + (showRunMode ? 1 : 0);
|
|
9339
|
+
const hasTodoList = todoListToolEnabled && todoListItems.length > 0;
|
|
9340
|
+
const todoHeaderText = `Todos (${todoListItems.filter(item => item.status === 'completed').length}/${todoListItems.length})`;
|
|
9341
|
+
const getTodoItemClassName = status => {
|
|
9342
|
+
if (status === 'completed') {
|
|
9343
|
+
return `${ChatTodoListItem} ${ChatTodoListItemCompleted} completed`;
|
|
9344
|
+
}
|
|
9345
|
+
if (status === 'inProgress') {
|
|
9346
|
+
return `${ChatTodoListItem} ${ChatTodoListItemInProgress} inProgress`;
|
|
9347
|
+
}
|
|
9348
|
+
return `${ChatTodoListItem} ${ChatTodoListItemTodo} todo`;
|
|
9349
|
+
};
|
|
9474
9350
|
return [{
|
|
9475
9351
|
childCount: 1,
|
|
9476
9352
|
className: ChatSendArea,
|
|
9477
9353
|
onSubmit: HandleSubmit,
|
|
9478
9354
|
type: Form
|
|
9479
9355
|
}, {
|
|
9480
|
-
childCount: 2,
|
|
9356
|
+
childCount: hasTodoList ? 3 : 2,
|
|
9481
9357
|
className: ChatSendAreaContent,
|
|
9482
9358
|
type: Div
|
|
9359
|
+
}, ...(hasTodoList ? [{
|
|
9360
|
+
childCount: 2,
|
|
9361
|
+
className: ChatTodoList,
|
|
9362
|
+
type: Div
|
|
9483
9363
|
}, {
|
|
9364
|
+
childCount: 1,
|
|
9365
|
+
className: ChatTodoListHeader,
|
|
9366
|
+
type: Div
|
|
9367
|
+
}, {
|
|
9368
|
+
...text(todoHeaderText)
|
|
9369
|
+
}, {
|
|
9370
|
+
childCount: todoListItems.length,
|
|
9371
|
+
className: ChatTodoListItems,
|
|
9372
|
+
type: Ul
|
|
9373
|
+
}, ...todoListItems.flatMap(item => [{
|
|
9374
|
+
childCount: 1,
|
|
9375
|
+
className: getTodoItemClassName(item.status),
|
|
9376
|
+
type: Li
|
|
9377
|
+
}, text(item.text)])] : []), {
|
|
9484
9378
|
childCount: 0,
|
|
9485
9379
|
className: MultilineInputBox,
|
|
9486
9380
|
name: Composer,
|
|
@@ -10168,6 +10062,10 @@ const getToolCallEditFileVirtualDom = toolCall => {
|
|
|
10168
10062
|
title: target.clickableUri,
|
|
10169
10063
|
...fileNameClickableProps,
|
|
10170
10064
|
type: Span
|
|
10065
|
+
}, {
|
|
10066
|
+
childCount: 1,
|
|
10067
|
+
className: ChatToolCallFileName,
|
|
10068
|
+
type: Span
|
|
10171
10069
|
}, text(fileName)];
|
|
10172
10070
|
};
|
|
10173
10071
|
|
|
@@ -10192,6 +10090,10 @@ const getToolCallGetWorkspaceUriVirtualDom = toolCall => {
|
|
|
10192
10090
|
'data-uri': toolCall.result,
|
|
10193
10091
|
onClick: HandleClickReadFile,
|
|
10194
10092
|
type: Span
|
|
10093
|
+
}, {
|
|
10094
|
+
childCount: 1,
|
|
10095
|
+
className: ChatToolCallFileName,
|
|
10096
|
+
type: Span
|
|
10195
10097
|
}, text(fileName), ...(statusLabel ? [text(statusLabel)] : [])];
|
|
10196
10098
|
};
|
|
10197
10099
|
|
|
@@ -10277,6 +10179,10 @@ const getToolCallReadFileVirtualDom = toolCall => {
|
|
|
10277
10179
|
className: ChatToolCallReadFileLink,
|
|
10278
10180
|
...fileNameClickableProps,
|
|
10279
10181
|
type: Span
|
|
10182
|
+
}, {
|
|
10183
|
+
childCount: 1,
|
|
10184
|
+
className: ChatToolCallFileName,
|
|
10185
|
+
type: Span
|
|
10280
10186
|
}, text(fileName), ...(statusLabel ? [text(statusLabel)] : [])];
|
|
10281
10187
|
};
|
|
10282
10188
|
|
|
@@ -10650,6 +10556,10 @@ const getToolCallWriteFileVirtualDom = toolCall => {
|
|
|
10650
10556
|
className: ChatToolCallReadFileLink,
|
|
10651
10557
|
...fileNameClickableProps,
|
|
10652
10558
|
type: Span
|
|
10559
|
+
}, {
|
|
10560
|
+
childCount: 1,
|
|
10561
|
+
className: ChatToolCallFileName,
|
|
10562
|
+
type: Span
|
|
10653
10563
|
}, text(fileName), {
|
|
10654
10564
|
childCount: 1,
|
|
10655
10565
|
className: Insertion,
|
|
@@ -10921,6 +10831,8 @@ const getChatModeChatFocusVirtualDom = ({
|
|
|
10921
10831
|
selectedSessionId,
|
|
10922
10832
|
sessions,
|
|
10923
10833
|
showRunMode,
|
|
10834
|
+
todoListItems,
|
|
10835
|
+
todoListToolEnabled,
|
|
10924
10836
|
tokensMax,
|
|
10925
10837
|
tokensUsed,
|
|
10926
10838
|
usageOverviewEnabled,
|
|
@@ -10936,7 +10848,7 @@ const getChatModeChatFocusVirtualDom = ({
|
|
|
10936
10848
|
onDragEnter: HandleDragEnterChatView,
|
|
10937
10849
|
onDragOver: HandleDragOverChatView,
|
|
10938
10850
|
type: Div
|
|
10939
|
-
}, ...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, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
|
|
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 ? [{
|
|
10940
10852
|
childCount: 1,
|
|
10941
10853
|
className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
|
|
10942
10854
|
name: ComposerDropTarget,
|
|
@@ -11074,6 +10986,8 @@ const getChatModeDetailVirtualDom = ({
|
|
|
11074
10986
|
selectedSessionId,
|
|
11075
10987
|
sessions,
|
|
11076
10988
|
showRunMode,
|
|
10989
|
+
todoListItems,
|
|
10990
|
+
todoListToolEnabled,
|
|
11077
10991
|
tokensMax,
|
|
11078
10992
|
tokensUsed,
|
|
11079
10993
|
usageOverviewEnabled,
|
|
@@ -11090,7 +11004,7 @@ const getChatModeDetailVirtualDom = ({
|
|
|
11090
11004
|
onDragEnter: HandleDragEnterChatView,
|
|
11091
11005
|
onDragOver: HandleDragOverChatView,
|
|
11092
11006
|
type: Div
|
|
11093
|
-
}, ...getChatHeaderDomDetailMode(selectedSessionTitle, authEnabled, authStatus, authErrorMessage), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openRouterApiKeyState, messagesScrollTop, useChatMathWorker), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
|
|
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 ? [{
|
|
11094
11008
|
childCount: 1,
|
|
11095
11009
|
className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
|
|
11096
11010
|
name: ComposerDropTarget,
|
|
@@ -11194,6 +11108,8 @@ const getChatModeListVirtualDom = ({
|
|
|
11194
11108
|
selectedSessionId,
|
|
11195
11109
|
sessions,
|
|
11196
11110
|
showRunMode,
|
|
11111
|
+
todoListItems,
|
|
11112
|
+
todoListToolEnabled,
|
|
11197
11113
|
tokensMax,
|
|
11198
11114
|
tokensUsed,
|
|
11199
11115
|
usageOverviewEnabled,
|
|
@@ -11206,7 +11122,7 @@ const getChatModeListVirtualDom = ({
|
|
|
11206
11122
|
onDragEnter: HandleDragEnterChatView,
|
|
11207
11123
|
onDragOver: HandleDragOverChatView,
|
|
11208
11124
|
type: Div
|
|
11209
|
-
}, ...getChatHeaderListModeDom(authEnabled, authStatus, authErrorMessage), ...getChatListDom(sessions, selectedSessionId, chatListScrollTop), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
|
|
11125
|
+
}, ...getChatHeaderListModeDom(authEnabled, authStatus, authErrorMessage), ...getChatListDom(sessions, selectedSessionId, chatListScrollTop), ...getChatSendAreaDom(composerValue, models, selectedModelId, usageOverviewEnabled, tokensUsed, tokensMax, showRunMode, runMode, todoListToolEnabled, todoListItems, voiceDictationEnabled), ...(isDropOverlayVisible ? [{
|
|
11210
11126
|
childCount: 1,
|
|
11211
11127
|
className: mergeClassNames(ChatViewDropOverlay, ChatViewDropOverlayActive),
|
|
11212
11128
|
name: ComposerDropTarget,
|
|
@@ -11227,6 +11143,62 @@ const getChatModeUnsupportedVirtualDom = () => {
|
|
|
11227
11143
|
}, text(unknownViewMode())];
|
|
11228
11144
|
};
|
|
11229
11145
|
|
|
11146
|
+
const isTodoStatus = status => {
|
|
11147
|
+
return status === 'todo' || status === 'inProgress' || status === 'completed';
|
|
11148
|
+
};
|
|
11149
|
+
const parseTodoListArguments = rawArguments => {
|
|
11150
|
+
let parsed;
|
|
11151
|
+
try {
|
|
11152
|
+
parsed = JSON.parse(rawArguments);
|
|
11153
|
+
} catch {
|
|
11154
|
+
return [];
|
|
11155
|
+
}
|
|
11156
|
+
if (!parsed || typeof parsed !== 'object') {
|
|
11157
|
+
return [];
|
|
11158
|
+
}
|
|
11159
|
+
const rawTodos = Reflect.get(parsed, 'todos');
|
|
11160
|
+
if (!Array.isArray(rawTodos)) {
|
|
11161
|
+
return [];
|
|
11162
|
+
}
|
|
11163
|
+
const todos = [];
|
|
11164
|
+
for (const rawTodo of rawTodos) {
|
|
11165
|
+
if (!rawTodo || typeof rawTodo !== 'object') {
|
|
11166
|
+
continue;
|
|
11167
|
+
}
|
|
11168
|
+
const text = Reflect.get(rawTodo, 'text');
|
|
11169
|
+
const status = Reflect.get(rawTodo, 'status');
|
|
11170
|
+
if (typeof text !== 'string' || !isTodoStatus(status)) {
|
|
11171
|
+
continue;
|
|
11172
|
+
}
|
|
11173
|
+
todos.push({
|
|
11174
|
+
status,
|
|
11175
|
+
text
|
|
11176
|
+
});
|
|
11177
|
+
}
|
|
11178
|
+
return todos;
|
|
11179
|
+
};
|
|
11180
|
+
|
|
11181
|
+
const getTodoListItems = (sessions, selectedSessionId) => {
|
|
11182
|
+
const selectedSession = sessions.find(session => session.id === selectedSessionId);
|
|
11183
|
+
if (!selectedSession) {
|
|
11184
|
+
return [];
|
|
11185
|
+
}
|
|
11186
|
+
let todoItems = [];
|
|
11187
|
+
for (const message of selectedSession.messages) {
|
|
11188
|
+
if (message.role !== 'assistant' || !message.toolCalls) {
|
|
11189
|
+
continue;
|
|
11190
|
+
}
|
|
11191
|
+
for (const toolCall of message.toolCalls) {
|
|
11192
|
+
if (toolCall.name !== 'todo_list') {
|
|
11193
|
+
continue;
|
|
11194
|
+
}
|
|
11195
|
+
const parsedTodos = parseTodoListArguments(toolCall.arguments);
|
|
11196
|
+
todoItems = parsedTodos;
|
|
11197
|
+
}
|
|
11198
|
+
}
|
|
11199
|
+
return todoItems;
|
|
11200
|
+
};
|
|
11201
|
+
|
|
11230
11202
|
const getFallbackParsedMessages = sessions => {
|
|
11231
11203
|
const parsedMessages = [];
|
|
11232
11204
|
for (const session of sessions) {
|
|
@@ -11271,6 +11243,7 @@ const getChatVirtualDom = options => {
|
|
|
11271
11243
|
selectedSessionId,
|
|
11272
11244
|
sessions,
|
|
11273
11245
|
showRunMode,
|
|
11246
|
+
todoListToolEnabled,
|
|
11274
11247
|
tokensMax,
|
|
11275
11248
|
tokensUsed,
|
|
11276
11249
|
usageOverviewEnabled,
|
|
@@ -11279,6 +11252,7 @@ const getChatVirtualDom = options => {
|
|
|
11279
11252
|
voiceDictationEnabled = false
|
|
11280
11253
|
} = options;
|
|
11281
11254
|
const parsedMessages = parsedMessagesInput ?? getFallbackParsedMessages(sessions);
|
|
11255
|
+
const todoListItems = getTodoListItems(sessions, selectedSessionId);
|
|
11282
11256
|
switch (viewMode) {
|
|
11283
11257
|
case 'chat-focus':
|
|
11284
11258
|
return getChatModeChatFocusVirtualDom({
|
|
@@ -11307,6 +11281,8 @@ const getChatVirtualDom = options => {
|
|
|
11307
11281
|
selectedSessionId,
|
|
11308
11282
|
sessions,
|
|
11309
11283
|
showRunMode,
|
|
11284
|
+
todoListItems,
|
|
11285
|
+
todoListToolEnabled,
|
|
11310
11286
|
tokensMax,
|
|
11311
11287
|
tokensUsed,
|
|
11312
11288
|
usageOverviewEnabled,
|
|
@@ -11336,6 +11312,8 @@ const getChatVirtualDom = options => {
|
|
|
11336
11312
|
selectedSessionId,
|
|
11337
11313
|
sessions,
|
|
11338
11314
|
showRunMode,
|
|
11315
|
+
todoListItems,
|
|
11316
|
+
todoListToolEnabled,
|
|
11339
11317
|
tokensMax,
|
|
11340
11318
|
tokensUsed,
|
|
11341
11319
|
usageOverviewEnabled,
|
|
@@ -11361,6 +11339,8 @@ const getChatVirtualDom = options => {
|
|
|
11361
11339
|
selectedSessionId,
|
|
11362
11340
|
sessions,
|
|
11363
11341
|
showRunMode,
|
|
11342
|
+
todoListItems,
|
|
11343
|
+
todoListToolEnabled,
|
|
11364
11344
|
tokensMax,
|
|
11365
11345
|
tokensUsed,
|
|
11366
11346
|
usageOverviewEnabled,
|
|
@@ -11400,6 +11380,7 @@ const renderItems = (oldState, newState) => {
|
|
|
11400
11380
|
selectedSessionId,
|
|
11401
11381
|
sessions,
|
|
11402
11382
|
showRunMode,
|
|
11383
|
+
todoListToolEnabled,
|
|
11403
11384
|
tokensMax,
|
|
11404
11385
|
tokensUsed,
|
|
11405
11386
|
uid,
|
|
@@ -11438,6 +11419,7 @@ const renderItems = (oldState, newState) => {
|
|
|
11438
11419
|
selectedSessionId,
|
|
11439
11420
|
sessions,
|
|
11440
11421
|
showRunMode,
|
|
11422
|
+
todoListToolEnabled,
|
|
11441
11423
|
tokensMax,
|
|
11442
11424
|
tokensUsed,
|
|
11443
11425
|
usageOverviewEnabled,
|
|
@@ -11676,7 +11658,8 @@ const renderEventListeners = () => {
|
|
|
11676
11658
|
params: ['handleKeyDown', Key, ShiftKey]
|
|
11677
11659
|
}, {
|
|
11678
11660
|
name: HandleSubmit,
|
|
11679
|
-
params: ['handleSubmit']
|
|
11661
|
+
params: ['handleSubmit'],
|
|
11662
|
+
preventDefault: true
|
|
11680
11663
|
}, {
|
|
11681
11664
|
name: HandleMissingApiKeySubmit,
|
|
11682
11665
|
params: ['handleMissingApiKeySubmit', 'event.submitter?.name || ""'],
|
|
@@ -11810,6 +11793,13 @@ const setStreamingEnabled = (state, streamingEnabled) => {
|
|
|
11810
11793
|
};
|
|
11811
11794
|
};
|
|
11812
11795
|
|
|
11796
|
+
const setTodoListToolEnabled = (state, todoListToolEnabled) => {
|
|
11797
|
+
return {
|
|
11798
|
+
...state,
|
|
11799
|
+
todoListToolEnabled
|
|
11800
|
+
};
|
|
11801
|
+
};
|
|
11802
|
+
|
|
11813
11803
|
const setUseChatCoordinatorWorker = async (state, useChatCoordinatorWorker, persist = true) => {
|
|
11814
11804
|
if (persist) {
|
|
11815
11805
|
await update({
|
|
@@ -11928,6 +11918,7 @@ const commandMap = {
|
|
|
11928
11918
|
'Chat.setQuestionToolEnabled': wrapCommand(setQuestionToolEnabled),
|
|
11929
11919
|
'Chat.setShowRunMode': wrapCommand(setShowRunMode),
|
|
11930
11920
|
'Chat.setStreamingEnabled': wrapCommand(setStreamingEnabled),
|
|
11921
|
+
'Chat.setTodoListToolEnabled': wrapCommand(setTodoListToolEnabled),
|
|
11931
11922
|
'Chat.setUseChatCoordinatorWorker': wrapCommand(setUseChatCoordinatorWorker),
|
|
11932
11923
|
'Chat.setUseChatMathWorker': wrapCommand(setUseChatMathWorker),
|
|
11933
11924
|
'Chat.setUseChatNetworkWorkerForRequests': wrapCommand(setUseChatNetworkWorkerForRequests),
|