@dsh-plus/llm-pi 0.1.11 → 0.1.12
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 +526 -336
- package/package.json +3 -2
- package/src/client/card.tsx +112 -134
- package/src/client/client.ts +5 -82
- package/src/client/fields.tsx +24 -42
- package/src/client/i18n.ts +7 -20
- package/src/client/styles.ts +26 -50
- package/src/client/views/models.tsx +4 -2
- package/src/client/views/provider-fields.tsx +4 -2
- package/src/client/scope.ts +0 -59
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* (builtin / models-dev)与 provider 后拉取其 models 列表。
|
|
5
5
|
* @module llm-pi/client/views/models
|
|
6
6
|
*/
|
|
7
|
-
import { type ReactElement, useEffect, useState } from 'react'
|
|
8
7
|
|
|
8
|
+
import { CheckRow } from '@dsh-plus/shared/client'
|
|
9
|
+
import { type ReactElement, useEffect, useState } from 'react'
|
|
9
10
|
import { fetchCatalog, type WireModelsDevStatus } from '../api.ts'
|
|
10
11
|
import { MODALITIES, THINKING_LEVELS } from '../constants.ts'
|
|
11
12
|
import { emptyModelDraft, type ModelDraft, type ReasoningDraft } from '../draft.ts'
|
|
12
|
-
import {
|
|
13
|
+
import { TextField } from '../fields.tsx'
|
|
13
14
|
import { CompatEditor } from './compat.tsx'
|
|
14
15
|
|
|
15
16
|
type CatalogSource = 'builtin' | 'models-dev'
|
|
@@ -227,6 +228,7 @@ export function ModelRow(props: ModelRowProps): ReactElement {
|
|
|
227
228
|
<span className="lpc-label">{t('input')}</span>
|
|
228
229
|
{MODALITIES.map((modality) => (
|
|
229
230
|
<CheckRow
|
|
231
|
+
prefix="lpc"
|
|
230
232
|
key={modality}
|
|
231
233
|
id={`${id}-input-${modality}`}
|
|
232
234
|
label={modality}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* retryPolicy 与模型目录在 views/providers.tsx 的 route 小节内另行渲染。
|
|
5
5
|
* @module llm-pi/client/views/provider-fields
|
|
6
6
|
*/
|
|
7
|
-
import type { ReactElement } from 'react'
|
|
8
7
|
|
|
8
|
+
import { CheckRow } from '@dsh-plus/shared/client'
|
|
9
|
+
import type { ReactElement } from 'react'
|
|
9
10
|
import {
|
|
10
11
|
BUDGET_KEYS,
|
|
11
12
|
CACHE_RETENTION_OPTIONS,
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
TRANSPORT_OPTIONS,
|
|
16
17
|
} from '../constants.ts'
|
|
17
18
|
import type { ProviderDraft } from '../draft.ts'
|
|
18
|
-
import {
|
|
19
|
+
import { SelectField, TextField } from '../fields.tsx'
|
|
19
20
|
import { pruneCompatForApi } from './compat.tsx'
|
|
20
21
|
|
|
21
22
|
export interface ProviderScalarFieldsProps {
|
|
@@ -113,6 +114,7 @@ export function ProviderScalarFields(props: ProviderScalarFieldsProps): ReactEle
|
|
|
113
114
|
<span className="lpc-label">{t('defaultInput')}</span>
|
|
114
115
|
{MODALITIES.map((modality) => (
|
|
115
116
|
<CheckRow
|
|
117
|
+
prefix="lpc"
|
|
116
118
|
key={modality}
|
|
117
119
|
id={`${props.id}-input-${modality}`}
|
|
118
120
|
label={modality}
|
package/src/client/scope.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 浏览器半 settingsScope/connection 的最小本地接口声明。
|
|
3
|
-
* 只声明本插件用到的窄面,避免为构建期类型引入整条官方 client 依赖树;
|
|
4
|
-
* 运行时契约以官方 dsh-client-connection 的 settings RPC 面为准
|
|
5
|
-
* (rc7:白名单已移除,任何已注册命名空间均可 describe/update/replace)。
|
|
6
|
-
*
|
|
7
|
-
* 实现说明:本插件不复用 settingsScope 服务的 bind()——它在非 loopback
|
|
8
|
-
* 页面(如经 tailnet 域名访问)下走 memory 模式、永远无数据;这里按官方
|
|
9
|
-
* 配置页 tab 的同款模式用 `api.settings` 直连实现 Scope(describe 读 +
|
|
10
|
-
* remote `settings/document-updated` / `connection/reset` 刷新,见 client.ts)。
|
|
11
|
-
* @module {pkg}/client/scope
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/** settings 命名空间 scope 的快照(官方 SettingsScopeSnapshot 的最小投影)。 */
|
|
15
|
-
export interface ScopeSnapshot {
|
|
16
|
-
status: 'loading' | 'ready' | 'unavailable'
|
|
17
|
-
/** schema 解析后的配置值(secret 字段已脱敏剥除)。 */
|
|
18
|
-
value: unknown
|
|
19
|
-
/** 命名空间 revision,写操作 fencing 用;首次 Host 应答前为 undefined。 */
|
|
20
|
-
revision: number | undefined
|
|
21
|
-
/** Host 文档是否可写。 */
|
|
22
|
-
writable: boolean
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** settingsScope.bind({namespace}) 返回的控制器面。 */
|
|
26
|
-
export interface Scope {
|
|
27
|
-
getSnapshot(): ScopeSnapshot
|
|
28
|
-
subscribe(listener: () => void): () => void
|
|
29
|
-
load(): Promise<void>
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** connection api.settings 的 RPC 面(本插件用到的三个方法)。 */
|
|
33
|
-
export interface SettingsApi {
|
|
34
|
-
describe(payload?: Record<string, never>): Promise<{
|
|
35
|
-
result: {
|
|
36
|
-
ok: boolean
|
|
37
|
-
value?: {
|
|
38
|
-
writable: boolean
|
|
39
|
-
namespaces: Array<{
|
|
40
|
-
ns: string
|
|
41
|
-
value: unknown
|
|
42
|
-
revision: number
|
|
43
|
-
secrets: Array<{ path: string[]; set: boolean }>
|
|
44
|
-
}>
|
|
45
|
-
}
|
|
46
|
-
error?: { message?: string }
|
|
47
|
-
}
|
|
48
|
-
}>
|
|
49
|
-
update(request: {
|
|
50
|
-
ns: string
|
|
51
|
-
patch: Record<string, unknown>
|
|
52
|
-
expectedRevision?: number
|
|
53
|
-
}): Promise<{ result: { ok: boolean; error?: { message?: string } } }>
|
|
54
|
-
replace(request: {
|
|
55
|
-
ns: string
|
|
56
|
-
section: Record<string, unknown>
|
|
57
|
-
expectedRevision?: number
|
|
58
|
-
}): Promise<{ result: { ok: boolean; error?: { message?: string } } }>
|
|
59
|
-
}
|