@lvce-editor/chat-view 6.18.0 → 6.19.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 +144 -11
- package/package.json +1 -1
|
@@ -1473,7 +1473,7 @@ const chatTitle = () => {
|
|
|
1473
1473
|
return i18nString('Chat');
|
|
1474
1474
|
};
|
|
1475
1475
|
const chats = () => {
|
|
1476
|
-
return i18nString('
|
|
1476
|
+
return i18nString('Chat');
|
|
1477
1477
|
};
|
|
1478
1478
|
const newChat = () => {
|
|
1479
1479
|
return i18nString('New Chat');
|
|
@@ -1551,7 +1551,7 @@ const getOpenApiApiKey = () => {
|
|
|
1551
1551
|
return i18nString('Get API Key');
|
|
1552
1552
|
};
|
|
1553
1553
|
const deleteChatSession$1 = () => {
|
|
1554
|
-
return i18nString('
|
|
1554
|
+
return i18nString('Archive');
|
|
1555
1555
|
};
|
|
1556
1556
|
const defaultSessionTitle = () => {
|
|
1557
1557
|
return i18nString('Chat 1');
|
|
@@ -2971,6 +2971,7 @@ const OpenContainingFolder = 'Open Containing Folder';
|
|
|
2971
2971
|
const OpenInIntegratedTerminal = 'Open in integrated Terminal';
|
|
2972
2972
|
const Paste = 'Paste';
|
|
2973
2973
|
const Rename = 'Rename';
|
|
2974
|
+
const Archive = 'Archive';
|
|
2974
2975
|
|
|
2975
2976
|
const openContainingFolder = () => {
|
|
2976
2977
|
return i18nString(OpenContainingFolder);
|
|
@@ -2996,10 +2997,27 @@ const copyRelativePath = () => {
|
|
|
2996
2997
|
const rename = () => {
|
|
2997
2998
|
return i18nString(Rename);
|
|
2998
2999
|
};
|
|
3000
|
+
const archive = () => {
|
|
3001
|
+
return i18nString(Archive);
|
|
3002
|
+
};
|
|
2999
3003
|
const deleteItem = () => {
|
|
3000
3004
|
return i18nString(Delete);
|
|
3001
3005
|
};
|
|
3002
3006
|
|
|
3007
|
+
const getMenuEntriesChatList = () => {
|
|
3008
|
+
return [{
|
|
3009
|
+
command: 'Chat.handleClickRename',
|
|
3010
|
+
flags: None,
|
|
3011
|
+
id: 'rename',
|
|
3012
|
+
label: rename()
|
|
3013
|
+
}, {
|
|
3014
|
+
command: 'Chat.handleClickArchive',
|
|
3015
|
+
flags: None,
|
|
3016
|
+
id: 'archive',
|
|
3017
|
+
label: archive()
|
|
3018
|
+
}];
|
|
3019
|
+
};
|
|
3020
|
+
|
|
3003
3021
|
const menuEntrySeparator = {
|
|
3004
3022
|
command: '',
|
|
3005
3023
|
flags: Separator,
|
|
@@ -3070,8 +3088,13 @@ const menuEntryDelete = {
|
|
|
3070
3088
|
const getMenuEntriesFile = () => {
|
|
3071
3089
|
return [menuEntryCopyAsE2eTest, menuEntryOpenContainingFolder, menuEntryOpenInIntegratedTerminal, menuEntrySeparator, menuEntryCut, menuEntryCopy, menuEntryPaste, menuEntrySeparator, menuEntryCopyPath, menuEntryCopyRelativePath, menuEntrySeparator, menuEntryRename, menuEntryDelete];
|
|
3072
3090
|
};
|
|
3073
|
-
const getMenuEntries =
|
|
3074
|
-
|
|
3091
|
+
const getMenuEntries = menuId => {
|
|
3092
|
+
switch (menuId) {
|
|
3093
|
+
case 1:
|
|
3094
|
+
return getMenuEntriesChatList();
|
|
3095
|
+
default:
|
|
3096
|
+
return getMenuEntriesFile();
|
|
3097
|
+
}
|
|
3075
3098
|
};
|
|
3076
3099
|
|
|
3077
3100
|
const getMenuEntryIds = () => {
|
|
@@ -3086,6 +3109,14 @@ const getSelectedSessionId = state => {
|
|
|
3086
3109
|
return state.selectedSessionId;
|
|
3087
3110
|
};
|
|
3088
3111
|
|
|
3112
|
+
const handleChatHeaderContextMenu = async state => {
|
|
3113
|
+
return state;
|
|
3114
|
+
};
|
|
3115
|
+
|
|
3116
|
+
const handleChatInputContextMenu = async state => {
|
|
3117
|
+
return state;
|
|
3118
|
+
};
|
|
3119
|
+
|
|
3089
3120
|
const getListIndex = (state, eventX, eventY) => {
|
|
3090
3121
|
const {
|
|
3091
3122
|
headerHeight,
|
|
@@ -3103,18 +3134,29 @@ const getListIndex = (state, eventX, eventY) => {
|
|
|
3103
3134
|
return Math.floor(relativeY / listItemHeight);
|
|
3104
3135
|
};
|
|
3105
3136
|
|
|
3106
|
-
const CHAT_LIST_ITEM_CONTEXT_MENU = 'ChatListItemContextMenu';
|
|
3107
3137
|
const handleChatListContextMenu = async (state, eventX, eventY) => {
|
|
3138
|
+
const {
|
|
3139
|
+
selectedProjectId,
|
|
3140
|
+
sessions,
|
|
3141
|
+
uid
|
|
3142
|
+
} = state;
|
|
3108
3143
|
const index = getListIndex(state, eventX, eventY);
|
|
3109
3144
|
if (index === -1) {
|
|
3110
3145
|
return state;
|
|
3111
3146
|
}
|
|
3112
|
-
const visibleSessions = getVisibleSessions(
|
|
3147
|
+
const visibleSessions = getVisibleSessions(sessions, selectedProjectId);
|
|
3113
3148
|
const item = visibleSessions[index];
|
|
3114
3149
|
if (!item) {
|
|
3115
3150
|
return state;
|
|
3116
3151
|
}
|
|
3117
|
-
await
|
|
3152
|
+
await showContextMenu2(uid, -1, eventX, eventY, {
|
|
3153
|
+
menuId: -1,
|
|
3154
|
+
sessionId: item.id
|
|
3155
|
+
});
|
|
3156
|
+
return state;
|
|
3157
|
+
};
|
|
3158
|
+
|
|
3159
|
+
const handleChatWelcomeContextMenu = async state => {
|
|
3118
3160
|
return state;
|
|
3119
3161
|
};
|
|
3120
3162
|
|
|
@@ -8997,6 +9039,7 @@ const registerMockResponse = (state, mockResponse) => {
|
|
|
8997
9039
|
return state;
|
|
8998
9040
|
};
|
|
8999
9041
|
|
|
9042
|
+
/* eslint-disable @cspell/spellchecker */
|
|
9000
9043
|
const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessageLineHeight, chatMessageFontFamily, textAreaPaddingTop, textAreaPaddingLeft, textAreaPaddingRight, textAreaPaddingBottom, chatSendAreaPaddingTop, chatSendAreaPaddingLeft, chatSendAreaPaddingRight, chatSendAreaPaddingBottom, renderHtmlCss) => {
|
|
9001
9044
|
const buttonsHeight = 20;
|
|
9002
9045
|
const gap = 10;
|
|
@@ -9023,6 +9066,46 @@ const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessage
|
|
|
9023
9066
|
.ChatSendAreaBottom{
|
|
9024
9067
|
height: ${buttonsHeight}px;
|
|
9025
9068
|
}
|
|
9069
|
+
|
|
9070
|
+
.ChatSendArea:focus-within{
|
|
9071
|
+
border-color: darkcyan;
|
|
9072
|
+
}
|
|
9073
|
+
|
|
9074
|
+
.ChatListItem{
|
|
9075
|
+
display:flex;
|
|
9076
|
+
align-items:center;
|
|
9077
|
+
}
|
|
9078
|
+
|
|
9079
|
+
.ChatListItemStatusRow{
|
|
9080
|
+
width: 16px;
|
|
9081
|
+
min-width: 16px;
|
|
9082
|
+
display:flex;
|
|
9083
|
+
align-items:center;
|
|
9084
|
+
justify-content:center;
|
|
9085
|
+
}
|
|
9086
|
+
|
|
9087
|
+
.ChatListItemStatusIcon{
|
|
9088
|
+
font-size: 10px;
|
|
9089
|
+
}
|
|
9090
|
+
|
|
9091
|
+
.ChatListItemStatusStopped{
|
|
9092
|
+
color: var(--vscode-disabledForeground);
|
|
9093
|
+
}
|
|
9094
|
+
|
|
9095
|
+
.ChatListItemStatusInProgress{
|
|
9096
|
+
color: var(--vscode-charts-blue);
|
|
9097
|
+
}
|
|
9098
|
+
|
|
9099
|
+
.ChatListItemStatusFinished{
|
|
9100
|
+
color: var(--vscode-testing-iconPassed);
|
|
9101
|
+
.ChatListItem .SessionArchiveButton{
|
|
9102
|
+
opacity: 0;
|
|
9103
|
+
}
|
|
9104
|
+
|
|
9105
|
+
.ChatListItem:hover .SessionArchiveButton,
|
|
9106
|
+
.ChatListItem:focus-within .SessionArchiveButton{
|
|
9107
|
+
opacity: 1;
|
|
9108
|
+
}
|
|
9026
9109
|
`;
|
|
9027
9110
|
return `${baseCss}
|
|
9028
9111
|
|
|
@@ -9122,7 +9205,13 @@ const LabelDetail = 'LabelDetail';
|
|
|
9122
9205
|
const ChatList = 'ChatList';
|
|
9123
9206
|
const ChatListEmpty = 'ChatListEmpty';
|
|
9124
9207
|
const ChatListItem = 'ChatListItem';
|
|
9208
|
+
const ChatListItemStatusRow = 'ChatListItemStatusRow';
|
|
9209
|
+
const ChatListItemStatusIcon = 'ChatListItemStatusIcon';
|
|
9210
|
+
const ChatListItemStatusStopped = 'ChatListItemStatusStopped';
|
|
9211
|
+
const ChatListItemStatusInProgress = 'ChatListItemStatusInProgress';
|
|
9212
|
+
const ChatListItemStatusFinished = 'ChatListItemStatusFinished';
|
|
9125
9213
|
const ChatListItemLabel = 'ChatListItemLabel';
|
|
9214
|
+
const SessionArchiveButton = 'SessionArchiveButton';
|
|
9126
9215
|
const ProjectAddButton = 'ProjectAddButton';
|
|
9127
9216
|
const ProjectList = 'ProjectList';
|
|
9128
9217
|
const ProjectListChevron = 'ProjectListChevron';
|
|
@@ -9210,6 +9299,9 @@ const HandleClickDictationButton = 34;
|
|
|
9210
9299
|
const HandleMissingApiKeySubmit = 35;
|
|
9211
9300
|
const HandleRunModeChange = 36;
|
|
9212
9301
|
const HandleSearchInput = 37;
|
|
9302
|
+
const HandleChatWelcomeContextMenu = 39;
|
|
9303
|
+
const HandleChatHeaderContextMenu = 40;
|
|
9304
|
+
const HandleChatInputContextMenu = 41;
|
|
9213
9305
|
|
|
9214
9306
|
const getModelLabel = model => {
|
|
9215
9307
|
if (model.provider === 'openRouter') {
|
|
@@ -9449,6 +9541,7 @@ const getChatSendAreaDom = (composerValue, modelPickerOpen, modelPickerSearchVal
|
|
|
9449
9541
|
childCount: 0,
|
|
9450
9542
|
className: MultilineInputBox,
|
|
9451
9543
|
name: Composer,
|
|
9544
|
+
onContextMenu: HandleChatInputContextMenu,
|
|
9452
9545
|
onFocus: HandleFocus,
|
|
9453
9546
|
onInput: HandleInput,
|
|
9454
9547
|
placeholder: composePlaceholder(),
|
|
@@ -10742,6 +10835,7 @@ const getEmptyMessagesDom = () => {
|
|
|
10742
10835
|
return [{
|
|
10743
10836
|
childCount: 1,
|
|
10744
10837
|
className: ChatWelcomeMessage,
|
|
10838
|
+
onContextMenu: HandleChatWelcomeContextMenu,
|
|
10745
10839
|
type: Div
|
|
10746
10840
|
}, text(startConversation())];
|
|
10747
10841
|
};
|
|
@@ -11039,6 +11133,7 @@ const getChatHeaderDomDetailMode = (selectedSessionTitle, authEnabled = false, a
|
|
|
11039
11133
|
return [{
|
|
11040
11134
|
childCount: hasAuthError ? 3 : 2,
|
|
11041
11135
|
className: ChatHeader,
|
|
11136
|
+
onContextMenu: HandleChatHeaderContextMenu,
|
|
11042
11137
|
type: Div
|
|
11043
11138
|
}, {
|
|
11044
11139
|
childCount: 2,
|
|
@@ -11120,6 +11215,7 @@ const getChatHeaderListModeDom = (authEnabled = false, authStatus = 'signed-out'
|
|
|
11120
11215
|
return [{
|
|
11121
11216
|
childCount: headerChildCount,
|
|
11122
11217
|
className: ChatHeader,
|
|
11218
|
+
onContextMenu: HandleChatHeaderContextMenu,
|
|
11123
11219
|
type: Div
|
|
11124
11220
|
}, {
|
|
11125
11221
|
childCount: 1,
|
|
@@ -11157,18 +11253,37 @@ const getEmptyChatSessionsDom = () => {
|
|
|
11157
11253
|
}, text(clickToOpenNewChat())];
|
|
11158
11254
|
};
|
|
11159
11255
|
|
|
11256
|
+
const getSessionStatusClassName = session => {
|
|
11257
|
+
const hasInProgressAssistantMessage = session.messages.some(message => message.role === 'assistant' && message.inProgress);
|
|
11258
|
+
if (hasInProgressAssistantMessage) {
|
|
11259
|
+
return ChatListItemStatusInProgress;
|
|
11260
|
+
}
|
|
11261
|
+
const hasAssistantMessage = session.messages.some(message => message.role === 'assistant');
|
|
11262
|
+
if (hasAssistantMessage) {
|
|
11263
|
+
return ChatListItemStatusFinished;
|
|
11264
|
+
}
|
|
11265
|
+
return ChatListItemStatusStopped;
|
|
11266
|
+
};
|
|
11160
11267
|
const getSessionDom = session => {
|
|
11161
11268
|
const sessionClassName = ChatListItem;
|
|
11269
|
+
const sessionStatusClassName = getSessionStatusClassName(session);
|
|
11162
11270
|
return [{
|
|
11163
|
-
childCount:
|
|
11271
|
+
childCount: 3,
|
|
11164
11272
|
className: sessionClassName,
|
|
11165
11273
|
type: Li
|
|
11274
|
+
}, {
|
|
11275
|
+
childCount: 1,
|
|
11276
|
+
className: ChatListItemStatusRow,
|
|
11277
|
+
type: Div
|
|
11278
|
+
}, {
|
|
11279
|
+
childCount: 0,
|
|
11280
|
+
className: `${ChatListItemStatusIcon} codicon codicon-circle-filled ${sessionStatusClassName}`,
|
|
11281
|
+
type: Div
|
|
11166
11282
|
}, {
|
|
11167
11283
|
childCount: 1,
|
|
11168
11284
|
className: ChatListItemLabel,
|
|
11169
11285
|
name: getSessionInputName(session.id),
|
|
11170
11286
|
onContextMenu: HandleListContextMenu,
|
|
11171
|
-
tabIndex: 0,
|
|
11172
11287
|
type: Div
|
|
11173
11288
|
}, text(session.title), {
|
|
11174
11289
|
childCount: 1,
|
|
@@ -11176,14 +11291,18 @@ const getSessionDom = session => {
|
|
|
11176
11291
|
type: Div
|
|
11177
11292
|
}, {
|
|
11178
11293
|
childCount: 1,
|
|
11179
|
-
className: IconButton,
|
|
11294
|
+
className: mergeClassNames(IconButton, SessionArchiveButton),
|
|
11180
11295
|
'data-id': session.id,
|
|
11181
11296
|
name: SessionDelete,
|
|
11182
11297
|
onClick: HandleClickDelete,
|
|
11183
11298
|
tabIndex: 0,
|
|
11184
11299
|
title: deleteChatSession$1(),
|
|
11185
11300
|
type: Button$1
|
|
11186
|
-
},
|
|
11301
|
+
}, {
|
|
11302
|
+
childCount: 0,
|
|
11303
|
+
className: 'MaskIcon MaskIconTrash',
|
|
11304
|
+
type: Div
|
|
11305
|
+
}];
|
|
11187
11306
|
};
|
|
11188
11307
|
|
|
11189
11308
|
const getChatListDom = (sessions, selectedSessionId, chatListScrollTop = 0) => {
|
|
@@ -11811,9 +11930,20 @@ const renderEventListeners = () => {
|
|
|
11811
11930
|
name: HandleMessagesContextMenu,
|
|
11812
11931
|
params: ['handleMessagesContextMenu'],
|
|
11813
11932
|
preventDefault: true
|
|
11933
|
+
}, {
|
|
11934
|
+
name: HandleChatWelcomeContextMenu,
|
|
11935
|
+
params: ['handleChatWelcomeContextMenu']
|
|
11936
|
+
}, {
|
|
11937
|
+
name: HandleChatHeaderContextMenu,
|
|
11938
|
+
params: ['handleChatHeaderContextMenu'],
|
|
11939
|
+
preventDefault: true
|
|
11814
11940
|
}, {
|
|
11815
11941
|
name: HandleFocus,
|
|
11816
11942
|
params: ['handleInputFocus', TargetName]
|
|
11943
|
+
}, {
|
|
11944
|
+
name: HandleChatInputContextMenu,
|
|
11945
|
+
params: ['handleChatInputContextMenu'],
|
|
11946
|
+
preventDefault: true
|
|
11817
11947
|
}, {
|
|
11818
11948
|
name: HandleKeyDown,
|
|
11819
11949
|
params: ['handleKeyDown', Key, ShiftKey]
|
|
@@ -12072,8 +12202,11 @@ const commandMap = {
|
|
|
12072
12202
|
'Chat.getMenuEntryIds': getMenuEntryIds,
|
|
12073
12203
|
'Chat.getQuickPickMenuEntries': getQuickPickMenuEntries,
|
|
12074
12204
|
'Chat.getSelectedSessionId': wrapGetter(getSelectedSessionId),
|
|
12205
|
+
'Chat.handleChatHeaderContextMenu': wrapCommand(handleChatHeaderContextMenu),
|
|
12206
|
+
'Chat.handleChatInputContextMenu': wrapCommand(handleChatInputContextMenu),
|
|
12075
12207
|
'Chat.handleChatListContextMenu': handleChatListContextMenu,
|
|
12076
12208
|
'Chat.handleChatListScroll': wrapCommand(handleChatListScroll),
|
|
12209
|
+
'Chat.handleChatWelcomeContextMenu': wrapCommand(handleChatWelcomeContextMenu),
|
|
12077
12210
|
'Chat.handleClick': wrapCommand(handleClick),
|
|
12078
12211
|
'Chat.handleClickBack': wrapCommand(handleClickBack),
|
|
12079
12212
|
'Chat.handleClickClose': handleClickClose,
|