@dsh-plus/llm-pi 0.1.0 → 0.1.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 +13 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +14 -2
- package/package.json +9 -9
- package/src/client/client.ts +5 -1
- package/src/config.ts +4 -2
- package/src/ns.ts +9 -0
package/lib/client.js
CHANGED
|
@@ -32,6 +32,18 @@ react = __toESM(react);
|
|
|
32
32
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
33
33
|
react_jsx_runtime = __toESM(react_jsx_runtime);
|
|
34
34
|
|
|
35
|
+
//#region src/ns.ts
|
|
36
|
+
/**
|
|
37
|
+
* settings 命名空间字面量(纯常量,零依赖,浏览器半可安全引入)。
|
|
38
|
+
* 服务端经 settingsNamespace() 品牌化后使用(config.ts),浏览器半将其作为
|
|
39
|
+
* settings.plugin.item keyed 槽位的 key —— 同一字面量两处共用,防止漂移。
|
|
40
|
+
* 契约:dsh rc7 起该槽位按「卡片编辑的 settings 命名空间」作 key 分发,
|
|
41
|
+
* 官方配置页只渲染 key 命中 Host 已注册命名空间的卡片。
|
|
42
|
+
* @module llm-pi/ns
|
|
43
|
+
*/
|
|
44
|
+
const SETTINGS_NS = "dsh-plus-llm-pi";
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
35
47
|
//#region src/client/api.ts
|
|
36
48
|
const ROUTE_CONFIG = "/dsh-plus/llm-pi/config";
|
|
37
49
|
const ROUTE_CATALOG = "/dsh-plus/llm-pi/catalog";
|
|
@@ -1888,7 +1900,7 @@ function apply(ctx) {
|
|
|
1888
1900
|
}), "llm-pi: locale");
|
|
1889
1901
|
c.slots.inject("settings.plugin.item", () => c.slots.register({
|
|
1890
1902
|
name: "settings.plugin.item",
|
|
1891
|
-
|
|
1903
|
+
key: SETTINGS_NS,
|
|
1892
1904
|
order: 110,
|
|
1893
1905
|
locale: NS,
|
|
1894
1906
|
inject: () => ({ t: c.locale.bind(NS) })
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Context } from "@deepseek-ai/cordis";
|
|
|
4
4
|
|
|
5
5
|
//#region src/config.d.ts
|
|
6
6
|
|
|
7
|
-
/** settings 命名空间;webui
|
|
7
|
+
/** settings 命名空间;webui 配置卡片与插件运行期读取同一份(字面量见 ./ns.ts)。 */
|
|
8
8
|
declare const SETTINGS_NS: _deepseek_ai_dsh_settings0.SettingsNamespace;
|
|
9
9
|
/** 本插件可为手写 route 提供的协议实现(与官方 PROTOCOLS 表一致)。 */
|
|
10
10
|
declare const PROTOCOL_IDS: readonly ["openai-completions", "openai-responses", "anthropic-messages"];
|
package/lib/index.js
CHANGED
|
@@ -17,9 +17,21 @@ import { openAIResponsesApi } from "@earendil-works/pi-ai/api/openai-responses.l
|
|
|
17
17
|
import * as vendoredLlm from "@deepseek-ai/dsh-llm";
|
|
18
18
|
import * as vendoredPiAiAdapter from "@deepseek-ai/dsh-llm-pi-ai";
|
|
19
19
|
|
|
20
|
+
//#region src/ns.ts
|
|
21
|
+
/**
|
|
22
|
+
* settings 命名空间字面量(纯常量,零依赖,浏览器半可安全引入)。
|
|
23
|
+
* 服务端经 settingsNamespace() 品牌化后使用(config.ts),浏览器半将其作为
|
|
24
|
+
* settings.plugin.item keyed 槽位的 key —— 同一字面量两处共用,防止漂移。
|
|
25
|
+
* 契约:dsh rc7 起该槽位按「卡片编辑的 settings 命名空间」作 key 分发,
|
|
26
|
+
* 官方配置页只渲染 key 命中 Host 已注册命名空间的卡片。
|
|
27
|
+
* @module llm-pi/ns
|
|
28
|
+
*/
|
|
29
|
+
const SETTINGS_NS$1 = "dsh-plus-llm-pi";
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
20
32
|
//#region src/config.ts
|
|
21
|
-
/** settings 命名空间;webui
|
|
22
|
-
const SETTINGS_NS = settingsNamespace(
|
|
33
|
+
/** settings 命名空间;webui 配置卡片与插件运行期读取同一份(字面量见 ./ns.ts)。 */
|
|
34
|
+
const SETTINGS_NS = settingsNamespace(SETTINGS_NS$1);
|
|
23
35
|
/** 本插件可为手写 route 提供的协议实现(与官方 PROTOCOLS 表一致)。 */
|
|
24
36
|
const PROTOCOL_IDS = [
|
|
25
37
|
"openai-completions",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-plus/llm-pi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "dsh-plus service+ui plugin: 基于 PiAiAdapter 的自定义 LLM 路由(全量 compat、模型继承、models.dev 目录兜底)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@deepseek-ai/cordis": "4.0.1",
|
|
34
34
|
"@deepseek-ai/schemastery": "3.18.1",
|
|
35
|
-
"@deepseek-ai/dsh-settings": "0.1.0-rc.
|
|
36
|
-
"@deepseek-ai/dsh-llm": "0.1.0-rc.
|
|
37
|
-
"@deepseek-ai/dsh-credentials": "0.1.0-rc.
|
|
38
|
-
"@deepseek-ai/dsh-home-paths": "0.1.0-rc.
|
|
39
|
-
"@deepseek-ai/dsh-launch-environment": "0.1.0-rc.
|
|
40
|
-
"@deepseek-ai/dsh-llm-pi-ai": "0.1.0-rc.
|
|
35
|
+
"@deepseek-ai/dsh-settings": "0.1.0-rc.7",
|
|
36
|
+
"@deepseek-ai/dsh-llm": "0.1.0-rc.7",
|
|
37
|
+
"@deepseek-ai/dsh-credentials": "0.1.0-rc.7",
|
|
38
|
+
"@deepseek-ai/dsh-home-paths": "0.1.0-rc.7",
|
|
39
|
+
"@deepseek-ai/dsh-launch-environment": "0.1.0-rc.7",
|
|
40
|
+
"@deepseek-ai/dsh-llm-pi-ai": "0.1.0-rc.7",
|
|
41
41
|
"@earendil-works/pi-ai": "0.82.1",
|
|
42
42
|
"https-proxy-agent": "^7.0.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@deepseek-ai/dsh-host-webserver": "0.1.0-rc.
|
|
45
|
+
"@deepseek-ai/dsh-host-webserver": "0.1.0-rc.7",
|
|
46
46
|
"@types/react": "~18.3.1",
|
|
47
47
|
"react": "^18.2.0"
|
|
48
48
|
},
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"license": "MIT",
|
|
53
53
|
"repository": {
|
|
54
54
|
"type": "git",
|
|
55
|
-
"url": "git+https://github.com/A-G-guy/dsh-
|
|
55
|
+
"url": "git+https://github.com/A-G-guy/dsh-plus.git",
|
|
56
56
|
"directory": "packages/llm-pi"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
package/src/client/client.ts
CHANGED
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
* 类型说明:浏览器半只用到 slots/locale 的很窄一面,此处以最小本地接口声明,
|
|
7
7
|
* 避免为构建期类型引入整条官方 client 依赖树;运行时契约以官方
|
|
8
8
|
* dsh-client-ui-settings-plugins 的 settings.plugin.item 插槽为准。
|
|
9
|
+
* rc7 起该插槽为 keyed 槽位:key 必须是卡片编辑的 settings 命名空间
|
|
10
|
+
* (即服务端 settingsNamespace() 注册的同一字面量,见 ../ns.ts),
|
|
11
|
+
* 官方配置页按此 key 与 Host 已注册命名空间配对分发。
|
|
9
12
|
* @module @dsh-plus/llm-pi/client
|
|
10
13
|
*/
|
|
11
14
|
import type { Context } from '@deepseek-ai/cordis'
|
|
12
15
|
|
|
16
|
+
import { SETTINGS_NS } from '../ns.ts'
|
|
13
17
|
import { LlmPiCard } from './card.tsx'
|
|
14
18
|
import { en, NS, zh } from './i18n.ts'
|
|
15
19
|
import { injectStyle } from './styles.ts'
|
|
@@ -52,7 +56,7 @@ export function apply(ctx: Context): void {
|
|
|
52
56
|
c.slots.register(
|
|
53
57
|
{
|
|
54
58
|
name: 'settings.plugin.item',
|
|
55
|
-
|
|
59
|
+
key: SETTINGS_NS,
|
|
56
60
|
order: 110,
|
|
57
61
|
locale: NS,
|
|
58
62
|
inject: () => ({ t: c.locale.bind(NS) }),
|
package/src/config.ts
CHANGED
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
import z from '@deepseek-ai/schemastery'
|
|
12
12
|
import { settingsNamespace } from '@deepseek-ai/dsh-settings'
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
import { SETTINGS_NS as NS_LITERAL } from './ns.ts'
|
|
15
|
+
|
|
16
|
+
/** settings 命名空间;webui 配置卡片与插件运行期读取同一份(字面量见 ./ns.ts)。 */
|
|
17
|
+
export const SETTINGS_NS = settingsNamespace(NS_LITERAL)
|
|
16
18
|
|
|
17
19
|
/** 本插件可为手写 route 提供的协议实现(与官方 PROTOCOLS 表一致)。 */
|
|
18
20
|
export const PROTOCOL_IDS = ['openai-completions', 'openai-responses', 'anthropic-messages'] as const
|
package/src/ns.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* settings 命名空间字面量(纯常量,零依赖,浏览器半可安全引入)。
|
|
3
|
+
* 服务端经 settingsNamespace() 品牌化后使用(config.ts),浏览器半将其作为
|
|
4
|
+
* settings.plugin.item keyed 槽位的 key —— 同一字面量两处共用,防止漂移。
|
|
5
|
+
* 契约:dsh rc7 起该槽位按「卡片编辑的 settings 命名空间」作 key 分发,
|
|
6
|
+
* 官方配置页只渲染 key 命中 Host 已注册命名空间的卡片。
|
|
7
|
+
* @module llm-pi/ns
|
|
8
|
+
*/
|
|
9
|
+
export const SETTINGS_NS = 'dsh-plus-llm-pi'
|