@lvce-editor/chat-view 7.5.0 → 7.6.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 +168 -38
- package/package.json +1 -1
|
@@ -1899,6 +1899,7 @@ const Commit = 'Commit';
|
|
|
1899
1899
|
const OpenTerminal = 'Open Terminal';
|
|
1900
1900
|
const ShowDiff = 'Show Diff';
|
|
1901
1901
|
const CreatePullRequest$2 = 'Create PR';
|
|
1902
|
+
const Stop$1 = 'stop';
|
|
1902
1903
|
const Save = 'Save';
|
|
1903
1904
|
const Saving = 'Saving...';
|
|
1904
1905
|
const GetApiKey = 'Get API Key';
|
|
@@ -2049,6 +2050,9 @@ const showDiff = () => {
|
|
|
2049
2050
|
const createPullRequest = () => {
|
|
2050
2051
|
return i18nString(CreatePullRequest$2);
|
|
2051
2052
|
};
|
|
2053
|
+
const stop = () => {
|
|
2054
|
+
return i18nString(Stop$1);
|
|
2055
|
+
};
|
|
2052
2056
|
const save = () => {
|
|
2053
2057
|
return i18nString(Save);
|
|
2054
2058
|
};
|
|
@@ -2464,6 +2468,7 @@ const createDefaultState = () => {
|
|
|
2464
2468
|
id: defaultSessionId,
|
|
2465
2469
|
messages: [],
|
|
2466
2470
|
projectId: defaultProjectId,
|
|
2471
|
+
status: 'idle',
|
|
2467
2472
|
title: defaultSessionTitle()
|
|
2468
2473
|
}],
|
|
2469
2474
|
showRunMode: true,
|
|
@@ -2539,6 +2544,9 @@ const listChatSessions = async () => {
|
|
|
2539
2544
|
...(session.pullRequestUrl ? {
|
|
2540
2545
|
pullRequestUrl: session.pullRequestUrl
|
|
2541
2546
|
} : {}),
|
|
2547
|
+
...(session.status ? {
|
|
2548
|
+
status: session.status
|
|
2549
|
+
} : {}),
|
|
2542
2550
|
title: session.title,
|
|
2543
2551
|
...(session.workspaceUri ? {
|
|
2544
2552
|
workspaceUri: session.workspaceUri
|
|
@@ -2567,6 +2575,9 @@ const getChatSession = async id => {
|
|
|
2567
2575
|
...(session.pullRequestUrl ? {
|
|
2568
2576
|
pullRequestUrl: session.pullRequestUrl
|
|
2569
2577
|
} : {}),
|
|
2578
|
+
...(session.status ? {
|
|
2579
|
+
status: session.status
|
|
2580
|
+
} : {}),
|
|
2570
2581
|
title: session.title,
|
|
2571
2582
|
...(session.workspaceUri ? {
|
|
2572
2583
|
workspaceUri: session.workspaceUri
|
|
@@ -2588,6 +2599,9 @@ const saveChatSession = async session => {
|
|
|
2588
2599
|
...(session.pullRequestUrl ? {
|
|
2589
2600
|
pullRequestUrl: session.pullRequestUrl
|
|
2590
2601
|
} : {}),
|
|
2602
|
+
...(session.status ? {
|
|
2603
|
+
status: session.status
|
|
2604
|
+
} : {}),
|
|
2591
2605
|
title: session.title,
|
|
2592
2606
|
...(session.workspaceUri ? {
|
|
2593
2607
|
workspaceUri: session.workspaceUri
|
|
@@ -3473,6 +3487,7 @@ const FocusOpenInVsCode = 'focus-open-in-vscode';
|
|
|
3473
3487
|
const FocusOpenTerminal = 'focus-open-terminal';
|
|
3474
3488
|
const FocusShowDiff = 'focus-show-diff';
|
|
3475
3489
|
const Send = 'send';
|
|
3490
|
+
const Stop = 'stop';
|
|
3476
3491
|
const ScrollDown = 'scroll-down';
|
|
3477
3492
|
const Back = 'back';
|
|
3478
3493
|
const ModelPickerToggle = 'model-picker-toggle';
|
|
@@ -4232,12 +4247,26 @@ const handleClickCreateProject = async state => {
|
|
|
4232
4247
|
};
|
|
4233
4248
|
};
|
|
4234
4249
|
|
|
4250
|
+
const getChatSessionStatus = session => {
|
|
4251
|
+
if (session.status) {
|
|
4252
|
+
return session.status;
|
|
4253
|
+
}
|
|
4254
|
+
const hasInProgressAssistantMessage = session.messages.some(message => message.role === 'assistant' && message.inProgress);
|
|
4255
|
+
if (hasInProgressAssistantMessage) {
|
|
4256
|
+
return 'in-progress';
|
|
4257
|
+
}
|
|
4258
|
+
const hasAssistantMessage = session.messages.some(message => message.role === 'assistant');
|
|
4259
|
+
if (hasAssistantMessage) {
|
|
4260
|
+
return 'finished';
|
|
4261
|
+
}
|
|
4262
|
+
return 'idle';
|
|
4263
|
+
};
|
|
4264
|
+
|
|
4235
4265
|
const canCreatePullRequest = session => {
|
|
4236
4266
|
if (!session?.branchName || !session.workspaceUri || session.pullRequestUrl) {
|
|
4237
4267
|
return false;
|
|
4238
4268
|
}
|
|
4239
|
-
|
|
4240
|
-
if (hasInProgressAssistantMessage) {
|
|
4269
|
+
if (getChatSessionStatus(session) !== 'finished') {
|
|
4241
4270
|
return false;
|
|
4242
4271
|
}
|
|
4243
4272
|
return session.messages.some(message => message.role === 'assistant');
|
|
@@ -7964,24 +7993,31 @@ const updateMessageToolCallsInSelectedSession = (sessions, parsedMessages, selec
|
|
|
7964
7993
|
};
|
|
7965
7994
|
};
|
|
7966
7995
|
|
|
7967
|
-
const handleToolCallsChunkFunction = async (uid, assistantMessageId, toolCalls, handleTextChunkState) => {
|
|
7968
|
-
const
|
|
7996
|
+
const handleToolCallsChunkFunction = async (uid, sessionId, assistantMessageId, toolCalls, handleTextChunkState) => {
|
|
7997
|
+
const liveState = get$1(uid)?.newState || handleTextChunkState.latestState;
|
|
7998
|
+
const selectedSession = liveState.sessions.find(session => session.id === sessionId);
|
|
7969
7999
|
if (!selectedSession) {
|
|
7970
8000
|
return {
|
|
7971
|
-
latestState:
|
|
7972
|
-
previousState:
|
|
8001
|
+
latestState: liveState,
|
|
8002
|
+
previousState: liveState
|
|
8003
|
+
};
|
|
8004
|
+
}
|
|
8005
|
+
if (getChatSessionStatus(selectedSession) === 'stopped') {
|
|
8006
|
+
return {
|
|
8007
|
+
latestState: liveState,
|
|
8008
|
+
previousState: liveState
|
|
7973
8009
|
};
|
|
7974
8010
|
}
|
|
7975
8011
|
const assistantMessage = getMessageById(selectedSession.messages, assistantMessageId);
|
|
7976
8012
|
if (!assistantMessage) {
|
|
7977
8013
|
return {
|
|
7978
|
-
latestState:
|
|
7979
|
-
previousState:
|
|
8014
|
+
latestState: liveState,
|
|
8015
|
+
previousState: liveState
|
|
7980
8016
|
};
|
|
7981
8017
|
}
|
|
7982
|
-
const updated = updateMessageToolCallsInSelectedSession(
|
|
7983
|
-
const nextState = getNextHandleTextChunkState(
|
|
7984
|
-
await setAndRerenderHandleTextChunkState(uid,
|
|
8018
|
+
const updated = updateMessageToolCallsInSelectedSession(liveState.sessions, liveState.parsedMessages, sessionId, assistantMessageId, toolCalls);
|
|
8019
|
+
const nextState = getNextHandleTextChunkState(liveState, updated.parsedMessages, updated.sessions);
|
|
8020
|
+
await setAndRerenderHandleTextChunkState(uid, liveState, nextState);
|
|
7985
8021
|
return {
|
|
7986
8022
|
latestState: nextState,
|
|
7987
8023
|
previousState: nextState
|
|
@@ -8018,32 +8054,39 @@ const updateMessageTextInSelectedSession = async (sessions, parsedMessages, sele
|
|
|
8018
8054
|
sessions: updatedSessions
|
|
8019
8055
|
};
|
|
8020
8056
|
};
|
|
8021
|
-
const handleTextChunkFunction = async (uid, assistantMessageId, chunk, handleTextChunkState) => {
|
|
8022
|
-
const
|
|
8057
|
+
const handleTextChunkFunction = async (uid, sessionId, assistantMessageId, chunk, handleTextChunkState) => {
|
|
8058
|
+
const liveState = get$1(uid)?.newState || handleTextChunkState.latestState;
|
|
8059
|
+
const selectedSession = liveState.sessions.find(session => session.id === sessionId);
|
|
8023
8060
|
if (!selectedSession) {
|
|
8024
8061
|
return {
|
|
8025
|
-
latestState:
|
|
8026
|
-
previousState:
|
|
8062
|
+
latestState: liveState,
|
|
8063
|
+
previousState: liveState
|
|
8064
|
+
};
|
|
8065
|
+
}
|
|
8066
|
+
if (getChatSessionStatus(selectedSession) === 'stopped') {
|
|
8067
|
+
return {
|
|
8068
|
+
latestState: liveState,
|
|
8069
|
+
previousState: liveState
|
|
8027
8070
|
};
|
|
8028
8071
|
}
|
|
8029
8072
|
const assistantMessage = selectedSession.messages.find(message => message.id === assistantMessageId);
|
|
8030
8073
|
if (!assistantMessage) {
|
|
8031
8074
|
return {
|
|
8032
|
-
latestState:
|
|
8033
|
-
previousState:
|
|
8075
|
+
latestState: liveState,
|
|
8076
|
+
previousState: liveState
|
|
8034
8077
|
};
|
|
8035
8078
|
}
|
|
8036
8079
|
const updatedText = assistantMessage.text + chunk;
|
|
8037
|
-
const updated = await updateMessageTextInSelectedSession(
|
|
8080
|
+
const updated = await updateMessageTextInSelectedSession(liveState.sessions, liveState.parsedMessages, sessionId, assistantMessageId, updatedText, true);
|
|
8038
8081
|
const nextState = {
|
|
8039
|
-
...
|
|
8040
|
-
...(
|
|
8041
|
-
messagesScrollTop: getNextAutoScrollTop(
|
|
8082
|
+
...liveState,
|
|
8083
|
+
...(liveState.messagesAutoScrollEnabled ? {
|
|
8084
|
+
messagesScrollTop: getNextAutoScrollTop(liveState.messagesScrollTop)
|
|
8042
8085
|
} : {}),
|
|
8043
8086
|
parsedMessages: updated.parsedMessages,
|
|
8044
8087
|
sessions: updated.sessions
|
|
8045
8088
|
};
|
|
8046
|
-
set(uid,
|
|
8089
|
+
set(uid, liveState, nextState);
|
|
8047
8090
|
await invoke('Chat.rerender');
|
|
8048
8091
|
return {
|
|
8049
8092
|
latestState: nextState,
|
|
@@ -8142,6 +8185,32 @@ const withUpdatedMessageScrollTop = state => {
|
|
|
8142
8185
|
};
|
|
8143
8186
|
};
|
|
8144
8187
|
const workspaceUriPlaceholder = '{{workspaceUri}}';
|
|
8188
|
+
const getLiveState = uid => {
|
|
8189
|
+
const entry = get$1(uid);
|
|
8190
|
+
return entry?.newState;
|
|
8191
|
+
};
|
|
8192
|
+
const updateSessionStatus = (sessions, sessionId, status) => {
|
|
8193
|
+
return sessions.map(session => {
|
|
8194
|
+
if (session.id !== sessionId) {
|
|
8195
|
+
return session;
|
|
8196
|
+
}
|
|
8197
|
+
return {
|
|
8198
|
+
...session,
|
|
8199
|
+
status
|
|
8200
|
+
};
|
|
8201
|
+
});
|
|
8202
|
+
};
|
|
8203
|
+
const isSessionStopped = (uid, sessionId) => {
|
|
8204
|
+
const liveState = getLiveState(uid);
|
|
8205
|
+
if (!liveState) {
|
|
8206
|
+
return false;
|
|
8207
|
+
}
|
|
8208
|
+
const session = liveState.sessions.find(item => item.id === sessionId);
|
|
8209
|
+
if (!session) {
|
|
8210
|
+
return false;
|
|
8211
|
+
}
|
|
8212
|
+
return getChatSessionStatus(session) === 'stopped';
|
|
8213
|
+
};
|
|
8145
8214
|
const clearComposerAttachments = async (sessionId, attachmentIds) => {
|
|
8146
8215
|
if (!sessionId) {
|
|
8147
8216
|
return;
|
|
@@ -8317,6 +8386,7 @@ const handleSubmit = async state => {
|
|
|
8317
8386
|
id: newSessionId,
|
|
8318
8387
|
messages: streamingEnabled ? [userMessage, inProgressAssistantMessage] : [userMessage],
|
|
8319
8388
|
projectId: state.selectedProjectId,
|
|
8389
|
+
status: 'in-progress',
|
|
8320
8390
|
title: `Chat ${workingSessions.length + 1}`
|
|
8321
8391
|
};
|
|
8322
8392
|
const provisionedSession = await withProvisionedBackgroundSession(state, newSession);
|
|
@@ -8356,7 +8426,8 @@ const handleSubmit = async state => {
|
|
|
8356
8426
|
}) : workingSessions;
|
|
8357
8427
|
const updatedWithUser = appendMessageToSelectedSession(workingSessionsWithProvisionedSession, selectedSessionId, userMessage);
|
|
8358
8428
|
const updatedSessions = streamingEnabled ? appendMessageToSelectedSession(updatedWithUser, selectedSessionId, inProgressAssistantMessage) : updatedWithUser;
|
|
8359
|
-
const
|
|
8429
|
+
const updatedSessionsWithStatus = updateSessionStatus(updatedSessions, selectedSessionId, 'in-progress');
|
|
8430
|
+
const selectedSession = updatedSessionsWithStatus.find(session => session.id === selectedSessionId);
|
|
8360
8431
|
if (selectedSession) {
|
|
8361
8432
|
await saveChatSession(selectedSession);
|
|
8362
8433
|
}
|
|
@@ -8372,7 +8443,7 @@ const handleSubmit = async state => {
|
|
|
8372
8443
|
lastSubmittedSessionId: selectedSessionId,
|
|
8373
8444
|
nextMessageId: nextMessageId + 1,
|
|
8374
8445
|
parsedMessages,
|
|
8375
|
-
sessions:
|
|
8446
|
+
sessions: updatedSessionsWithStatus
|
|
8376
8447
|
}));
|
|
8377
8448
|
optimisticState = withUpdatedChatInputHistory(optimisticState, userText);
|
|
8378
8449
|
}
|
|
@@ -8393,7 +8464,7 @@ const handleSubmit = async state => {
|
|
|
8393
8464
|
const mentionContextMessage = await getMentionContextMessage(userText);
|
|
8394
8465
|
const messagesWithMentionContext = mentionContextMessage ? [...messages, mentionContextMessage] : messages;
|
|
8395
8466
|
const handleTextChunkFunctionRef = streamingEnabled ? async chunk => {
|
|
8396
|
-
handleTextChunkState = await handleTextChunkFunction(state.uid, assistantMessageId, chunk, handleTextChunkState);
|
|
8467
|
+
handleTextChunkState = await handleTextChunkFunction(state.uid, optimisticState.selectedSessionId, assistantMessageId, chunk, handleTextChunkState);
|
|
8397
8468
|
} : undefined;
|
|
8398
8469
|
const assistantMessage = await getAiResponse({
|
|
8399
8470
|
agentMode,
|
|
@@ -8409,6 +8480,9 @@ const handleSubmit = async state => {
|
|
|
8409
8480
|
models,
|
|
8410
8481
|
nextMessageId: optimisticState.nextMessageId,
|
|
8411
8482
|
onDataEvent: async value => {
|
|
8483
|
+
if (isSessionStopped(state.uid, optimisticState.selectedSessionId)) {
|
|
8484
|
+
return;
|
|
8485
|
+
}
|
|
8412
8486
|
if (!emitStreamingFunctionCallEvents && isStreamingFunctionCallEvent(value)) {
|
|
8413
8487
|
return;
|
|
8414
8488
|
}
|
|
@@ -8421,6 +8495,9 @@ const handleSubmit = async state => {
|
|
|
8421
8495
|
});
|
|
8422
8496
|
},
|
|
8423
8497
|
onEventStreamFinished: async () => {
|
|
8498
|
+
if (isSessionStopped(state.uid, optimisticState.selectedSessionId)) {
|
|
8499
|
+
return;
|
|
8500
|
+
}
|
|
8424
8501
|
await appendChatViewEvent({
|
|
8425
8502
|
sessionId: optimisticState.selectedSessionId,
|
|
8426
8503
|
timestamp: new Date().toISOString(),
|
|
@@ -8435,7 +8512,7 @@ const handleSubmit = async state => {
|
|
|
8435
8512
|
onTextChunk: handleTextChunkFunctionRef
|
|
8436
8513
|
} : {}),
|
|
8437
8514
|
onToolCallsChunk: async toolCalls => {
|
|
8438
|
-
handleTextChunkState = await handleToolCallsChunkFunction(state.uid, assistantMessageId, toolCalls, handleTextChunkState);
|
|
8515
|
+
handleTextChunkState = await handleToolCallsChunkFunction(state.uid, optimisticState.selectedSessionId, assistantMessageId, toolCalls, handleTextChunkState);
|
|
8439
8516
|
},
|
|
8440
8517
|
openApiApiBaseUrl,
|
|
8441
8518
|
openApiApiKey,
|
|
@@ -8460,6 +8537,9 @@ const handleSubmit = async state => {
|
|
|
8460
8537
|
webSearchEnabled,
|
|
8461
8538
|
workspaceUri
|
|
8462
8539
|
});
|
|
8540
|
+
if (isSessionStopped(state.uid, optimisticState.selectedSessionId)) {
|
|
8541
|
+
return getLiveState(state.uid) || handleTextChunkState.latestState;
|
|
8542
|
+
}
|
|
8463
8543
|
const {
|
|
8464
8544
|
latestState
|
|
8465
8545
|
} = handleTextChunkState;
|
|
@@ -8482,6 +8562,7 @@ const handleSubmit = async state => {
|
|
|
8482
8562
|
}
|
|
8483
8563
|
}
|
|
8484
8564
|
}
|
|
8565
|
+
updatedSessions = updateSessionStatus(updatedSessions, latestState.selectedSessionId, 'finished');
|
|
8485
8566
|
const selectedSession = updatedSessions.find(session => session.id === latestState.selectedSessionId);
|
|
8486
8567
|
if (selectedSession) {
|
|
8487
8568
|
await saveChatSession(selectedSession);
|
|
@@ -8499,6 +8580,36 @@ const handleClickSend = async state => {
|
|
|
8499
8580
|
return handleSubmit(state);
|
|
8500
8581
|
};
|
|
8501
8582
|
|
|
8583
|
+
const handleClickStop = async state => {
|
|
8584
|
+
const selectedSession = state.sessions.find(session => session.id === state.selectedSessionId);
|
|
8585
|
+
if (!selectedSession || getChatSessionStatus(selectedSession) !== 'in-progress') {
|
|
8586
|
+
return state;
|
|
8587
|
+
}
|
|
8588
|
+
const updatedSelectedSession = {
|
|
8589
|
+
...selectedSession,
|
|
8590
|
+
messages: selectedSession.messages.map(message => {
|
|
8591
|
+
if (message.role !== 'assistant' || !message.inProgress) {
|
|
8592
|
+
return message;
|
|
8593
|
+
}
|
|
8594
|
+
return {
|
|
8595
|
+
...message,
|
|
8596
|
+
inProgress: false
|
|
8597
|
+
};
|
|
8598
|
+
}),
|
|
8599
|
+
status: 'stopped'
|
|
8600
|
+
};
|
|
8601
|
+
await saveChatSession(updatedSelectedSession);
|
|
8602
|
+
return {
|
|
8603
|
+
...state,
|
|
8604
|
+
sessions: state.sessions.map(session => {
|
|
8605
|
+
if (session.id !== updatedSelectedSession.id) {
|
|
8606
|
+
return session;
|
|
8607
|
+
}
|
|
8608
|
+
return updatedSelectedSession;
|
|
8609
|
+
})
|
|
8610
|
+
};
|
|
8611
|
+
};
|
|
8612
|
+
|
|
8502
8613
|
const SwitchGitBranch = 'Chat.switchGitBranch';
|
|
8503
8614
|
const switchGitBranch = async ({
|
|
8504
8615
|
assetDir,
|
|
@@ -8949,6 +9060,8 @@ const handleClick = async (state, name, id = '', eventX = 0, eventY = 0) => {
|
|
|
8949
9060
|
return deleteProject(state, id);
|
|
8950
9061
|
case name === Send:
|
|
8951
9062
|
return handleClickSend(state);
|
|
9063
|
+
case name === Stop:
|
|
9064
|
+
return handleClickStop(state);
|
|
8952
9065
|
case name === ScrollDown:
|
|
8953
9066
|
return {
|
|
8954
9067
|
...state,
|
|
@@ -10666,6 +10779,14 @@ const getCss = (composerHeight, composerAttachmentsHeight, modelPickerHeight, li
|
|
|
10666
10779
|
object-fit: cover;
|
|
10667
10780
|
}
|
|
10668
10781
|
|
|
10782
|
+
.ChatComposerAttachmentPreview,
|
|
10783
|
+
.ChatAttachmentPreview,
|
|
10784
|
+
.ChatMessageImage,
|
|
10785
|
+
.ChatComposerAttachmentPreviewOverlayImage,
|
|
10786
|
+
.ImageElement{
|
|
10787
|
+
cursor: default;
|
|
10788
|
+
}
|
|
10789
|
+
|
|
10669
10790
|
.ChatComposerAttachmentRemoveButton{
|
|
10670
10791
|
appearance: none;
|
|
10671
10792
|
background: transparent;
|
|
@@ -11572,7 +11693,7 @@ const getSendButtonClassName = isSendDisabled => {
|
|
|
11572
11693
|
return mergeClassNames(IconButton, isSendDisabled ? SendButtonDisabled : '');
|
|
11573
11694
|
};
|
|
11574
11695
|
|
|
11575
|
-
const getSendButtonDom = (isSendDisabled, voiceDictationEnabled) => {
|
|
11696
|
+
const getSendButtonDom = (isSendDisabled, voiceDictationEnabled, isSessionInProgress) => {
|
|
11576
11697
|
const sendButtonClassName = getSendButtonClassName(isSendDisabled);
|
|
11577
11698
|
return [...(voiceDictationEnabled ? [{
|
|
11578
11699
|
childCount: 1,
|
|
@@ -11585,7 +11706,15 @@ const getSendButtonDom = (isSendDisabled, voiceDictationEnabled) => {
|
|
|
11585
11706
|
childCount: 0,
|
|
11586
11707
|
className: 'MaskIcon MaskIconMic',
|
|
11587
11708
|
type: Div
|
|
11588
|
-
}] : []), {
|
|
11709
|
+
}] : []), ...(isSessionInProgress ? [{
|
|
11710
|
+
buttonType: 'button',
|
|
11711
|
+
childCount: 1,
|
|
11712
|
+
className: Button,
|
|
11713
|
+
name: Stop,
|
|
11714
|
+
onClick: HandleClick,
|
|
11715
|
+
title: stop(),
|
|
11716
|
+
type: Button$1
|
|
11717
|
+
}, text(stop())] : [{
|
|
11589
11718
|
buttonType: 'submit',
|
|
11590
11719
|
childCount: 1,
|
|
11591
11720
|
className: sendButtonClassName,
|
|
@@ -11598,7 +11727,7 @@ const getSendButtonDom = (isSendDisabled, voiceDictationEnabled) => {
|
|
|
11598
11727
|
className: 'MaskIcon MaskIconArrowUp',
|
|
11599
11728
|
role: 'none',
|
|
11600
11729
|
type: Div
|
|
11601
|
-
}];
|
|
11730
|
+
}])];
|
|
11602
11731
|
};
|
|
11603
11732
|
|
|
11604
11733
|
const getTodoItemClassName = status => {
|
|
@@ -11780,7 +11909,7 @@ const getComposerTextAreaDom = () => {
|
|
|
11780
11909
|
};
|
|
11781
11910
|
};
|
|
11782
11911
|
|
|
11783
|
-
const getChatSendAreaDom = (composerValue, composerAttachments, agentMode, agentModePickerOpen, gitBranchPickerVisible, gitBranchPickerOpen, gitBranchPickerErrorMessage, gitBranches, fallbackBranchName, hasSpaceForAgentModePicker, modelPickerOpen, models, selectedModelId, reasoningPickerEnabled, reasoningEffort, reasoningEffortPickerOpen, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, hasSpaceForRunModePicker, runMode, runModePickerOpen, todoListToolEnabled, todoListItems, showCreatePullRequestButton = false, voiceDictationEnabled = false, scrollDownButtonEnabled = false, messagesAutoScrollEnabled = true) => {
|
|
11912
|
+
const getChatSendAreaDom = (composerValue, composerAttachments, agentMode, agentModePickerOpen, gitBranchPickerVisible, gitBranchPickerOpen, gitBranchPickerErrorMessage, gitBranches, fallbackBranchName, hasSpaceForAgentModePicker, modelPickerOpen, models, selectedModelId, reasoningPickerEnabled, reasoningEffort, reasoningEffortPickerOpen, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, hasSpaceForRunModePicker, runMode, runModePickerOpen, todoListToolEnabled, todoListItems, showCreatePullRequestButton = false, voiceDictationEnabled = false, isSessionInProgress = false, scrollDownButtonEnabled = false, messagesAutoScrollEnabled = true) => {
|
|
11784
11913
|
const isSendDisabled = composerValue.trim() === '';
|
|
11785
11914
|
const showAgentModePicker = hasSpaceForAgentModePicker;
|
|
11786
11915
|
const showGitBranchPicker = gitBranchPickerVisible || Boolean(fallbackBranchName);
|
|
@@ -11810,7 +11939,7 @@ const getChatSendAreaDom = (composerValue, composerAttachments, agentMode, agent
|
|
|
11810
11939
|
className: ChatSendAreaPrimaryControls,
|
|
11811
11940
|
role: 'toolbar',
|
|
11812
11941
|
type: Div
|
|
11813
|
-
}, ...(showAgentModePicker ? getAgentModePickerVirtualDom(agentMode, agentModePickerOpen) : []), ...getChatModelPickerToggleVirtualDom(models, selectedModelId, modelPickerOpen), ...(reasoningPickerEnabled ? getReasoningEffortPickerVirtualDom(reasoningEffort, reasoningEffortPickerOpen) : []), ...(showResponsiveRunModePicker ? getRunModePickerVirtualDom(runMode, runModePickerOpen) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...(showCreatePullRequestButton ? getCreatePullRequestButtonDom() : []), ...(showGitBranchPicker ? getGitBranchPickerVirtualDom(gitBranches, gitBranchPickerOpen, gitBranchPickerErrorMessage, fallbackBranchName) : []), ...(showScrollDownButton ? getScrollDownButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
|
|
11942
|
+
}, ...(showAgentModePicker ? getAgentModePickerVirtualDom(agentMode, agentModePickerOpen) : []), ...getChatModelPickerToggleVirtualDom(models, selectedModelId, modelPickerOpen), ...(reasoningPickerEnabled ? getReasoningEffortPickerVirtualDom(reasoningEffort, reasoningEffortPickerOpen) : []), ...(showResponsiveRunModePicker ? getRunModePickerVirtualDom(runMode, runModePickerOpen) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...(showCreatePullRequestButton ? getCreatePullRequestButtonDom() : []), ...(showGitBranchPicker ? getGitBranchPickerVirtualDom(gitBranches, gitBranchPickerOpen, gitBranchPickerErrorMessage, fallbackBranchName) : []), ...(showScrollDownButton ? getScrollDownButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled, isSessionInProgress)];
|
|
11814
11943
|
};
|
|
11815
11944
|
|
|
11816
11945
|
const authContainerStyle = 'align-items:center;display:flex;gap:8px;min-width:0;';
|
|
@@ -13926,6 +14055,7 @@ const getChatModeChatFocusVirtualDom = ({
|
|
|
13926
14055
|
const isRunModePickerVisible = showRunMode && hasSpaceForRunModePicker && runModePickerOpen;
|
|
13927
14056
|
const hasVisibleOverlays = isDropOverlayVisible || isComposerAttachmentPreviewOverlayVisible || isAgentModePickerVisible || isNewModelPickerVisible || isRunModePickerVisible;
|
|
13928
14057
|
const chatRootChildCount = 2 + (hasVisibleOverlays ? 1 : 0);
|
|
14058
|
+
const isSelectedSessionInProgress = selectedSession ? getChatSessionStatus(selectedSession) === 'in-progress' : false;
|
|
13929
14059
|
return [{
|
|
13930
14060
|
childCount: chatRootChildCount + 1,
|
|
13931
14061
|
className: mergeClassNames(Viewlet, Chat, ChatFocus),
|
|
@@ -13945,7 +14075,7 @@ const getChatModeChatFocusVirtualDom = ({
|
|
|
13945
14075
|
childCount: 3,
|
|
13946
14076
|
className: ChatFocusMainArea,
|
|
13947
14077
|
type: Div
|
|
13948
|
-
}, ...getChatHeaderDomFocusMode(selectedSessionTitle, selectedProjectName, authEnabled, userState, userName), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openApiApiKeyState, openApiApiKeysSettingsUrl, openApiApiKeyInputPattern, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, composerAttachments, agentMode, agentModePickerOpen, gitBranchPickerVisible, gitBranchPickerOpen, gitBranchPickerErrorMessage, gitBranches, selectedSession?.branchName || '', hasSpaceForAgentModePicker, modelPickerOpen, models, selectedModelId, reasoningPickerEnabled, reasoningEffort, reasoningEffortPickerOpen, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, hasSpaceForRunModePicker, runMode, runModePickerOpen, todoListToolEnabled, todoListItems, showCreatePullRequestButton, voiceDictationEnabled, scrollDownButtonEnabled, messagesAutoScrollEnabled), ...getChatOverlaysVirtualDom({
|
|
14078
|
+
}, ...getChatHeaderDomFocusMode(selectedSessionTitle, selectedProjectName, authEnabled, userState, userName), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openApiApiKeyState, openApiApiKeysSettingsUrl, openApiApiKeyInputPattern, openRouterApiKeyState, messagesScrollTop, useChatMathWorker, true), ...getChatSendAreaDom(composerValue, composerAttachments, agentMode, agentModePickerOpen, gitBranchPickerVisible, gitBranchPickerOpen, gitBranchPickerErrorMessage, gitBranches, selectedSession?.branchName || '', hasSpaceForAgentModePicker, modelPickerOpen, models, selectedModelId, reasoningPickerEnabled, reasoningEffort, reasoningEffortPickerOpen, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, hasSpaceForRunModePicker, runMode, runModePickerOpen, todoListToolEnabled, todoListItems, showCreatePullRequestButton, voiceDictationEnabled, isSelectedSessionInProgress, scrollDownButtonEnabled, messagesAutoScrollEnabled), ...getChatOverlaysVirtualDom({
|
|
13949
14079
|
agentMode,
|
|
13950
14080
|
agentModePickerVisible: isAgentModePickerVisible,
|
|
13951
14081
|
composerAttachmentPreviewOverlayAttachmentId,
|
|
@@ -14101,6 +14231,7 @@ const getChatModeDetailVirtualDom = ({
|
|
|
14101
14231
|
voiceDictationEnabled = false
|
|
14102
14232
|
}) => {
|
|
14103
14233
|
const selectedSession = sessions.find(session => session.id === selectedSessionId);
|
|
14234
|
+
const isSelectedSessionInProgress = selectedSession ? getChatSessionStatus(selectedSession) === 'in-progress' : false;
|
|
14104
14235
|
const selectedSessionTitle = selectedSession?.title || chatTitle();
|
|
14105
14236
|
const messages = selectedSession ? selectedSession.messages : [];
|
|
14106
14237
|
const showCreatePullRequestButton = canCreatePullRequest(selectedSession);
|
|
@@ -14117,7 +14248,7 @@ const getChatModeDetailVirtualDom = ({
|
|
|
14117
14248
|
onDragEnter: HandleDragEnterChatView,
|
|
14118
14249
|
onDragOver: HandleDragOverChatView,
|
|
14119
14250
|
type: Div
|
|
14120
|
-
}, ...getChatHeaderDomDetailMode(selectedSessionTitle, authEnabled, userState, userName, authErrorMessage), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openApiApiKeyState, openApiApiKeysSettingsUrl, openApiApiKeyInputPattern, openRouterApiKeyState, messagesScrollTop, useChatMathWorker), ...getChatSendAreaDom(composerValue, composerAttachments, agentMode, agentModePickerOpen, false, false, '', [], '', hasSpaceForAgentModePicker, modelPickerOpen, models, selectedModelId, reasoningPickerEnabled, reasoningEffort, reasoningEffortPickerOpen, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, hasSpaceForRunModePicker, runMode, runModePickerOpen, todoListToolEnabled, todoListItems, showCreatePullRequestButton, voiceDictationEnabled, scrollDownButtonEnabled, messagesAutoScrollEnabled), ...getChatOverlaysVirtualDom({
|
|
14251
|
+
}, ...getChatHeaderDomDetailMode(selectedSessionTitle, authEnabled, userState, userName, authErrorMessage), ...getMessagesDom(messages, parsedMessages, openRouterApiKeyInput, openApiApiKeyInput, openApiApiKeyState, openApiApiKeysSettingsUrl, openApiApiKeyInputPattern, openRouterApiKeyState, messagesScrollTop, useChatMathWorker), ...getChatSendAreaDom(composerValue, composerAttachments, agentMode, agentModePickerOpen, false, false, '', [], '', hasSpaceForAgentModePicker, modelPickerOpen, models, selectedModelId, reasoningPickerEnabled, reasoningEffort, reasoningEffortPickerOpen, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, hasSpaceForRunModePicker, runMode, runModePickerOpen, todoListToolEnabled, todoListItems, showCreatePullRequestButton, voiceDictationEnabled, isSelectedSessionInProgress, scrollDownButtonEnabled, messagesAutoScrollEnabled), ...getChatOverlaysVirtualDom({
|
|
14121
14252
|
agentMode,
|
|
14122
14253
|
agentModePickerVisible: isAgentModePickerVisible,
|
|
14123
14254
|
composerAttachmentPreviewOverlayAttachmentId,
|
|
@@ -14189,12 +14320,11 @@ const getEmptyChatSessionsDom = () => {
|
|
|
14189
14320
|
};
|
|
14190
14321
|
|
|
14191
14322
|
const getSessionStatusClassName = session => {
|
|
14192
|
-
const
|
|
14193
|
-
if (
|
|
14323
|
+
const status = getChatSessionStatus(session);
|
|
14324
|
+
if (status === 'in-progress') {
|
|
14194
14325
|
return ChatListItemStatusInProgress;
|
|
14195
14326
|
}
|
|
14196
|
-
|
|
14197
|
-
if (hasAssistantMessage) {
|
|
14327
|
+
if (status === 'finished') {
|
|
14198
14328
|
return ChatListItemStatusFinished;
|
|
14199
14329
|
}
|
|
14200
14330
|
return ChatListItemStatusStopped;
|
|
@@ -14321,7 +14451,7 @@ const getChatModeListVirtualDom = ({
|
|
|
14321
14451
|
onDragEnter: HandleDragEnterChatView,
|
|
14322
14452
|
onDragOver: HandleDragOverChatView,
|
|
14323
14453
|
type: Div
|
|
14324
|
-
}, ...getChatHeaderListModeDom(authEnabled, userState, userName, authErrorMessage, searchEnabled, searchFieldVisible, searchValue), ...getChatListDom(visibleSessions, selectedSessionId, listFocusedIndex, chatListScrollTop), ...getChatSendAreaDom(composerValue, composerAttachments, agentMode, agentModePickerOpen, false, false, '', [], '', hasSpaceForAgentModePicker, modelPickerOpen, models, selectedModelId, reasoningPickerEnabled, reasoningEffort, reasoningEffortPickerOpen, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, hasSpaceForRunModePicker, runMode, runModePickerOpen, todoListToolEnabled, todoListItems, false, voiceDictationEnabled), ...getChatOverlaysVirtualDom({
|
|
14454
|
+
}, ...getChatHeaderListModeDom(authEnabled, userState, userName, authErrorMessage, searchEnabled, searchFieldVisible, searchValue), ...getChatListDom(visibleSessions, selectedSessionId, listFocusedIndex, chatListScrollTop), ...getChatSendAreaDom(composerValue, composerAttachments, agentMode, agentModePickerOpen, false, false, '', [], '', hasSpaceForAgentModePicker, modelPickerOpen, models, selectedModelId, reasoningPickerEnabled, reasoningEffort, reasoningEffortPickerOpen, usageOverviewEnabled, tokensUsed, tokensMax, addContextButtonEnabled, showRunMode, hasSpaceForRunModePicker, runMode, runModePickerOpen, todoListToolEnabled, todoListItems, false, voiceDictationEnabled, false), ...getChatOverlaysVirtualDom({
|
|
14325
14455
|
agentMode,
|
|
14326
14456
|
agentModePickerVisible: isAgentModePickerVisible,
|
|
14327
14457
|
composerAttachmentPreviewOverlayAttachmentId,
|