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/README.md +9 -1
- package/README.zh.md +7 -1
- package/dsh.plugin.json +2 -2
- package/lib/client-registry.js +143 -113
- package/lib/client-registry.js.map +1 -1
- package/lib/client.js +141 -111
- package/lib/client.js.map +1 -1
- package/lib/index.js +60 -25
- package/lib/types/client/api.d.ts +1 -0
- package/lib/types/client/locales.d.ts +2 -0
- package/lib/types/context-types.d.ts +15 -16
- package/package.json +39 -38
- package/src/client/api.ts +1 -1
- package/src/client/index.tsx +52 -21
- package/src/client/locales.ts +2 -0
- package/src/context-types.ts +13 -18
- package/src/index.ts +60 -22
package/README.md
CHANGED
|
@@ -99,7 +99,15 @@ and you never have to answer before you're ready.
|
|
|
99
99
|
|
|
100
100
|
- [Node.js](https://nodejs.org) ≥ 20
|
|
101
101
|
- [pnpm](https://pnpm.io)
|
|
102
|
-
- DSH ≥ `0.1.0-rc.6` (the harness `engines.dsh` constraint)
|
|
102
|
+
- DSH ≥ `0.1.0-rc.6` (the harness `engines.dsh` constraint); verified against
|
|
103
|
+
`0.1.5-alpha.2` and `0.1.6-alpha.1`. Where those lines differ (`catalog()` vs
|
|
104
|
+
`selectFor()` on permission presets, the added `maxImageDimension` image
|
|
105
|
+
limit, the `IconSendOutline16` icon removal) the plugin feature-detects and
|
|
106
|
+
serves both.
|
|
107
|
+
- `pnpm build` ends with `check-seed-exports`, which compares the client
|
|
108
|
+
bundle's frozen-module-table imports against a real DSH install. Set
|
|
109
|
+
`DSH_INSTALL` (or pass `--shell`) when the install is not discoverable via
|
|
110
|
+
`dsh` on `PATH`; without a target the check skips instead of failing.
|
|
103
111
|
|
|
104
112
|
## Build
|
|
105
113
|
|
package/README.zh.md
CHANGED
|
@@ -66,7 +66,13 @@ Codex 式能力之上,额外支持针对当前**问题弹框**的侧边聊天
|
|
|
66
66
|
|
|
67
67
|
- [Node.js](https://nodejs.org) ≥ 20
|
|
68
68
|
- [pnpm](https://pnpm.io)
|
|
69
|
-
- DSH ≥ `0.1.0-rc.6`(即 `engines.dsh`
|
|
69
|
+
- DSH ≥ `0.1.0-rc.6`(即 `engines.dsh` 声明的约束);已在 `0.1.5-alpha.2` 与
|
|
70
|
+
`0.1.6-alpha.1` 上验证。两代存在差异的地方(权限预设的 `catalog()` 与
|
|
71
|
+
`selectFor()`、新增的 `maxImageDimension` 图片上限、被移除的
|
|
72
|
+
`IconSendOutline16` 图标)插件都做了特性探测,两代都能服务。
|
|
73
|
+
- `pnpm build` 最后会跑 `check-seed-exports`:把客户端 bundle 对冻结模块表的
|
|
74
|
+
引用与一份真实 DSH 安装做比对。若 `dsh` 不在 `PATH` 上而探测不到安装目录,
|
|
75
|
+
可设 `DSH_INSTALL`(或传 `--shell`);找不到目标时会跳过而不是失败。
|
|
70
76
|
|
|
71
77
|
## 构建
|
|
72
78
|
|
package/dsh.plugin.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-side-chat-plus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-alpha.1",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"description": "选中对话内容 → 在侧边聊天中提问:按主会话隔离的隐藏普通会话,继承模型/思考难度/权限(可调),带「需要时查工作区/主会话」开关;可停靠到新版右侧栏或使用经典浮动面板。",
|
|
6
6
|
"engines": {
|
|
7
|
-
"dsh": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1 || ^0.1.5-alpha.2"
|
|
7
|
+
"dsh": "^0.1.0-rc.6 || ^0.1.1-0 || ^0.1.2-0 || ^0.1.5-alpha.1 || ^0.1.5-alpha.2 || ^0.1.6-0"
|
|
8
8
|
},
|
|
9
9
|
"contributes": {
|
|
10
10
|
"tools": [],
|
package/lib/client-registry.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
|
+
"remove": "J5tleW_remove",
|
|
23
24
|
"root": "J5tleW_root",
|
|
24
|
-
"
|
|
25
|
+
"rail": "J5tleW_rail",
|
|
25
26
|
"thumbnail": "J5tleW_thumbnail",
|
|
27
|
+
"arrow": "J5tleW_arrow",
|
|
26
28
|
"item": "J5tleW_item",
|
|
27
|
-
"rail": "J5tleW_rail",
|
|
28
|
-
"remove": "J5tleW_remove",
|
|
29
29
|
"arrowLeft": "J5tleW_arrowLeft",
|
|
30
|
-
"
|
|
30
|
+
"arrowRight": "J5tleW_arrowRight"
|
|
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
|
"mask": "_9H6qrq_mask",
|
|
177
|
-
"
|
|
177
|
+
"illustration": "_9H6qrq_illustration",
|
|
178
178
|
"desc": "_9H6qrq_desc",
|
|
179
179
|
"wrap": "_9H6qrq_wrap",
|
|
180
|
-
"
|
|
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
|
-
"mask": "_5IyjUq_mask",
|
|
324
|
-
"close": "_5IyjUq_close",
|
|
325
323
|
"image": "_5IyjUq_image",
|
|
326
|
-
"backdrop": "_5IyjUq_backdrop"
|
|
324
|
+
"backdrop": "_5IyjUq_backdrop",
|
|
325
|
+
"close": "_5IyjUq_close",
|
|
326
|
+
"mask": "_5IyjUq_mask"
|
|
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
|
-
"loading": "_1H6WSq_loading",
|
|
392
391
|
"frame": "_1H6WSq_frame",
|
|
393
392
|
"error": "_1H6WSq_error",
|
|
393
|
+
"loading": "_1H6WSq_loading",
|
|
394
394
|
"gallery": "_1H6WSq_gallery"
|
|
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
|
-
"panelDispose": "yw4T5a_panelDispose",
|
|
762
|
-
"modelGroups": "yw4T5a_modelGroups",
|
|
763
|
-
"settingsRowTitle": "yw4T5a_settingsRowTitle",
|
|
764
|
-
"panelRunningClock": "yw4T5a_panelRunningClock",
|
|
765
|
-
"panelConflictHidden": "yw4T5a_panelConflictHidden",
|
|
766
|
-
"messageUser": "yw4T5a_messageUser",
|
|
767
|
-
"reasoningSummary": "yw4T5a_reasoningSummary",
|
|
768
|
-
"panelAttachmentRemove": "yw4T5a_panelAttachmentRemove",
|
|
769
|
-
"chevronOpen": "yw4T5a_chevronOpen",
|
|
770
|
-
"modelCell": "yw4T5a_modelCell",
|
|
771
|
-
"settingsSection": "yw4T5a_settingsSection",
|
|
772
|
-
"panelList": "yw4T5a_panelList",
|
|
773
|
-
"modelOption": "yw4T5a_modelOption",
|
|
774
|
-
"panelListDeleteAll": "yw4T5a_panelListDeleteAll",
|
|
775
|
-
"panelListItemLabel": "yw4T5a_panelListItemLabel",
|
|
776
|
-
"questionBody": "yw4T5a_questionBody",
|
|
777
|
-
"panelRunning": "yw4T5a_panelRunning",
|
|
778
|
-
"modelSelectEffort": "yw4T5a_modelSelectEffort",
|
|
779
|
-
"panelListItemActive": "yw4T5a_panelListItemActive",
|
|
780
|
-
"questionHeaderActions": "yw4T5a_questionHeaderActions",
|
|
781
|
-
"primary": "yw4T5a_primary",
|
|
782
|
-
"panelTitle": "yw4T5a_panelTitle",
|
|
783
763
|
"settingsRowDesc": "yw4T5a_settingsRowDesc",
|
|
784
|
-
"
|
|
785
|
-
"
|
|
764
|
+
"settingsToggle": "yw4T5a_settingsToggle",
|
|
765
|
+
"messageUserText": "yw4T5a_messageUserText",
|
|
766
|
+
"questionDetail": "yw4T5a_questionDetail",
|
|
767
|
+
"questionOptionDesc": "yw4T5a_questionOptionDesc",
|
|
768
|
+
"questionBody": "yw4T5a_questionBody",
|
|
769
|
+
"panel": "yw4T5a_panel",
|
|
770
|
+
"panelFooter": "yw4T5a_panelFooter",
|
|
771
|
+
"panelResize": "yw4T5a_panelResize",
|
|
772
|
+
"questionHeaderText": "yw4T5a_questionHeaderText",
|
|
786
773
|
"collapsedHandle": "yw4T5a_collapsedHandle",
|
|
787
|
-
"
|
|
774
|
+
"panelListItemDot": "yw4T5a_panelListItemDot",
|
|
775
|
+
"messageActions": "yw4T5a_messageActions",
|
|
776
|
+
"panelAttachment": "yw4T5a_panelAttachment",
|
|
788
777
|
"panelAttachmentText": "yw4T5a_panelAttachmentText",
|
|
789
|
-
"
|
|
790
|
-
"
|
|
791
|
-
"
|
|
792
|
-
"
|
|
778
|
+
"questionOptionLabel": "yw4T5a_questionOptionLabel",
|
|
779
|
+
"modelCellLabel": "yw4T5a_modelCellLabel",
|
|
780
|
+
"settingsBringOptionActive": "yw4T5a_settingsBringOptionActive",
|
|
781
|
+
"panelEmpty": "yw4T5a_panelEmpty",
|
|
782
|
+
"reasoningSummary": "yw4T5a_reasoningSummary",
|
|
783
|
+
"modelCellValue": "yw4T5a_modelCellValue",
|
|
784
|
+
"panelConflictHidden": "yw4T5a_panelConflictHidden",
|
|
785
|
+
"questionBlockActions": "yw4T5a_questionBlockActions",
|
|
786
|
+
"questionFab": "yw4T5a_questionFab",
|
|
793
787
|
"panelRunningPulse": "yw4T5a_panelRunningPulse",
|
|
794
|
-
"
|
|
788
|
+
"panelLookup": "yw4T5a_panelLookup",
|
|
789
|
+
"modelOption": "yw4T5a_modelOption",
|
|
790
|
+
"modelSelect": "yw4T5a_modelSelect",
|
|
791
|
+
"modelDescription": "yw4T5a_modelDescription",
|
|
792
|
+
"panelAttachmentRemove": "yw4T5a_panelAttachmentRemove",
|
|
793
|
+
"modelGroups": "yw4T5a_modelGroups",
|
|
794
|
+
"settingsRowTitle": "yw4T5a_settingsRowTitle",
|
|
795
|
+
"settingsPromptInput": "yw4T5a_settingsPromptInput",
|
|
796
|
+
"settingsRow": "yw4T5a_settingsRow",
|
|
797
|
+
"messageInsertButton": "yw4T5a_messageInsertButton",
|
|
795
798
|
"panelHeaderActions": "yw4T5a_panelHeaderActions",
|
|
796
|
-
"
|
|
797
|
-
"
|
|
799
|
+
"panelComposer": "yw4T5a_panelComposer",
|
|
800
|
+
"panelEmbedded": "yw4T5a_panelEmbedded",
|
|
801
|
+
"panelListDeleteAll": "yw4T5a_panelListDeleteAll",
|
|
802
|
+
"modelCell": "yw4T5a_modelCell",
|
|
803
|
+
"modelGroup": "yw4T5a_modelGroup",
|
|
804
|
+
"panelRunningDot": "yw4T5a_panelRunningDot",
|
|
805
|
+
"panelHeader": "yw4T5a_panelHeader",
|
|
798
806
|
"selectionMenu": "yw4T5a_selectionMenu",
|
|
799
|
-
"
|
|
800
|
-
"
|
|
801
|
-
"
|
|
802
|
-
"
|
|
803
|
-
"
|
|
804
|
-
"
|
|
807
|
+
"settingsBringMode": "yw4T5a_settingsBringMode",
|
|
808
|
+
"questionHeaderActions": "yw4T5a_questionHeaderActions",
|
|
809
|
+
"messageUser": "yw4T5a_messageUser",
|
|
810
|
+
"modelSelectLabel": "yw4T5a_modelSelectLabel",
|
|
811
|
+
"modelCellChevron": "yw4T5a_modelCellChevron",
|
|
812
|
+
"panelError": "yw4T5a_panelError",
|
|
813
|
+
"selectionButton": "yw4T5a_selectionButton",
|
|
814
|
+
"panelAttachmentRail": "yw4T5a_panelAttachmentRail",
|
|
815
|
+
"panelTextarea": "yw4T5a_panelTextarea",
|
|
816
|
+
"panelRunning": "yw4T5a_panelRunning",
|
|
817
|
+
"chevronOpen": "yw4T5a_chevronOpen",
|
|
805
818
|
"questionDeleteAll": "yw4T5a_questionDeleteAll",
|
|
819
|
+
"questionOption": "yw4T5a_questionOption",
|
|
820
|
+
"modelName": "yw4T5a_modelName",
|
|
806
821
|
"modelCheck": "yw4T5a_modelCheck",
|
|
807
|
-
"panelIconButton": "yw4T5a_panelIconButton",
|
|
808
|
-
"modelCellChevron": "yw4T5a_modelCellChevron",
|
|
809
822
|
"settingsRowText": "yw4T5a_settingsRowText",
|
|
810
|
-
"modelCellLabel": "yw4T5a_modelCellLabel",
|
|
811
|
-
"settingsRow": "yw4T5a_settingsRow",
|
|
812
|
-
"settingsPromptInput": "yw4T5a_settingsPromptInput",
|
|
813
|
-
"modelSelectMenu": "yw4T5a_modelSelectMenu",
|
|
814
|
-
"panelListItemRemove": "yw4T5a_panelListItemRemove",
|
|
815
|
-
"modelCellValue": "yw4T5a_modelCellValue",
|
|
816
|
-
"panelHeader": "yw4T5a_panelHeader",
|
|
817
|
-
"questionBlock": "yw4T5a_questionBlock",
|
|
818
|
-
"reasoningBody": "yw4T5a_reasoningBody",
|
|
819
|
-
"questionDetail": "yw4T5a_questionDetail",
|
|
820
|
-
"panelToolbar": "yw4T5a_panelToolbar",
|
|
821
|
-
"questionItem": "yw4T5a_questionItem",
|
|
822
|
-
"panelRunningDot": "yw4T5a_panelRunningDot",
|
|
823
|
-
"selectionButton": "yw4T5a_selectionButton",
|
|
824
823
|
"modelGroupTitle": "yw4T5a_modelGroupTitle",
|
|
825
|
-
"
|
|
826
|
-
"
|
|
827
|
-
"questionHeader": "yw4T5a_questionHeader",
|
|
828
|
-
"panelResize": "yw4T5a_panelResize",
|
|
829
|
-
"panelEmbedded": "yw4T5a_panelEmbedded",
|
|
830
|
-
"questionDelete": "yw4T5a_questionDelete",
|
|
824
|
+
"questionOptionText": "yw4T5a_questionOptionText",
|
|
825
|
+
"panelToolbar": "yw4T5a_panelToolbar",
|
|
831
826
|
"panelListItem": "yw4T5a_panelListItem",
|
|
827
|
+
"questionFabDot": "yw4T5a_questionFabDot",
|
|
828
|
+
"settingsBringOption": "yw4T5a_settingsBringOption",
|
|
829
|
+
"panelTitle": "yw4T5a_panelTitle",
|
|
830
|
+
"panelListItemLabel": "yw4T5a_panelListItemLabel",
|
|
831
|
+
"panelTranscript": "yw4T5a_panelTranscript",
|
|
832
|
+
"questionHeader": "yw4T5a_questionHeader",
|
|
833
|
+
"modelSelectTrigger": "yw4T5a_modelSelectTrigger",
|
|
834
|
+
"questionBringButton": "yw4T5a_questionBringButton",
|
|
835
|
+
"panelIconButton": "yw4T5a_panelIconButton",
|
|
836
|
+
"modelSelectEffort": "yw4T5a_modelSelectEffort",
|
|
837
|
+
"modelSelectMenu": "yw4T5a_modelSelectMenu",
|
|
832
838
|
"messageAssistant": "yw4T5a_messageAssistant",
|
|
833
|
-
"
|
|
834
|
-
"
|
|
835
|
-
"
|
|
839
|
+
"panelListActions": "yw4T5a_panelListActions",
|
|
840
|
+
"panelRunningClock": "yw4T5a_panelRunningClock",
|
|
841
|
+
"modelOptionSelected": "yw4T5a_modelOptionSelected",
|
|
836
842
|
"questionToggle": "yw4T5a_questionToggle",
|
|
837
|
-
"
|
|
838
|
-
"
|
|
839
|
-
"
|
|
840
|
-
"
|
|
841
|
-
"
|
|
843
|
+
"questionItemCollapsed": "yw4T5a_questionItemCollapsed",
|
|
844
|
+
"panelClose": "yw4T5a_panelClose",
|
|
845
|
+
"questionItem": "yw4T5a_questionItem",
|
|
846
|
+
"questionDelete": "yw4T5a_questionDelete",
|
|
847
|
+
"panelDispose": "yw4T5a_panelDispose",
|
|
848
|
+
"settingsSection": "yw4T5a_settingsSection",
|
|
849
|
+
"questionBlock": "yw4T5a_questionBlock",
|
|
850
|
+
"panelListItemActive": "yw4T5a_panelListItemActive",
|
|
851
|
+
"panelListItemRemove": "yw4T5a_panelListItemRemove",
|
|
852
|
+
"reasoningBody": "yw4T5a_reasoningBody",
|
|
853
|
+
"panelList": "yw4T5a_panelList",
|
|
854
|
+
"panelListItemRow": "yw4T5a_panelListItemRow",
|
|
842
855
|
"modelOptionCopy": "yw4T5a_modelOptionCopy",
|
|
843
|
-
"
|
|
844
|
-
"
|
|
845
|
-
"questionOptionDesc": "yw4T5a_questionOptionDesc",
|
|
846
|
-
"settingsBringOption": "yw4T5a_settingsBringOption",
|
|
847
|
-
"panelEmpty": "yw4T5a_panelEmpty",
|
|
848
|
-
"settingsBringOptionActive": "yw4T5a_settingsBringOptionActive",
|
|
849
|
-
"questionOptionLabel": "yw4T5a_questionOptionLabel",
|
|
850
|
-
"panelTextarea": "yw4T5a_panelTextarea",
|
|
851
|
-
"messageUserText": "yw4T5a_messageUserText",
|
|
852
|
-
"settingsBringMode": "yw4T5a_settingsBringMode",
|
|
853
|
-
"questionFab": "yw4T5a_questionFab",
|
|
854
|
-
"messageInsertButton": "yw4T5a_messageInsertButton",
|
|
855
|
-
"panelFooter": "yw4T5a_panelFooter"
|
|
856
|
+
"modelEmpty": "yw4T5a_modelEmpty",
|
|
857
|
+
"primary": "yw4T5a_primary"
|
|
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
|
-
|
|
2031
|
-
|
|
2032
|
-
if (
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
]
|