@lvce-editor/chat-view 6.23.0 → 6.24.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.
@@ -8486,11 +8486,11 @@ const handleMessagesContextMenu = async (state, button, x, y) => {
8486
8486
  return state;
8487
8487
  };
8488
8488
 
8489
- const handleMissingApiKeySubmit = async (state, submitterName = '') => {
8490
- if (!submitterName) {
8491
- return state;
8492
- }
8493
- return handleClick(state, submitterName);
8489
+ const handleMissingOpenAiApiKeyFormSubmit = async state => {
8490
+ return handleClickSaveOpenApiApiKey(state);
8491
+ };
8492
+ const handleMissingOpenRouterApiKeyFormSubmit = async state => {
8493
+ return handleClickSaveOpenRouterApiKey(state);
8494
8494
  };
8495
8495
 
8496
8496
  const handleModelChange = async (state, value) => {
@@ -9312,6 +9312,12 @@ const getCss = (composerHeight, listItemHeight, chatMessageFontSize, chatMessage
9312
9312
  border-color: darkcyan;
9313
9313
  }
9314
9314
 
9315
+ .SendButtonDisabled{
9316
+ background: var(--vscode-button-secondaryBackground);
9317
+ color: var(--vscode-disabledForeground);
9318
+ cursor: default;
9319
+ }
9320
+
9315
9321
  .ChatModelPicker{
9316
9322
  border: 1px solid white;
9317
9323
  }
@@ -9384,6 +9390,46 @@ a.Button{
9384
9390
  text-overflow: ellipsis;
9385
9391
  }
9386
9392
 
9393
+ .ChatModelPickerList{
9394
+ scrollbar-width: thin;
9395
+ scrollbar-color: var(--vscode-scrollbarSlider-background) transparent;
9396
+ }
9397
+
9398
+ .ChatModelPickerList::-webkit-scrollbar{
9399
+ width: 10px;
9400
+ }
9401
+
9402
+ .ChatModelPickerList::-webkit-scrollbar-track{
9403
+ background: transparent;
9404
+ }
9405
+
9406
+ .ChatModelPickerList::-webkit-scrollbar-thumb{
9407
+ background: var(--vscode-scrollbarSlider-background);
9408
+ border: 2px solid transparent;
9409
+ border-radius: 999px;
9410
+ background-clip: content-box;
9411
+ }
9412
+
9413
+ .ChatModelPickerList::-webkit-scrollbar-thumb:hover{
9414
+ background: var(--vscode-scrollbarSlider-hoverBackground);
9415
+ border: 2px solid transparent;
9416
+ background-clip: content-box;
9417
+ }
9418
+
9419
+ .ChatModelPickerList::-webkit-scrollbar-thumb:active{
9420
+ background: var(--vscode-scrollbarSlider-activeBackground);
9421
+ border: 2px solid transparent;
9422
+ background-clip: content-box;
9423
+ }
9424
+
9425
+ .ChatModelPickerItem{
9426
+ display: block;
9427
+ width: 100%;
9428
+ white-space: nowrap;
9429
+ overflow: hidden;
9430
+ text-overflow: ellipsis;
9431
+ }
9432
+
9387
9433
  `;
9388
9434
  return `${baseCss}
9389
9435
 
@@ -9599,7 +9645,7 @@ const HandleDragEnterChatView = 30;
9599
9645
  const HandleDragOverChatView = 31;
9600
9646
  const HandleProjectListScroll = 32;
9601
9647
  const HandleClickDictationButton = 34;
9602
- const HandleMissingApiKeySubmit = 35;
9648
+ const HandleMissingOpenAiApiKeyFormSubmit = 35;
9603
9649
  const HandleRunModeChange = 36;
9604
9650
  const HandleSearchInput = 37;
9605
9651
  const HandleChatWelcomeContextMenu = 39;
@@ -9608,6 +9654,7 @@ const HandleChatInputContextMenu = 41;
9608
9654
  const HandleContextMenuChatSendAreaBottom = 42;
9609
9655
  const HandleProjectAddButtonContextMenu = 43;
9610
9656
  const HandleProjectListContextMenu = 44;
9657
+ const HandleMissingOpenRouterApiKeyFormSubmit = 45;
9611
9658
 
9612
9659
  const getModelLabel = model => {
9613
9660
  if (model.provider === 'openRouter') {
@@ -9619,13 +9666,11 @@ const getModelLabel = model => {
9619
9666
  return model.name;
9620
9667
  };
9621
9668
 
9622
- const getChatModelPickerVirtualDom = (models, selectedModelId, modelPickerOpen, modelPickerSearchValue) => {
9669
+ const getChatModelPickerToggleVirtualDom = (models, selectedModelId, modelPickerOpen) => {
9623
9670
  const selectedModel = models.find(model => model.id === selectedModelId);
9624
9671
  const selectedModelLabel = selectedModel ? selectedModel.name : selectedModelId;
9625
- const normalizedSearch = modelPickerSearchValue.trim().toLowerCase();
9626
- const visibleModels = normalizedSearch ? models.filter(model => getModelLabel(model).toLowerCase().includes(normalizedSearch)) : models;
9627
9672
  return [{
9628
- childCount: modelPickerOpen ? 2 : 1,
9673
+ childCount: 1,
9629
9674
  className: ChatModelPickerContainer,
9630
9675
  type: Div
9631
9676
  }, {
@@ -9634,12 +9679,26 @@ const getChatModelPickerVirtualDom = (models, selectedModelId, modelPickerOpen,
9634
9679
  name: ModelPickerToggle,
9635
9680
  onClick: HandleClick,
9636
9681
  title: selectedModelLabel,
9637
- type: Button$1
9682
+ type: Div
9638
9683
  }, {
9684
+ childCount: 1,
9685
+ type: Span
9686
+ }, text(selectedModelLabel), {
9639
9687
  childCount: 0,
9640
- className: 'MaskIcon MaskIconChevronUp',
9688
+ className: modelPickerOpen ? 'MaskIcon MaskIconChevronUp' : 'MaskIcon MaskIconChevronDown',
9689
+ role: 'none',
9641
9690
  type: Div
9642
- }, text(selectedModelLabel), ...(modelPickerOpen ? [{
9691
+ }];
9692
+ };
9693
+ const getChatModelPickerPopOverVirtualDom = (models, selectedModelId, modelPickerSearchValue) => {
9694
+ const normalizedSearch = modelPickerSearchValue.trim().toLowerCase();
9695
+ const visibleModels = normalizedSearch ? models.filter(model => getModelLabel(model).toLowerCase().includes(normalizedSearch)) : models;
9696
+ return [{
9697
+ childCount: 2,
9698
+ className: ChatModelPickerContainer,
9699
+ style: 'position:absolute;',
9700
+ type: Div
9701
+ }, {
9643
9702
  childCount: 3 + visibleModels.length,
9644
9703
  className: ChatModelPicker,
9645
9704
  type: Div
@@ -9677,7 +9736,7 @@ const getChatModelPickerVirtualDom = (models, selectedModelId, modelPickerOpen,
9677
9736
  name: getModelPickerItemInputName(model.id),
9678
9737
  onClick: HandleClick,
9679
9738
  type: Li
9680
- }, text(getModelLabel(model))])] : [])];
9739
+ }, text(getModelLabel(model))])];
9681
9740
  };
9682
9741
 
9683
9742
  const getModelOptionDOm = (model, selectedModelId) => {
@@ -9874,7 +9933,7 @@ const getChatSendAreaDom = (composerValue, modelPickerOpen, modelPickerSearchVal
9874
9933
  className: ChatSendAreaBottom,
9875
9934
  onContextMenu: HandleContextMenuChatSendAreaBottom,
9876
9935
  type: Div
9877
- }, ...(newChatModelPickerEnabled ? getChatModelPickerVirtualDom(models, selectedModelId, modelPickerOpen, modelPickerSearchValue) : getChatSelectVirtualDom(models, selectedModelId)), ...(showRunMode ? getRunModeSelectVirtualDom(runMode) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
9936
+ }, ...(newChatModelPickerEnabled ? getChatModelPickerToggleVirtualDom(models, selectedModelId, modelPickerOpen) : getChatSelectVirtualDom(models, selectedModelId)), ...(showRunMode ? getRunModeSelectVirtualDom(runMode) : []), ...(usageOverviewEnabled ? getUsageOverviewDom(tokensUsed, tokensMax) : []), ...(addContextButtonEnabled ? getAddContextButtonDom() : []), ...getSendButtonDom(isSendDisabled, voiceDictationEnabled)];
9878
9937
  };
