@lvce-editor/chat-view 6.68.0 → 6.69.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.
@@ -1214,6 +1214,7 @@ const Home = 12;
1214
1214
  const UpArrow = 14;
1215
1215
  const DownArrow = 16;
1216
1216
  const KeyN = 42;
1217
+ const KeyV = 50;
1217
1218
 
1218
1219
  const CtrlCmd = 1 << 11 >>> 0;
1219
1220
  const Shift = 1 << 10 >>> 0;
@@ -2876,10 +2877,7 @@ const RenderIncremental = 11;
2876
2877
  const RenderScrollTop = 12;
2877
2878
 
2878
2879
  const diffValue = (oldState, newState) => {
2879
- if (oldState.composerValue === newState.composerValue) {
2880
- return true;
2881
- }
2882
- return newState.inputSource !== 'script';
2880
+ return oldState.composerValue === newState.composerValue || newState.inputSource !== 'script';
2883
2881
  };
2884
2882
 
2885
2883
  const modules = [isEqual, diffValue, diffSelection, diffFocus, isEqual$1, diffFocus, diffScrollTop];
@@ -2901,8 +2899,7 @@ const diff2 = uid => {
2901
2899
  newState,
2902
2900
  oldState
2903
2901
  } = get$1(uid);
2904
- const result = diff(oldState, newState);
2905
- return result;
2902
+ return diff(oldState, newState);
2906
2903
  };
2907
2904
 
