dsh-side-chat-plus 0.3.4 → 0.4.0-alpha.1

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/lib/client.js CHANGED
@@ -20,14 +20,14 @@ window.__ModuleLoader__.load({
20
20
  document.head.appendChild(tag);
21
21
  }
22
22
  var AttachmentRail_module_css_default = {
23
- "item": "J5tleW_item",
23
+ "root": "J5tleW_root",
24
24
  "remove": "J5tleW_remove",
25
- "arrow": "J5tleW_arrow",
26
- "arrowLeft": "J5tleW_arrowLeft",
27
25
  "arrowRight": "J5tleW_arrowRight",
28
- "root": "J5tleW_root",
26
+ "arrow": "J5tleW_arrow",
27
+ "item": "J5tleW_item",
29
28
  "rail": "J5tleW_rail",
30
- "thumbnail": "J5tleW_thumbnail"
29
+ "thumbnail": "J5tleW_thumbnail",
30
+ "arrowLeft": "J5tleW_arrowLeft"
31
31
  };
32
32
  //#endregion
33
33
  //#region src/client/attachments/AttachmentRail.tsx
@@ -174,10 +174,10 @@ window.__ModuleLoader__.load({
174
174
  }
175
175
  var DropOverlay_module_css_default = {
176
176
  "wrap": "_9H6qrq_wrap",
177
- "illustration": "_9H6qrq_illustration",
177
+ "mask": "_9H6qrq_mask",
178
178
  "desc": "_9H6qrq_desc",
179
- "title": "_9H6qrq_title",
180
- "mask": "_9H6qrq_mask"
179
+ "illustration": "_9H6qrq_illustration",
180
+ "title": "_9H6qrq_title"
181
181
  };
182
182
  //#endregion
183
183
  //#region src/client/attachments/DropOverlay.tsx
@@ -320,10 +320,10 @@ window.__ModuleLoader__.load({
320
320
  document.head.appendChild(tag);
321
321
  }
322
322
  var ImageLightbox_module_css_default = {
323
- "close": "_5IyjUq_close",
324
- "backdrop": "_5IyjUq_backdrop",
323
+ "image": "_5IyjUq_image",
325
324
  "mask": "_5IyjUq_mask",
326
- "image": "_5IyjUq_image"
325
+ "backdrop": "_5IyjUq_backdrop",
326
+ "close": "_5IyjUq_close"
327
327
  };
328
328
  //#endregion
329
329
  //#region src/client/attachments/ImageLightbox.tsx
@@ -388,9 +388,9 @@ window.__ModuleLoader__.load({
388
388
  document.head.appendChild(tag);
389
389
  }
390
390
  var MessageImage_module_css_default = {
391
- "error": "_1H6WSq_error",
392
- "gallery": "_1H6WSq_gallery",
393
391
  "frame": "_1H6WSq_frame",
392
+ "gallery": "_1H6WSq_gallery",
393
+ "error": "_1H6WSq_error",
394
394
  "loading": "_1H6WSq_loading"
395
395
  };
396
396
  //#endregion
@@ -595,6 +595,7 @@ window.__ModuleLoader__.load({
595
595
  "image.unsupported": "不支持的图片格式",
596
596
  "image.tooMany": "图片数量超出限制",
597
597
  "image.fileTooLarge": "图片过大",
598
+ "image.dimensionTooLarge": "图片尺寸超出限制",
598
599
  "settingsNav": "侧边聊天",
599
600
  "settings.lookupTitle": "默认勾选「需要时从工作区 / 主会话查信息」",
600
601
  "settings.lookupDesc": "新会话的侧边聊天默认打开此开关;可在每次聊天中临时更改",
@@ -690,6 +691,7 @@ window.__ModuleLoader__.load({
690
691
  "image.unsupported": "Unsupported image type",
691
692
  "image.tooMany": "Too many images",
692
693
  "image.fileTooLarge": "Image too large",
694
+ "image.dimensionTooLarge": "Image dimensions exceed the limit",
693
695
  "settingsNav": "Side chat",
694
696
  "settings.lookupTitle": "Default on: \"look up workspace / parent when needed\"",
695
697
  "settings.lookupDesc": "New conversations start with this switch on; you can still change it per chat",
@@ -758,101 +760,101 @@ window.__ModuleLoader__.load({
758
760
  document.head.appendChild(tag);
759
761
  }
760
762
  var client_module_css_default = {
761
- "questionHeader": "yw4T5a_questionHeader",
762
- "panelLookup": "yw4T5a_panelLookup",
763
- "modelCellValue": "yw4T5a_modelCellValue",
764
- "panelEmbedded": "yw4T5a_panelEmbedded",
765
- "panelConflictHidden": "yw4T5a_panelConflictHidden",
766
- "panelRunningClock": "yw4T5a_panelRunningClock",
767
- "panelAttachmentText": "yw4T5a_panelAttachmentText",
768
- "panelRunningDot": "yw4T5a_panelRunningDot",
769
- "panelResize": "yw4T5a_panelResize",
770
- "panelListItemActive": "yw4T5a_panelListItemActive",
771
- "reasoningSummary": "yw4T5a_reasoningSummary",
772
- "questionItem": "yw4T5a_questionItem",
763
+ "modelCheck": "yw4T5a_modelCheck",
764
+ "questionBody": "yw4T5a_questionBody",
773
765
  "panelListItemLabel": "yw4T5a_panelListItemLabel",
774
- "panelAttachmentRemove": "yw4T5a_panelAttachmentRemove",
775
- "chevronOpen": "yw4T5a_chevronOpen",
776
- "panelIconButton": "yw4T5a_panelIconButton",
777
- "modelEmpty": "yw4T5a_modelEmpty",
778
- "settingsRowText": "yw4T5a_settingsRowText",
779
- "questionOption": "yw4T5a_questionOption",
780
- "panelTextarea": "yw4T5a_panelTextarea",
781
- "modelOption": "yw4T5a_modelOption",
782
- "settingsRowTitle": "yw4T5a_settingsRowTitle",
766
+ "selectionMenu": "yw4T5a_selectionMenu",
767
+ "messageAssistant": "yw4T5a_messageAssistant",
783
768
  "settingsRowDesc": "yw4T5a_settingsRowDesc",
784
- "modelSelectTrigger": "yw4T5a_modelSelectTrigger",
785
- "panelTitle": "yw4T5a_panelTitle",
786
- "panel": "yw4T5a_panel",
787
- "settingsBringOption": "yw4T5a_settingsBringOption",
788
- "panelListItemRemove": "yw4T5a_panelListItemRemove",
789
- "messageUserText": "yw4T5a_messageUserText",
790
- "settingsPromptInput": "yw4T5a_settingsPromptInput",
791
- "questionFab": "yw4T5a_questionFab",
769
+ "modelGroupTitle": "yw4T5a_modelGroupTitle",
770
+ "panelIconButton": "yw4T5a_panelIconButton",
771
+ "panelTranscript": "yw4T5a_panelTranscript",
792
772
  "collapsedHandle": "yw4T5a_collapsedHandle",
793
- "questionDelete": "yw4T5a_questionDelete",
794
- "panelError": "yw4T5a_panelError",
795
- "panelEmpty": "yw4T5a_panelEmpty",
796
- "settingsSection": "yw4T5a_settingsSection",
797
- "modelSelectMenu": "yw4T5a_modelSelectMenu",
773
+ "panelListItemDot": "yw4T5a_panelListItemDot",
774
+ "panel": "yw4T5a_panel",
775
+ "questionToggle": "yw4T5a_questionToggle",
798
776
  "questionOptionDesc": "yw4T5a_questionOptionDesc",
799
- "questionFabDot": "yw4T5a_questionFabDot",
800
- "panelTranscript": "yw4T5a_panelTranscript",
801
- "reasoningBody": "yw4T5a_reasoningBody",
802
- "questionBringButton": "yw4T5a_questionBringButton",
777
+ "settingsRowText": "yw4T5a_settingsRowText",
778
+ "modelDescription": "yw4T5a_modelDescription",
779
+ "panelLookup": "yw4T5a_panelLookup",
780
+ "questionBlockActions": "yw4T5a_questionBlockActions",
781
+ "panelComposer": "yw4T5a_panelComposer",
803
782
  "modelSelectLabel": "yw4T5a_modelSelectLabel",
804
- "questionDetail": "yw4T5a_questionDetail",
805
- "panelDispose": "yw4T5a_panelDispose",
806
- "messageUser": "yw4T5a_messageUser",
807
- "modelName": "yw4T5a_modelName",
808
- "settingsBringMode": "yw4T5a_settingsBringMode",
809
- "questionBody": "yw4T5a_questionBody",
810
- "panelRunningPulse": "yw4T5a_panelRunningPulse",
811
- "questionItemCollapsed": "yw4T5a_questionItemCollapsed",
812
- "panelList": "yw4T5a_panelList",
813
- "panelRunning": "yw4T5a_panelRunning",
814
- "panelToolbar": "yw4T5a_panelToolbar",
815
- "modelGroupTitle": "yw4T5a_modelGroupTitle",
816
- "settingsBringOptionActive": "yw4T5a_settingsBringOptionActive",
817
783
  "modelCellChevron": "yw4T5a_modelCellChevron",
818
- "questionOptionLabel": "yw4T5a_questionOptionLabel",
819
- "questionBlock": "yw4T5a_questionBlock",
820
- "questionOptionText": "yw4T5a_questionOptionText",
821
- "messageInsertButton": "yw4T5a_messageInsertButton",
822
- "selectionMenu": "yw4T5a_selectionMenu",
823
- "questionHeaderText": "yw4T5a_questionHeaderText",
824
784
  "panelHeader": "yw4T5a_panelHeader",
825
- "panelClose": "yw4T5a_panelClose",
785
+ "panelEmpty": "yw4T5a_panelEmpty",
786
+ "settingsRowTitle": "yw4T5a_settingsRowTitle",
787
+ "settingsBringOption": "yw4T5a_settingsBringOption",
788
+ "questionDetail": "yw4T5a_questionDetail",
789
+ "questionFabDot": "yw4T5a_questionFabDot",
790
+ "panelConflictHidden": "yw4T5a_panelConflictHidden",
791
+ "questionOption": "yw4T5a_questionOption",
792
+ "modelEmpty": "yw4T5a_modelEmpty",
793
+ "questionBringButton": "yw4T5a_questionBringButton",
794
+ "questionHeaderActions": "yw4T5a_questionHeaderActions",
795
+ "modelCellLabel": "yw4T5a_modelCellLabel",
826
796
  "panelListActions": "yw4T5a_panelListActions",
827
- "questionBlockActions": "yw4T5a_questionBlockActions",
797
+ "questionHeaderText": "yw4T5a_questionHeaderText",
798
+ "panelListItem": "yw4T5a_panelListItem",
799
+ "messageUser": "yw4T5a_messageUser",
800
+ "selectionButton": "yw4T5a_selectionButton",
828
801
  "panelFooter": "yw4T5a_panelFooter",
802
+ "panelRunning": "yw4T5a_panelRunning",
803
+ "panelTitle": "yw4T5a_panelTitle",
804
+ "modelCell": "yw4T5a_modelCell",
805
+ "settingsPromptInput": "yw4T5a_settingsPromptInput",
829
806
  "messageActions": "yw4T5a_messageActions",
807
+ "panelListDeleteAll": "yw4T5a_panelListDeleteAll",
808
+ "panelListItemRow": "yw4T5a_panelListItemRow",
830
809
  "primary": "yw4T5a_primary",
810
+ "panelError": "yw4T5a_panelError",
811
+ "settingsBringOptionActive": "yw4T5a_settingsBringOptionActive",
812
+ "panelDispose": "yw4T5a_panelDispose",
831
813
  "modelOptionSelected": "yw4T5a_modelOptionSelected",
832
- "modelCellLabel": "yw4T5a_modelCellLabel",
833
- "panelListItem": "yw4T5a_panelListItem",
834
- "panelListItemRow": "yw4T5a_panelListItemRow",
835
- "questionToggle": "yw4T5a_questionToggle",
836
- "panelListItemDot": "yw4T5a_panelListItemDot",
837
- "selectionButton": "yw4T5a_selectionButton",
814
+ "questionDelete": "yw4T5a_questionDelete",
815
+ "panelToolbar": "yw4T5a_panelToolbar",
816
+ "panelAttachmentRail": "yw4T5a_panelAttachmentRail",
817
+ "modelName": "yw4T5a_modelName",
818
+ "panelList": "yw4T5a_panelList",
838
819
  "panelHeaderActions": "yw4T5a_panelHeaderActions",
839
- "modelGroups": "yw4T5a_modelGroups",
820
+ "panelRunningClock": "yw4T5a_panelRunningClock",
821
+ "panelRunningDot": "yw4T5a_panelRunningDot",
822
+ "modelSelect": "yw4T5a_modelSelect",
823
+ "settingsSection": "yw4T5a_settingsSection",
824
+ "reasoningSummary": "yw4T5a_reasoningSummary",
825
+ "questionItemCollapsed": "yw4T5a_questionItemCollapsed",
826
+ "panelClose": "yw4T5a_panelClose",
827
+ "questionOptionLabel": "yw4T5a_questionOptionLabel",
828
+ "chevronOpen": "yw4T5a_chevronOpen",
829
+ "modelSelectMenu": "yw4T5a_modelSelectMenu",
830
+ "questionItem": "yw4T5a_questionItem",
840
831
  "modelGroup": "yw4T5a_modelGroup",
832
+ "modelSelectTrigger": "yw4T5a_modelSelectTrigger",
841
833
  "modelOptionCopy": "yw4T5a_modelOptionCopy",
842
- "panelComposer": "yw4T5a_panelComposer",
843
- "modelCell": "yw4T5a_modelCell",
844
- "modelCheck": "yw4T5a_modelCheck",
845
- "modelSelect": "yw4T5a_modelSelect",
846
- "panelListDeleteAll": "yw4T5a_panelListDeleteAll",
847
834
  "settingsToggle": "yw4T5a_settingsToggle",
848
- "messageAssistant": "yw4T5a_messageAssistant",
849
- "settingsRow": "yw4T5a_settingsRow",
850
835
  "questionDeleteAll": "yw4T5a_questionDeleteAll",
836
+ "questionBlock": "yw4T5a_questionBlock",
837
+ "settingsBringMode": "yw4T5a_settingsBringMode",
838
+ "panelResize": "yw4T5a_panelResize",
839
+ "questionHeader": "yw4T5a_questionHeader",
840
+ "panelListItemActive": "yw4T5a_panelListItemActive",
841
+ "panelAttachmentRemove": "yw4T5a_panelAttachmentRemove",
842
+ "messageInsertButton": "yw4T5a_messageInsertButton",
851
843
  "modelSelectEffort": "yw4T5a_modelSelectEffort",
852
- "panelAttachmentRail": "yw4T5a_panelAttachmentRail",
853
- "questionHeaderActions": "yw4T5a_questionHeaderActions",
844
+ "panelListItemRemove": "yw4T5a_panelListItemRemove",
845
+ "panelAttachmentText": "yw4T5a_panelAttachmentText",
854
846
  "panelAttachment": "yw4T5a_panelAttachment",
855
- "modelDescription": "yw4T5a_modelDescription"
847
+ "questionFab": "yw4T5a_questionFab",
848
+ "messageUserText": "yw4T5a_messageUserText",
849
+ "questionOptionText": "yw4T5a_questionOptionText",
850
+ "panelEmbedded": "yw4T5a_panelEmbedded",
851
+ "panelRunningPulse": "yw4T5a_panelRunningPulse",
852
+ "modelCellValue": "yw4T5a_modelCellValue",
853
+ "panelTextarea": "yw4T5a_panelTextarea",
854
+ "modelOption": "yw4T5a_modelOption",
855
+ "reasoningBody": "yw4T5a_reasoningBody",
856
+ "modelGroups": "yw4T5a_modelGroups",
857
+ "settingsRow": "yw4T5a_settingsRow"
856
858
  };
857
859
  //#endregion
858
860
  //#region \0dsh-css:/home/runner/work/dsh-side-chat/dsh-side-chat/src/client/layout.css.mjs
@@ -1047,6 +1049,24 @@ window.__ModuleLoader__.load({
1047
1049
  };
1048
1050
  });
1049
1051
  }
1052
+ /**
1053
+ * Read one image file's intrinsic pixel size, releasing the decoded bitmap.
1054
+ * Returns null when the browser cannot decode it: the host's `validateImage`
1055
+ * stays the authority either way.
1056
+ */
1057
+ async function imageSize(file) {
1058
+ try {
1059
+ const bitmap = await createImageBitmap(file);
1060
+ const size = {
1061
+ width: bitmap.width,
1062
+ height: bitmap.height
1063
+ };
1064
+ bitmap.close();
1065
+ return size;
1066
+ } catch {
1067
+ return null;
1068
+ }
1069
+ }
1050
1070
  /** Revoke one draft image's preview URL. */
1051
1071
  function releaseDraftImage(attachment) {
1052
1072
  URL.revokeObjectURL(attachment.previewUrl);
@@ -2027,29 +2047,39 @@ window.__ModuleLoader__.load({
2027
2047
  props.store.patch({ error: props.t("image.unsupported") });
2028
2048
  return;
2029
2049
  }
2030
- try {
2031
- if (limits !== null) {
2032
- if (images.some((f) => !limits.mediaTypes.includes(f.type))) {
2033
- props.store.patch({ error: props.t("image.unsupported") });
2034
- return;
2035
- }
2036
- if (panel.attachments.length + images.length > limits.maxImagesPerMessage) {
2037
- props.store.patch({ error: props.t("image.tooMany") });
2038
- return;
2039
- }
2040
- if (images.some((f) => f.size > limits.maxImageBytes)) {
2041
- props.store.patch({ error: props.t("image.fileTooLarge") });
2042
- return;
2050
+ (async () => {
2051
+ try {
2052
+ if (limits !== null) {
2053
+ if (images.some((f) => !limits.mediaTypes.includes(f.type))) {
2054
+ props.store.patch({ error: props.t("image.unsupported") });
2055
+ return;
2056
+ }
2057
+ if (panel.attachments.length + images.length > limits.maxImagesPerMessage) {
2058
+ props.store.patch({ error: props.t("image.tooMany") });
2059
+ return;
2060
+ }
2061
+ if (images.some((f) => f.size > limits.maxImageBytes)) {
2062
+ props.store.patch({ error: props.t("image.fileTooLarge") });
2063
+ return;
2064
+ }
2065
+ const maxDimension = limits.maxImageDimension;
2066
+ if (typeof maxDimension === "number" && maxDimension > 0) for (const file of images) {
2067
+ const size = await imageSize(file);
2068
+ if (size !== null && (size.width > maxDimension || size.height > maxDimension)) {
2069
+ props.store.patch({ error: props.t("image.dimensionTooLarge") });
2070
+ return;
2071
+ }
2072
+ }
2043
2073
  }
2074
+ const created = createDraftImages(images);
2075
+ props.store.patch({
2076
+ attachments: [...panel.attachments, ...created],
2077
+ error: null
2078
+ });
2079
+ } catch (error) {
2080
+ props.store.patch({ error: error instanceof Error ? error.message : String(error) });
2044
2081
  }
2045
- const created = createDraftImages(images);
2046
- props.store.patch({
2047
- attachments: [...panel.attachments, ...created],
2048
- error: null
2049
- });
2050
- } catch (error) {
2051
- props.store.patch({ error: error instanceof Error ? error.message : String(error) });
2052
- }
2082
+ })();
2053
2083
  }, [
2054
2084
  limits,
2055
2085
  panel.attachments,
@@ -2509,7 +2539,7 @@ window.__ModuleLoader__.load({
2509
2539
  className: client_module_css_default.primary,
2510
2540
  "aria-label": activeRunning ? props.t("panel.stop") : props.t("panel.send"),
2511
2541
  onClick: activeRunning ? stop : send,
2512
- children: activeRunning ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconStopFill16, { size: 16 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSendOutline16, { size: 16 })
2542
+ children: activeRunning ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconStopFill16, { size: 16 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSendOutline14, { size: 16 })
2513
2543
  })
2514
2544
  })
2515
2545
  ]