9879
9938
 
9880
9939
  const getBoldInlineNodeDom = (inlineNode, useChatMathWorker, renderInlineNodeDom) => {
@@ -10345,6 +10404,7 @@ const getMissingApiKeyDom = ({
10345
10404
  inputName,
10346
10405
  inputPattern,
10347
10406
  inputRequired = false,
10407
+ onSubmit,
10348
10408
  openSettingsButtonName,
10349
10409
  openSettingsUrl,
10350
10410
  placeholder,
@@ -10356,7 +10416,7 @@ const getMissingApiKeyDom = ({
10356
10416
  childCount: 2,
10357
10417
  className: MissingApiKeyForm,
10358
10418
  method: 'GET',
10359
- onSubmit: HandleMissingApiKeySubmit,
10419
+ onSubmit,
10360
10420
  type: Form
10361
10421
  }, {
10362
10422
  autocapitalize: 'off',
@@ -10389,6 +10449,7 @@ const getMissingOpenApiApiKeyDom = () => {
10389
10449
  inputName: OpenApiApiKeyInput,
10390
10450
  inputPattern: '^sk-.+',
10391
10451
  inputRequired: true,
10452
+ onSubmit: HandleMissingOpenAiApiKeyFormSubmit,
10392
10453
  openSettingsButtonName: OpenOpenApiApiKeyWebsite,
10393
10454
  openSettingsUrl: 'https://platform.openai.com/api-keys',
10394
10455
  placeholder: openApiApiKeyPlaceholder(),
@@ -10401,6 +10462,7 @@ const getMissingOpenRouterApiKeyDom = (openRouterApiKeyState = 'idle') => {
10401
10462
  return getMissingApiKeyDom({
10402
10463
  getApiKeyText: getOpenRouterApiKey(),
10403
10464
  inputName: OpenRouterApiKeyInput,
10465
+ onSubmit: HandleMissingOpenRouterApiKeyFormSubmit,
10404
10466
  openSettingsButtonName: OpenOpenRouterApiKeySettings,
10405
10467
  openSettingsUrl: 'https://openrouter.ai/settings/keys',
10406
10468
  placeholder: openRouterApiKeyPlaceholder(),
@@ -11404,8 +11466,10 @@ const getChatModeChatFocusVirtualDom = ({
11404
11466
  const selectedSession = sessions.find(session => session.id === selectedSessionId);
11405
11467
  const messages = selectedSession ? selectedSession.messages : [];
11406
11468
  const isDropOverlayVisible = composerDropEnabled && composerDropActive;
11469
+ const isNewModelPickerVisible = newChatModelPickerEnabled && modelPickerOpen;
11470
+ const chatRootChildCount = 3 + (isDropOverlayVisible ? 1 : 0) + (isNewModelPickerVisible ? 1 : 0);
11407
11471
  return [{
11408
- childCount: isDropOverlayVisible ? 4 : 3,
11472
+ childCount: chatRootChildCount,
11409
11473
  className: mergeClassNames(Viewlet, Chat, 'ChatFocus'),
11410
11474
  onDragEnter: HandleDragEnterChatView,
11411
11475
  onDragOver: HandleDragOverChatView,
@@ -11421,7 +11485,7 @@ const getChatModeChatFocusVirtualDom = ({
11421
11485
  }, {
11422
11486
  text: attachImageAsContext(),
11423
11487
  type: Text
11424
- }] : [])];
11488
+ }] : []), ...(isNewModelPickerVisible ? getChatModelPickerPopOverVirtualDom(models, selectedModelId, modelPickerSearchValue) : [])];
11425
11489
  };
11426
11490
 
11427
11491
  const getBackButtonVirtualDom = () => {
@@ -11571,8 +11635,10 @@ const getChatModeDetailVirtualDom = ({
11571
11635
  const selectedSessionTitle = selectedSession?.title || chatTitle();
11572
11636
  const messages = selectedSession ? selectedSession.messages : [];
11573
11637
  const isDropOverlayVisible = composerDropEnabled && composerDropActive;
11638
+ const isNewModelPickerVisible = newChatModelPickerEnabled && modelPickerOpen;
11639
+ const chatRootChildCount = 3 + (isDropOverlayVisible ? 1 : 0) + (isNewModelPickerVisible ? 1 : 0);
11574
11640
  return [{
11575
- childCount: isDropOverlayVisible ? 4 : 3,
11641
+ childCount: chatRootChildCount,
11576
11642
  className: mergeClassNames(Viewlet, Chat),
11577
11643
  onDragEnter: HandleDragEnterChatView,
11578
11644
  onDragOver: HandleDragOverChatView,
@@ -11588,7 +11654,7 @@ const getChatModeDetailVirtualDom = ({
11588
11654
  }, {
11589
11655
  text: attachImageAsContext(),
11590
11656
  type: Text
11591
- }] : [])];
11657
+ }] : []), ...(isNewModelPickerVisible ? getChatModelPickerPopOverVirtualDom(models, selectedModelId, modelPickerSearchValue) : [])];
11592
11658
  };
11593
11659
 
11594
11660
  const getChatHeaderListModeDom = (authEnabled = false, authStatus = 'signed-out', authErrorMessage = '', searchEnabled = false, searchFieldVisible = false, searchValue = '') => {
@@ -11742,10 +11808,12 @@ const getChatModeListVirtualDom = ({
11742
11808
  voiceDictationEnabled = false
11743
11809
  }) => {
11744
11810
  const isDropOverlayVisible = composerDropEnabled && composerDropActive;
11811
+ const isNewModelPickerVisible = newChatModelPickerEnabled && modelPickerOpen;
11812
+ const chatRootChildCount = 3 + (isDropOverlayVisible ? 1 : 0) + (isNewModelPickerVisible ? 1 : 0);
11745
11813
  const searchValueTrimmed = searchValue.trim().toLowerCase();
11746
11814
  const visibleSessions = searchEnabled && searchValueTrimmed ? sessions.filter(session => session.title.toLowerCase().includes(searchValueTrimmed)) : sessions;
11747
11815
  return [{
11748
- childCount: isDropOverlayVisible ? 4 : 3,
11816
+ childCount: chatRootChildCount,
11749
11817
  className: mergeClassNames(Viewlet, Chat),
11750
11818
  onDragEnter: HandleDragEnterChatView,
11751
11819
  onDragOver: HandleDragOverChatView,
@@ -11761,7 +11829,7 @@ const getChatModeListVirtualDom = ({
11761
11829
  }, {
11762
11830
  text: attachImageAsContext(),
11763
11831
  type: Text
11764
- }] : [])];
11832
+ }] : []), ...(isNewModelPickerVisible ? getChatModelPickerPopOverVirtualDom(models, selectedModelId, modelPickerSearchValue) : [])];
11765
11833
  };
11766
11834
 
11767
11835
  const getChatModeUnsupportedVirtualDom = () => {
@@ -12355,8 +12423,12 @@ const renderEventListeners = () => {
12355
12423
  params: ['handleSubmit'],
12356
12424
  preventDefault: true
12357
12425
  }, {
12358
- name: HandleMissingApiKeySubmit,
12359
- params: ['handleMissingApiKeySubmit', 'event.submitter?.name || ""'],
12426
+ name: HandleMissingOpenAiApiKeyFormSubmit,
12427
+ params: ['handleMissingOpenAiApiKeyFormSubmit'],
12428
+ preventDefault: true
12429
+ }, {
12430
+ name: HandleMissingOpenRouterApiKeyFormSubmit,
12431
+ params: ['handleMissingOpenRouterApiKeyFormSubmit'],
12360
12432
  preventDefault: true
12361
12433
  }];
12362
12434
  };
