dsh-model-think-level 2.5.0 → 2.6.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.
- package/README.md +7 -0
- package/lib/client/image-config-client.d.ts +7 -22
- package/lib/client/injection/imagegen-entry.d.ts +4 -17
- package/lib/client.js +6 -5
- package/lib/client.js.map +3 -3
- package/lib/history-compat.d.ts +5 -3
- package/lib/image/config.d.ts +11 -15
- package/lib/image/generate.d.ts +3 -3
- package/lib/image/state.d.ts +45 -0
- package/lib/image/tool.d.ts +1 -1
- package/lib/index.js +308 -125
- package/lib/index.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -184,6 +184,10 @@ dsh plugin add .
|
|
|
184
184
|
|
|
185
185
|
**没有中间层。** 插件不拦对话、不解析回复里的图片标记。它把 `generate_image` 注册成宿主进程里的原生工具——不走 MCP,装完不用额外起进程;名字被占时自动改名为 `dsh_image_generate` 并在日志里说明。
|
|
186
186
|
|
|
187
|
+
生图工具、会话提示、`/生图` 命令和配置页每次都从宿主当前运行的模型设置读取同一份模型列表;不依赖打开配置页、固定延时或后台同步事件。新增、删除模型或更换连接会在下一次读取时生效,单次生成固定使用开始时取得的配置。
|
|
188
|
+
|
|
189
|
+
宿主设置尚未运行、正在重载或读取失败时,会明确报告「生图配置暂不可用」;设置已经就绪但没有生图模型时,会明确报告「没有标记为生图的模型」。这两种状态都不会继续沿用旧模型列表。前端不缓存空列表或错误,恢复后下一次请求即可重新读取。
|
|
190
|
+
|
|
187
191
|
参数:`prompt`(必填)、`model`、`size`、`quality`、`n`、`reference_images`(本地路径)、`reference_attachments`(对话内图片的附件 ID,`sha256:…` 或裸摘要均可,两者可混用)、`path`(落盘位置)。任何参考图非空即走 `/images/edits`。
|
|
188
192
|
|
|
189
193
|
- 多图:上游按 `n` 返回的每一张都会落盘、存为附件并全部附到对话(上游少给就少收,不会编造)。
|
|
@@ -236,6 +240,9 @@ The requested item was created under a different Azure OpenAI resource. Use the
|
|
|
236
240
|
| `ui-order.json` | 供应商与模型的顺序、启用开关,供多机同步;不含任何秘密 |
|
|
237
241
|
| `camouflage.json` | 每个路由的请求伪装身份;只记开着的那几条 |
|
|
238
242
|
| `topic-recovery.json` | 每个路由是否启用旧话题恢复;只记开着的那几条 |
|
|
243
|
+
| `image.json` | 生图开关、默认模型与参数、输出目录及连接对应的诊断;不存可执行的模型列表 |
|
|
244
|
+
|
|
245
|
+
生图偏好文件使用版本 3。旧版本首次保存偏好或记录生成结果时才迁移,原文保留为 `image.json.v2.bak`;读取、显示提示和打开配置页均不改写文件。旧文件中的模型只用于迁移诊断,不能代替宿主当前模型设置。文件损坏或不可读时会保留原文件并明确报错,不会静默重置。
|
|
239
246
|
|
|
240
247
|
`camouflage.json` 和 `topic-recovery.json` 只有路由名与开关,没有秘密,也已在包的 `dsh.webdavSync.configFiles` 里声明,启用 dsh-webdav 的「已安装插件」后会随插件配置同步。文件名刻意不带 `history`:同步层把 `history` 段当会话历史,带这个词的文件一律不带走。旧版写下的 `history-compat.json` 不会被丢,第一次读取时自动迁移成 `topic-recovery.json`。
|
|
241
248
|
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import type { ImageModel } from '../image/config.js';
|
|
2
|
-
/**
|
|
2
|
+
/** 失败时可附带仍可编辑的偏好;它不代表可用的模型列表。 */
|
|
3
3
|
export type TransportAnswer<T> = {
|
|
4
4
|
ok: true;
|
|
5
5
|
data: T;
|
|
6
6
|
} | {
|
|
7
7
|
ok: false;
|
|
8
8
|
error: string;
|
|
9
|
+
data?: T;
|
|
9
10
|
};
|
|
10
11
|
/** GET image-config 的 tool 块:原生 generate_image 的注册状态。 */
|
|
11
12
|
export interface ImageToolView {
|
|
12
13
|
registered: boolean;
|
|
13
14
|
name: string | null;
|
|
14
|
-
/**
|
|
15
|
-
* Why the registration failed, when it did: the host records the error the
|
|
16
|
-
* `tools.register` call threw, so a broken schema is readable instead of
|
|
17
|
-
* silent. Absent while the tool is registered or never attempted.
|
|
18
|
-
*/
|
|
19
15
|
error?: string;
|
|
20
16
|
}
|
|
21
|
-
/** GET image-config
|
|
17
|
+
/** GET image-config 的应答体(浏览器不 import host-only 模块)。 */
|
|
22
18
|
export interface ImageConfigView {
|
|
23
19
|
enabled: boolean;
|
|
24
20
|
models: ImageModel[];
|
|
@@ -33,27 +29,16 @@ export interface ImageConfigView {
|
|
|
33
29
|
syncedAt?: string;
|
|
34
30
|
tool: ImageToolView;
|
|
35
31
|
}
|
|
36
|
-
/** Completion caches must not outlive a successful settings write. */
|
|
37
32
|
export declare function imageConfigRevision(): number;
|
|
38
|
-
/**
|
|
39
|
-
* Listen for a successful config write (the switch changes what other surfaces
|
|
40
|
-
* may offer). @returns the unsubscribe.
|
|
41
|
-
*/
|
|
33
|
+
/** 保存成功后通知仍在使用旧请求的消费者。 */
|
|
42
34
|
export declare function onImageConfigChanged(listener: () => void): () => void;
|
|
43
|
-
/** 画配置页之前就能拿到的快照(没有过就读不到)。 */
|
|
44
35
|
export declare function cachedImageConfigView(): ImageConfigView | undefined;
|
|
45
|
-
/**
|
|
36
|
+
/** 清理快照时也作废尚未完成的旧 GET。 */
|
|
46
37
|
export declare function clearImageConfigCache(): void;
|
|
47
|
-
/**
|
|
48
|
-
* 预热配置:模型页一挂载就发一次 GET,用户点「高级设置」时缓存已经就位。
|
|
49
|
-
* 失败不管——真正打开时会再读一次并把错误显示出来。
|
|
50
|
-
*/
|
|
51
38
|
export declare function prefetchImageConfigView(): void;
|
|
52
|
-
/**
|
|
53
|
-
* 读生图配置(宿主先重同步再回答,所以快照不会过期)。
|
|
54
|
-
*/
|
|
39
|
+
/** 每次纯 GET 当前宿主视图,禁止浏览器 HTTP 缓存参与配置读取。 */
|
|
55
40
|
export declare function readImageConfigView(): Promise<TransportAnswer<ImageConfigView>>;
|
|
56
|
-
/**
|
|
41
|
+
/** 保存偏好;POST 前和结束后都作废旧 GET,随后由调用方重新读取。 */
|
|
57
42
|
export declare function saveImageConfig(patch: {
|
|
58
43
|
enabled?: boolean;
|
|
59
44
|
defaultModel?: string | null;
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* point-select stays `directory.select` untouched):
|
|
5
|
-
*
|
|
6
|
-
* 1. the `/生图` completion source over the host input-trigger pipeline
|
|
7
|
-
* (`/` trigger, model-level candidates), registered ONLY when the host
|
|
8
|
-
* exposes the service — an older kernel just loses the completion, never
|
|
9
|
-
* the command itself;
|
|
10
|
-
* 2. a 30s-cached read of the image config, so a burst of completions costs
|
|
11
|
-
* one route read.
|
|
12
|
-
*
|
|
13
|
-
* @module dsh-model-think-level/client/injection/imagegen-entry
|
|
2
|
+
* `/生图` 的客户端补全:每次读取宿主的当前模型,只有同时在途的 GET
|
|
3
|
+
* 可以共享。成功、失败、空列表都不保留完成后的模型缓存。
|
|
14
4
|
*/
|
|
15
5
|
import type { ClientContext } from '../types.js';
|
|
16
|
-
/**
|
|
6
|
+
/** 保存偏好或宿主事件发生后,新的补全不复用旧的在途 GET。 */
|
|
17
7
|
export declare function invalidateImagegenModels(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Register the completion source. @returns the disposer (a no-op when the
|
|
20
|
-
* host has no input-trigger service to register with).
|
|
21
|
-
*/
|
|
8
|
+
/** Register the optional input-trigger source. */
|
|
22
9
|
export declare function registerImagegenCompletion(ctx: ClientContext): () => void;
|