@wszhoho/dsh-file-attachment 0.5.6 → 0.5.7

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 CHANGED
@@ -23,7 +23,7 @@ DeepSeek Harness (dsh) web GUI 插件:在会话输入框中拖入或 Ctrl+V
23
23
  - **可上传类型**:按 文档 / 代码 / 配置文件 三类增删扩展名(小写、不带点),图片恒可发送;
24
24
  - **多模态识别参数(VLM)**:Base URL / API Key / 模型 / 思考模式开关(默认禁用)/ 超时时间(默认 60 秒),仅当前会话模型不支持多模态时调用,未填 API Key 时静默跳过。
25
25
 
26
- ![可上传类型设置](docs/settings-file-types.png)
26
+ ![可上传类型设置、多模态API设置](docs/settings-file-types.jpg)
27
27
 
28
28
  ## 行为一览
29
29
 
@@ -123,4 +123,4 @@ packages/dsh-file-attachment/
123
123
 
124
124
  ## License
125
125
 
126
- MIT
126
+ MIT
package/lib/client.js CHANGED
@@ -1383,17 +1383,15 @@ window.__ModuleLoader__.load({
1383
1383
  { name: 'shell.overlay', id: 'dsh-file-attachment-lightbox', order: 200 },
1384
1384
  FaLightbox
1385
1385
  ))
1386
- // 插件配置 tab 卡片:settings.plugin.itemkey = settings 命名空间 'dsh-file-attachment')。
1387
- // 卡片自渲染标题+描述+展开(见 FaSettingsCard),展开后承载原有设置表单。
1388
- // 嵌套 inject settingsScope:老版本 host(< 0.1.0-rc.7)无该服务时卡片不出现,
1389
- // 但不卸载整个插件(graceful degradation,与插件市场同形)。
1390
- ctx.inject(['settingsScope'], (scoped) => {
1391
- scoped.slots.inject('settings.plugin.item', () => scoped.slots.register({
1392
- name: 'settings.plugin.item',
1393
- key: 'dsh-file-attachment',
1394
- locale: 'dsh-file-attachment',
1395
- }, FaSettingsCard))
1396
- })
1386
+ // 设置左侧独立菜单:settings.sectionlabel 显示在左侧菜单,内容区渲染表单)
1387
+ slots.inject('settings.section', () => [
1388
+ slots.register({
1389
+ name: 'settings.section',
1390
+ id: 'dsh-file-attachment-settings',
1391
+ order: 120,
1392
+ label: () => ctx.locale.bind('dsh-file-attachment')('settings.title'),
1393
+ }, () => react.createElement(FaSettingsPage, {})),
1394
+ ])
1397
1395
  }
1398
1396
  bridge.conversation = ctx.get('conversation')
1399
1397
  // 劫持 dsh 原生📎:让上传入口位于与 dsh 本体一致的位置(hero/composer 两模式同一按钮),
package/lib/index.js CHANGED
@@ -9,7 +9,9 @@ import { homedir } from 'node:os'
9
9
  import { join, resolve } from 'node:path'
10
10
  import { fileURLToPath } from 'node:url'
11
11
  import { defineTool } from '@deepseek-ai/dsh-tools'
12
- import z from '@deepseek-ai/schemastery'
12
+ // schemastery peerDependency:link 插件目录内可能未安装,用顶层 await 安全加载
13
+ let z = null
14
+ try { z = (await import('@deepseek-ai/schemastery')).default } catch { /* 降级:跳过 settings 注册 */ }
13
15
 
14
16
  /** 本包声明依赖的 Host 服务。 */
15
17
  export const name = 'dsh-file-attachment'
@@ -161,7 +163,7 @@ const SETTINGS_NS = 'dsh-file-attachment'
161
163
  * 仅用于登记命名空间结构(与自动继续插件的 settings.register 同形);卡片内部表单
162
164
  * 继续走 /config 接口读写真实配置。
163
165
  */
164
- const FaAttachmentSchema = z.object({
166
+ const FaAttachmentSchema = z ? z.object({
165
167
  doc: z.array(z.string()).default(DEFAULT_TYPES.doc),
166
168
  code: z.array(z.string()).default(DEFAULT_TYPES.code),
167
169
  config: z.array(z.string()).default(DEFAULT_TYPES.config),
@@ -172,7 +174,7 @@ const FaAttachmentSchema = z.object({
172
174
  thinkingType: z.string().default(VLM_DEFAULTS.thinkingType),
173
175
  timeout: z.natural().default(VLM_DEFAULTS.timeout),
174
176
  }),
175
- })
177
+ }) : null
176
178
 
177
179
  /** 规范化多模态参数(缺省/空值回退默认,trim 去空白)。 */
178
180
  function normalizeVlm(raw) {
@@ -527,7 +529,9 @@ export function apply(ctx, config = {}) {
527
529
  // 老版本 host(无 settings 服务,< 0.1.0-rc.7)此回调不运行,命名空间不登记,
528
530
  // 卡片不出现但不卸载整个插件(graceful degradation,与自动继续/插件市场同形)。
529
531
  ctx.inject(['settings'], (scopedCtx) => {
530
- scopedCtx.settings.register(SETTINGS_NS, FaAttachmentSchema, {})
532
+ if (FaAttachmentSchema) {
533
+ scopedCtx.settings.register(SETTINGS_NS, FaAttachmentSchema, {})
534
+ }
531
535
  })
532
536
  console.log('[dsh-file-attachment] host loaded (webServer routes + describe_image tool)')
533
537
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wszhoho/dsh-file-attachment",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "文件附件:拖拽/粘贴/上传文件(支持多文件);图片与文档统一落盘到 .dsh-file-attachment 并以 @绝对路径 引用发送(文本模型可正常使用);输入框内联显示图片缩略图预览与文件条目,聊天区图片同样渲染为可点击放大的缩略图、文件保持芯片样式;非多模态模型下图片自动调用可配置 VLM 识别生成中文描述回填草稿;文档/代码/配置文件可上传类型可在设置页配置;支持 PC 与移动端浏览器",
5
5
  "keywords": [
6
6
  "dsh",