2908
2905
  const getAuthState = state => {
@@ -3260,6 +3257,10 @@ const getKeyBindings = () => {
3260
3257
  command: 'Chat.chatInputHistoryDown',
3261
3258
  key: DownArrow,
3262
3259
  when: FocusChatInput
3260
+ }, {
3261
+ command: 'Chat.pasteInput',
3262
+ key: CtrlCmd | KeyV,
3263
+ when: FocusChatInput
3263
3264
  }, {
3264
3265
  command: 'Chat.chatInputHistoryUp',
3265
3266
  key: UpArrow,
@@ -3934,8 +3935,7 @@ const executeProvider = async ({
3934
3935
  }) => {
3935
3936
  await activateByEvent(event, assetDir, platform);
3936
3937
  // @ts-ignore
3937
- const result = invoke$2(method, ...params);
3938
- return result;
3938
+ return invoke$2(method, ...params);
3939
3939
  };
3940
3940
 
3941
3941
  const CommandExecute = 'ExtensionHostCommand.executeCommand';
@@ -9975,15 +9975,6 @@ const handleSearchValueChange = (state, newValue) => {
9975
9975
  };
9976
9976
 
9977
9977
  const handleInput = async (state, name, value, inputSource = 'user') => {
9978
- const {
9979
- chatInputHistoryDraft,
9980
- chatInputHistoryIndex,
9981
- composerAttachments,
9982
- modelPickerHeaderHeight,
9983
- models,
9984
- selectedSessionId,
9985
- width
9986
- } = state;
9987
9978
  if (name === OpenApiApiKeyInput) {
9988
9979
  return {
9989
9980
  ...state,
@@ -10000,10 +9991,10 @@ const handleInput = async (state, name, value, inputSource = 'user') => {
10000
9991
  return handleSearchValueChange(state, value);
10001
9992
  }
10002
9993
  if (name === ModelPickerSearch) {
10003
- const visibleModels = getVisibleModels(models, value);
9994
+ const visibleModels = getVisibleModels(state.models, value);
10004
9995
  return {
10005
9996
  ...state,
10006
- modelPickerHeight: getModelPickerHeight(modelPickerHeaderHeight, visibleModels.length),
9997
+ modelPickerHeight: getModelPickerHeight(state.modelPickerHeaderHeight, visibleModels.length),
10007
9998
  modelPickerListScrollTop: 0,
10008
9999
  modelPickerSearchValue: value,
10009
10000
  visibleModels
@@ -10012,19 +10003,20 @@ const handleInput = async (state, name, value, inputSource = 'user') => {
10012
10003
  if (name !== Composer) {
10013
10004
  return state;
10014
10005
  }
10015
- if (selectedSessionId) {
10006
+ if (state.selectedSessionId) {
10016
10007
  await appendChatViewEvent({
10017
- sessionId: selectedSessionId,
10008
+ sessionId: state.selectedSessionId,
10018
10009
  timestamp: new Date().toISOString(),
10019
10010
  type: 'handle-input',
10020
10011
  value
10021
10012
  });
10022
10013
  }
10023
10014
  const composerHeight = await getComposerHeight(state, value);
10024
- const composerAttachmentsHeight = getComposerAttachmentsHeight(composerAttachments, width);
10015
+ const composerAttachmentsHeight = getComposerAttachmentsHeight(state.composerAttachments, state.width);
10016
+ const chatInputHistoryDraft = state.chatInputHistoryIndex === -1 ? value : state.chatInputHistoryDraft;
10025
10017
  return {
10026
10018
  ...state,
10027
- chatInputHistoryDraft: chatInputHistoryIndex === -1 ? value : chatInputHistoryDraft,
10019
+ chatInputHistoryDraft,
10028
10020
  composerAttachmentsHeight,
10029
10021
  composerHeight,
10030
10022
  composerSelectionEnd: value.length,
@@ -10081,6 +10073,18 @@ const handleInputFocus = async (state, name) => {
10081
10073
  };
10082
10074
  };
10083
10075
 
10076
+ const getSubmittedRenameState = (state, sessions) => {
10077
+ return {
10078
+ ...state,
10079
+ composerHeight: getMinComposerHeightForState(state),
10080
+ composerSelectionEnd: 0,
10081
+ composerSelectionStart: 0,
10082
+ composerValue: '',
10083
+ inputSource: 'script',
10084
+ renamingSessionId: '',
10085
+ sessions
10086
+ };
10087
+ };
10084
10088
  const submitRename = async state => {
10085
10089
  const {
10086
10090
  composerValue,
@@ -10094,29 +10098,24 @@ const submitRename = async state => {
10094
10098
  renamingSessionId: ''
10095
10099
  };
10096
10100
  }
10101
+ const promptedTitle = sanitizeGeneratedTitle(await invoke('Main.prompt', title));
10102
+ if (!promptedTitle) {
10103
+ return getSubmittedRenameState(state, sessions);
10104
+ }
10097
10105
  const updatedSessions = sessions.map(session => {
10098
10106
  if (session.id !== renamingSessionId) {
10099
10107
  return session;
10100
10108
  }
10101
10109
  return {
10102
10110
  ...session,
10103
- title
10111
+ title: promptedTitle
10104
10112
  };
10105
10113
  });
10106
10114
  const renamedSession = updatedSessions.find(session => session.id === renamingSessionId);
10107
10115
  if (renamedSession) {
10108
10116
  await saveChatSession(renamedSession);
10109
10117
  }
10110
- return {
10111
- ...state,
10112
- composerHeight: getMinComposerHeightForState(state),
10113
- composerSelectionEnd: 0,
10114
- composerSelectionStart: 0,
10115
- composerValue: '',
10116
- inputSource: 'script',
10117
- renamingSessionId: '',
10118
- sessions: updatedSessions
10119
- };
10118
+ return getSubmittedRenameState(state, updatedSessions);
10120
10119
  };
10121
10120
 
10122
10121
  const handleKeyDown = async (state, key, shiftKey) => {
@@ -12888,11 +12887,22 @@ const getReadFileTarget = rawArguments => {
12888
12887
  };
12889
12888
  };
12890
12889
 
12891
- const getToolCallFileNameDom = (fileName, fileNameClickableProps = {}) => {
12890
+ const getToolCallFileNameDom = (fileName, {
12891
+ clickableProps = {},
12892
+ title
12893
+ } = {}) => {
12892
12894
  return [{
12895
+ childCount: 1,
12896
+ className: ChatToolCallReadFileLink,
12897
+ ...(title === undefined ? {} : {
12898
+ title
12899
+ }),
12900
+ ...clickableProps,
12901
+ type: Span
12902
+ }, {
12893
12903
  childCount: 1,
12894
12904
  className: ChatToolCallFileName,
12895
- ...fileNameClickableProps,
12905
+ ...clickableProps,
12896
12906
  type: Span
12897
12907
  }, text(fileName)];
12898
12908
  };
@@ -12921,12 +12931,9 @@ const getToolCallCreateDirectoryVirtualDom = toolCall => {
12921
12931
  childCount: 1,
12922
12932
  className: ToolCallName,
12923
12933
  type: Span
12924
- }, text('create_directory '), {
12925
- childCount: 1,
12926
- className: ChatToolCallReadFileLink,
12927
- ...fileNameClickableProps,
12928
- type: Span
12929
- }, ...getToolCallFileNameDom(directoryName, fileNameClickableProps), ...(statusLabel ? [text(statusLabel)] : [])];
12934
+ }, text('create_directory '), ...getToolCallFileNameDom(directoryName, {
12935
+ clickableProps: fileNameClickableProps
12936
+ }), ...(statusLabel ? [text(statusLabel)] : [])];
12930
12937
  };
12931
12938
 
12932
12939
  const getToolCallArgumentPreview = rawArguments => {
@@ -13048,13 +13055,10 @@ const getToolCallEditFileVirtualDom = toolCall => {
13048
13055
  childCount: 1,
13049
13056
  className: ToolCallName,
13050
13057
  type: Span
13051
- }, text('edit_file '), {
13052
- childCount: 1,
13053
- className: ChatToolCallReadFileLink,
13054
- title: target.clickableUri,
13055
- ...fileNameClickableProps,
13056
- type: Span
13057
- }, ...getToolCallFileNameDom(fileName, fileNameClickableProps)];
13058
+ }, text('edit_file '), ...getToolCallFileNameDom(fileName, {
13059
+ clickableProps: fileNameClickableProps,
13060
+ title: target.clickableUri
13061
+ })];
13058
13062
  };
13059
13063
 
13060
13064
  const getToolCallGetWorkspaceUriVirtualDom = toolCall => {
@@ -13080,12 +13084,9 @@ const getToolCallGetWorkspaceUriVirtualDom = toolCall => {
13080
13084
  childCount: 1,
13081
13085
  className: ToolCallName,
13082
13086
  type: Span
13083
- }, text('get_workspace_uri '), {
13084
- childCount: 1,
13085
- className: ChatToolCallReadFileLink,
13086
- ...fileNameClickableProps,
13087
- type: Span
13088
- }, ...getToolCallFileNameDom(fileName, fileNameClickableProps), ...(statusLabel ? [text(statusLabel)] : [])];
13087
+ }, text('get_workspace_uri '), ...getToolCallFileNameDom(fileName, {
13088
+ clickableProps: fileNameClickableProps
13089
+ }), ...(statusLabel ? [text(statusLabel)] : [])];
13089
13090
  };
