@dsh-plus/llm-pi 0.1.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/LICENSE +21 -0
- package/lib/client.js +1904 -0
- package/lib/index.d.ts +90 -0
- package/lib/index.js +1247 -0
- package/package.json +62 -0
- package/src/catalog/builtin.ts +75 -0
- package/src/catalog/models-dev.ts +248 -0
- package/src/client/api.ts +109 -0
- package/src/client/card.tsx +239 -0
- package/src/client/client.ts +63 -0
- package/src/client/constants.ts +97 -0
- package/src/client/draft.ts +293 -0
- package/src/client/fields.tsx +272 -0
- package/src/client/i18n.ts +184 -0
- package/src/client/styles.ts +92 -0
- package/src/client/views/compat.tsx +104 -0
- package/src/client/views/models.tsx +292 -0
- package/src/client/views/provider-fields.tsx +177 -0
- package/src/client/views/providers.tsx +176 -0
- package/src/compat.ts +146 -0
- package/src/config-api.ts +135 -0
- package/src/config.ts +210 -0
- package/src/discovery.ts +176 -0
- package/src/index.ts +33 -0
- package/src/inherit.ts +85 -0
- package/src/profiles.ts +340 -0
- package/src/resolve-dsh.ts +203 -0
- package/src/service.ts +238 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import * as _deepseek_ai_dsh_settings0 from "@deepseek-ai/dsh-settings";
|
|
3
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
|
|
5
|
+
//#region src/config.d.ts
|
|
6
|
+
|
|
7
|
+
/** settings 命名空间;webui 配置卡片与插件运行期读取同一份。 */
|
|
8
|
+
declare const SETTINGS_NS: _deepseek_ai_dsh_settings0.SettingsNamespace;
|
|
9
|
+
/** 本插件可为手写 route 提供的协议实现(与官方 PROTOCOLS 表一致)。 */
|
|
10
|
+
declare const PROTOCOL_IDS: readonly ["openai-completions", "openai-responses", "anthropic-messages"];
|
|
11
|
+
type ProtocolId = (typeof PROTOCOL_IDS)[number];
|
|
12
|
+
/** pi-ai 思考档位,升级序。 */
|
|
13
|
+
declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
14
|
+
declare const MODALITIES: readonly ["text", "image"];
|
|
15
|
+
type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
16
|
+
type Modality = (typeof MODALITIES)[number];
|
|
17
|
+
type ReasoningEfforts = Partial<Record<ThinkingLevel, string | null>>;
|
|
18
|
+
/** 单个模型条目:id 必填,其余字段缺省即继承。 */
|
|
19
|
+
interface ModelEntryConfig {
|
|
20
|
+
id: string;
|
|
21
|
+
extends?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
contextWindow?: number;
|
|
24
|
+
maxTokens?: number;
|
|
25
|
+
input?: Modality[];
|
|
26
|
+
reasoningEfforts?: false | ReasoningEfforts;
|
|
27
|
+
compat?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
/** 单个 provider route 配置(providers 字典的值)。 */
|
|
30
|
+
interface ProviderProfileConfig {
|
|
31
|
+
extends?: string;
|
|
32
|
+
displayName?: string;
|
|
33
|
+
api?: ProtocolId;
|
|
34
|
+
baseURL?: string;
|
|
35
|
+
apiKeyEnv?: string;
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
compat?: Record<string, unknown>;
|
|
38
|
+
defaultContextWindow?: number;
|
|
39
|
+
defaultMaxTokens?: number;
|
|
40
|
+
defaultInput?: Modality[];
|
|
41
|
+
reasoning?: ThinkingLevel;
|
|
42
|
+
thinkingBudgets?: {
|
|
43
|
+
minimal: number;
|
|
44
|
+
low: number;
|
|
45
|
+
medium: number;
|
|
46
|
+
high: number;
|
|
47
|
+
};
|
|
48
|
+
cacheRetention?: 'none' | 'short' | 'long';
|
|
49
|
+
transport?: 'sse' | 'websocket' | 'websocket-cached' | 'auto';
|
|
50
|
+
timeoutMs?: number;
|
|
51
|
+
websocketConnectTimeoutMs?: number;
|
|
52
|
+
streamIdleTimeoutMs?: number;
|
|
53
|
+
retryPolicy?: unknown;
|
|
54
|
+
models?: ModelEntryConfig[];
|
|
55
|
+
}
|
|
56
|
+
/** 插件配置根。 */
|
|
57
|
+
interface LlmPiConfig {
|
|
58
|
+
enabled: boolean;
|
|
59
|
+
catalogUrl: string;
|
|
60
|
+
catalogRefreshHours: number;
|
|
61
|
+
catalogProxy: string;
|
|
62
|
+
providers: Record<string, ProviderProfileConfig>;
|
|
63
|
+
}
|
|
64
|
+
declare const Config: z<LlmPiConfig>;
|
|
65
|
+
/** 配置卡片读取用的传输对象:配置无密钥字段,原样传输;附运行期元信息。 */
|
|
66
|
+
interface WireConfig {
|
|
67
|
+
enabled: boolean;
|
|
68
|
+
catalogUrl: string;
|
|
69
|
+
catalogRefreshHours: number;
|
|
70
|
+
catalogProxy: string;
|
|
71
|
+
providers: Record<string, ProviderProfileConfig>;
|
|
72
|
+
/** 是否存在可写的 settings provider(决定卡片是否允许编辑)。 */
|
|
73
|
+
writable: boolean;
|
|
74
|
+
/** 模块解析来源与自检结果(dsh 树 / vendored 兜底)。 */
|
|
75
|
+
kitSource: string;
|
|
76
|
+
/** models.dev 快照状态(fetchedAt/模型数/错误),供卡片展示。 */
|
|
77
|
+
modelsDevStatus: {
|
|
78
|
+
fetchedAt: string | null;
|
|
79
|
+
providers: number;
|
|
80
|
+
models: number;
|
|
81
|
+
error: string | null;
|
|
82
|
+
} | null;
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/index.d.ts
|
|
86
|
+
declare const name = "dsh-plus-llm-pi";
|
|
87
|
+
declare const inject: readonly ["llm"];
|
|
88
|
+
declare function apply(ctx: Context, config: LlmPiConfig): Promise<void>;
|
|
89
|
+
//#endregion
|
|
90
|
+
export { Config, type LlmPiConfig, type ModelEntryConfig, type ProviderProfileConfig, SETTINGS_NS, type WireConfig, apply, inject, name };
|