@@ -12644,7 +12716,8 @@ const commandMap = {
12644
12716
  'Chat.handleKeyDown': wrapCommand(handleKeyDown),
12645
12717
  'Chat.handleMessagesContextMenu': wrapCommand(handleMessagesContextMenu),
12646
12718
  'Chat.handleMessagesScroll': wrapCommand(handleMessagesScroll),
12647
- 'Chat.handleMissingApiKeySubmit': wrapCommand(handleMissingApiKeySubmit),
12719
+ 'Chat.handleMissingOpenAiApiKeyFormSubmit': wrapCommand(handleMissingOpenAiApiKeyFormSubmit),
12720
+ 'Chat.handleMissingOpenRouterApiKeyFormSubmit': wrapCommand(handleMissingOpenRouterApiKeyFormSubmit),
12648
12721
  'Chat.handleModelChange': wrapCommand(handleModelChange),
12649
12722
  'Chat.handleProjectAddButtonContextMenu': wrapCommand(handleProjectAddButtonContextMenu),
12650
12723
  'Chat.handleProjectListContextMenu': wrapCommand(handleProjectListContextMenu),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/chat-view",
3
- "version": "6.23.0",
3
+ "version": "6.24.0",
4
4
  "description": "Chat View Worker",
5
5
  "repository": {
6
6
  "type": "git",