13090
13091
 
13091
13092
  const getToolCallReadFileVirtualDom = toolCall => {
@@ -13113,12 +13114,9 @@ const getToolCallReadFileVirtualDom = toolCall => {
13113
13114
  childCount: 1,
13114
13115
  className: ToolCallName,
13115
13116
  type: Span
13116
- }, text(toolNameLabel), {
13117
- childCount: 1,
13118
- className: ChatToolCallReadFileLink,
13119
- ...fileNameClickableProps,
13120
- type: Span
13121
- }, ...getToolCallFileNameDom(fileName, fileNameClickableProps), ...(statusLabel ? [text(statusLabel)] : [])];
13117
+ }, text(toolNameLabel), ...getToolCallFileNameDom(fileName, {
13118
+ clickableProps: fileNameClickableProps
13119
+ }), ...(statusLabel ? [text(statusLabel)] : [])];
13122
13120
  };
13123
13121
 
13124
13122
  const maxHtmlLength = 40_000;
@@ -13495,12 +13493,9 @@ const getToolCallWriteFileVirtualDom = toolCall => {
13495
13493
  childCount: 1,
13496
13494
  className: ToolCallName,
13497
13495
  type: Span
13498
- }, text('write_file '), {
13499
- childCount: 1,
13500
- className: ChatToolCallReadFileLink,
13501
- ...fileNameClickableProps,
13502
- type: Span
13503
- }, ...getToolCallFileNameDom(fileName, fileNameClickableProps), ...(showDiffStats ? [{
13496
+ }, text('write_file '), ...getToolCallFileNameDom(fileName, {
13497
+ clickableProps: fileNameClickableProps
13498
+ }), ...(showDiffStats ? [{
13504
13499
  childCount: 1,
13505
13500
  className: Insertion,
13506
13501
  type: Span
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/chat-view",
3
- "version": "6.68.0",
3
+ "version": "6.69.0",
4
4
  "description": "Chat View Worker",
5
5
  "repository": {
6
6
  "type": "git",