@wszhoho/dsh-file-attachment 0.5.7 → 0.5.8
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 +11 -8
- package/lib/index.js +13 -12
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1091,6 +1091,7 @@ window.__ModuleLoader__.load({
|
|
|
1091
1091
|
|
|
1092
1092
|
// 设置页扩展名分组:标题 + 可删 tag + 输入框 + 添加按钮
|
|
1093
1093
|
function FaExtGroup(props) {
|
|
1094
|
+
const [hover, setHover] = react.useState(false)
|
|
1094
1095
|
const list = props.list
|
|
1095
1096
|
const setList = props.setList
|
|
1096
1097
|
const input = props.input
|
|
@@ -1110,7 +1111,7 @@ window.__ModuleLoader__.load({
|
|
|
1110
1111
|
style: { cursor: 'pointer', marginLeft: '4px', opacity: 0.55 },
|
|
1111
1112
|
}, '×')
|
|
1112
1113
|
))
|
|
1113
|
-
return react.createElement('div', { style: { marginBottom: '18px' } },
|
|
1114
|
+
return react.createElement('div', { onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), style: { marginBottom: '18px', padding: '14px 16px', borderRadius: '12px', background: hover ? 'var(--dsw-alias-bg-layer-2, rgba(128,128,128,0.06))' : 'var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.04))', border: `1px solid ${hover ? 'var(--dsw-alias-label-dimmed, var(--dsw-alias-border-l2, rgba(128,128,128,0.3)))' : 'var(--dsw-alias-border-l1, rgba(128,128,128,0.14))'}`, boxShadow: hover ? '0 2px 8px rgba(0,0,0,0.05)' : 'none', transition: 'border-color 0.16s, background 0.16s, box-shadow 0.16s' } },
|
|
1114
1115
|
react.createElement('div', { style: { fontWeight: 600, marginBottom: '8px', fontSize: '13px' } }, props.title),
|
|
1115
1116
|
react.createElement('div', { style: { marginBottom: '8px', minHeight: '22px' } }, tags),
|
|
1116
1117
|
react.createElement('div', { style: { display: 'flex', gap: '8px' } },
|
|
@@ -1149,6 +1150,7 @@ window.__ModuleLoader__.load({
|
|
|
1149
1150
|
const [cfgIn, setCfgIn] = react.useState('')
|
|
1150
1151
|
const [saved, setSaved] = react.useState(false)
|
|
1151
1152
|
const [saving, setSaving] = react.useState(false)
|
|
1153
|
+
const [vlmHover, setVlmHover] = react.useState(false)
|
|
1152
1154
|
react.useEffect(() => {
|
|
1153
1155
|
// 挂载时载入持久化配置到编辑副本(幂等,复用 loadConfig Promise)
|
|
1154
1156
|
let live = true
|
|
@@ -1193,11 +1195,11 @@ window.__ModuleLoader__.load({
|
|
|
1193
1195
|
} finally { setSaving(false) }
|
|
1194
1196
|
}
|
|
1195
1197
|
return react.createElement('div', { style: { padding: '16px', maxWidth: '680px' } },
|
|
1196
|
-
react.createElement('div', { style: { marginBottom: '16px', fontSize: '13px', color: 'rgba(128,128,128,0.
|
|
1198
|
+
react.createElement('div', { style: { marginBottom: '16px', fontSize: '13px', lineHeight: '1.5', color: 'var(--dsw-alias-label-secondary, rgba(128,128,128,0.95))' } }, t('settings.hint')),
|
|
1197
1199
|
react.createElement(FaExtGroup, { title: t('doc.title'), list: doc, setList: setDoc, input: docIn, setInput: setDocIn }),
|
|
1198
1200
|
react.createElement(FaExtGroup, { title: t('code.title'), list: code, setList: setCode, input: codeIn, setInput: setCodeIn }),
|
|
1199
1201
|
react.createElement(FaExtGroup, { title: t('config.title'), list: config, setList: setConfig, input: cfgIn, setInput: setCfgIn }),
|
|
1200
|
-
react.createElement('div', { style: { margin: '16px 0', padding: '
|
|
1202
|
+
react.createElement('div', { onMouseEnter: () => setVlmHover(true), onMouseLeave: () => setVlmHover(false), style: { margin: '16px 0', padding: '14px 16px', borderRadius: '12px', background: vlmHover ? 'var(--dsw-alias-bg-layer-2, rgba(128,128,128,0.06))' : 'var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.04))', border: `1px solid ${vlmHover ? 'var(--dsw-alias-label-dimmed, var(--dsw-alias-border-l2, rgba(128,128,128,0.3)))' : 'var(--dsw-alias-border-l1, rgba(128,128,128,0.14))'}`, boxShadow: vlmHover ? '0 2px 8px rgba(0,0,0,0.05)' : 'none', transition: 'border-color 0.16s, background 0.16s, box-shadow 0.16s' } },
|
|
1201
1203
|
react.createElement('div', { style: { marginBottom: '8px', fontSize: '13px', fontWeight: '600', color: 'var(--dsw-alias-label-primary, inherit)' } }, t('vlm.title')),
|
|
1202
1204
|
react.createElement('div', { style: { marginBottom: '10px', fontSize: '12px', color: 'var(--dsw-alias-label-tertiary, rgba(128,128,128,0.9))' } }, t('vlm.hint')),
|
|
1203
1205
|
react.createElement('div', { style: { display: 'grid', gridTemplateColumns: '110px 1fr', gap: '8px 10px', alignItems: 'center' } },
|
|
@@ -1237,11 +1239,12 @@ window.__ModuleLoader__.load({
|
|
|
1237
1239
|
const [open, setOpen] = react.useState(false)
|
|
1238
1240
|
const [hover, setHover] = react.useState(false)
|
|
1239
1241
|
const [version, setVersion] = react.useState(null)
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
}
|
|
1242
|
+
// 【已屏蔽 /version 拉取,保留代码以备后用】
|
|
1243
|
+
// react.useEffect(() => {
|
|
1244
|
+
// fetch('/dsh-file-attachment/version').then(r => r.json()).then(d => {
|
|
1245
|
+
// if (d.ok && d.version) setVersion(d.version)
|
|
1246
|
+
// }).catch(() => { /* ignore */ })
|
|
1247
|
+
// }, [])
|
|
1245
1248
|
function t(key) {
|
|
1246
1249
|
if (ctxRef !== null && ctxRef.locale !== void 0 && typeof ctxRef.locale.bind === 'function') {
|
|
1247
1250
|
try { return ctxRef.locale.bind('dsh-file-attachment')(key) } catch (err) { /* 回退 key */ }
|
package/lib/index.js
CHANGED
|
@@ -370,18 +370,19 @@ function registerRoutes(ctx) {
|
|
|
370
370
|
return
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
373
|
+
// 【已屏蔽 /version 路由,保留代码以备后用】
|
|
374
|
+
// if (req.method === 'GET' && pathname === '/dsh-file-attachment/version') {
|
|
375
|
+
// try {
|
|
376
|
+
// const pkgPath = fileURLToPath(new URL('../package.json', import.meta.url))
|
|
377
|
+
// const raw = await readFile(pkgPath, 'utf8')
|
|
378
|
+
// const pkg = JSON.parse(raw)
|
|
379
|
+
// json(res, { ok: true, version: pkg.version || '0.0.0' })
|
|
380
|
+
// return
|
|
381
|
+
// } catch {
|
|
382
|
+
// json(res, { ok: false, version: 'unknown' }, 500)
|
|
383
|
+
// return
|
|
384
|
+
// }
|
|
385
|
+
// }
|
|
385
386
|
if (req.method === 'GET' && pathname === '/dsh-file-attachment/config') {
|
|
386
387
|
json(res, { ok: true, value: await readConfig() })
|
|
387
388
|
return
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wszhoho/dsh-file-attachment",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "文件附件:拖拽/粘贴/上传文件(支持多文件);图片与文档统一落盘到 .dsh-file-attachment 并以 @绝对路径 引用发送(文本模型可正常使用);输入框内联显示图片缩略图预览与文件条目,聊天区图片同样渲染为可点击放大的缩略图、文件保持芯片样式;非多模态模型下图片自动调用可配置 VLM 识别生成中文描述回填草稿;文档/代码/配置文件可上传类型可在设置页配置;支持 PC 与移动端浏览器",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|