@huanlin/dsh-plugin-mineru 0.2.0 → 0.2.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 +414 -404
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +22 -0
- package/package.json +2 -3
package/lib/client.js
CHANGED
|
@@ -1,419 +1,429 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"hybrid-engine",
|
|
42
|
-
"vlm-http-client",
|
|
43
|
-
"hybrid-http-client"
|
|
44
|
-
];
|
|
45
|
-
const PARSE_METHODS = [
|
|
46
|
-
"auto",
|
|
47
|
-
"txt",
|
|
48
|
-
"ocr"
|
|
49
|
-
];
|
|
50
|
-
async function callRpc(rpc, endpoint, payload) {
|
|
51
|
-
return rpc.call("/mineru-api", endpoint, payload);
|
|
52
|
-
}
|
|
53
|
-
function SettingsPage({ rpc, t }) {
|
|
54
|
-
const [config, setConfig] = useState(null);
|
|
55
|
-
const [draft, setDraft] = useState(null);
|
|
56
|
-
const [loading, setLoading] = useState(true);
|
|
57
|
-
const [saving, setSaving] = useState(false);
|
|
58
|
-
const [saved, setSaved] = useState(false);
|
|
59
|
-
const [error, setError] = useState(void 0);
|
|
60
|
-
const [testStatus, setTestStatus] = useState("idle");
|
|
61
|
-
const [testMessage, setTestMessage] = useState(void 0);
|
|
62
|
-
const refresh = useCallback(async () => {
|
|
63
|
-
setLoading(true);
|
|
64
|
-
setError(void 0);
|
|
65
|
-
try {
|
|
66
|
-
const result = await callRpc(rpc, "mineru/config.get", {});
|
|
67
|
-
if (result.ok) {
|
|
68
|
-
setConfig(result.value.config);
|
|
69
|
-
setDraft(result.value.config);
|
|
70
|
-
} else setError(result.error.message);
|
|
71
|
-
} catch (err) {
|
|
72
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
73
|
-
} finally {
|
|
74
|
-
setLoading(false);
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@huanlin/dsh-plugin-mineru",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
//#region \0dsh-css:D:\Projects\deepseek-harness\dsh-mineru\src\client\SettingsPage.module.css.mjs
|
|
10
|
+
const css = ".ljbh0j_section {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-width: 720px;\n color: var(--dsw-alias-label-primary);\n}\n\n.ljbh0j_title {\n margin: 0;\n font-size: 16px;\n line-height: 24px;\n font-weight: 500;\n color: var(--dsw-alias-label-primary);\n}\n\n.ljbh0j_intro {\n margin: 0;\n font-size: 14px;\n line-height: 22px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n.ljbh0j_error {\n margin: 0;\n padding: 8px 12px;\n border: 1px solid var(--dsw-alias-state-error-primary);\n border-radius: 8px;\n background: var(--dsw-alias-interactive-bg-hover-danger);\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-state-error-primary);\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n\n.ljbh0j_errorDismiss {\n flex: none;\n border: none;\n background: transparent;\n color: inherit;\n font-size: 16px;\n line-height: 1;\n cursor: pointer;\n padding: 0 4px;\n}\n\n.ljbh0j_loading {\n font-size: 14px;\n line-height: 22px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n.ljbh0j_editor {\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 12px;\n padding: 14px 16px;\n display: flex;\n flex-direction: column;\n gap: 14px;\n background: var(--dsw-alias-bg-module-platform);\n}\n\n.ljbh0j_row {\n display: flex;\n gap: 12px;\n}\n\n.ljbh0j_row > .ljbh0j_field {\n flex: 1;\n}\n\n.ljbh0j_field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.ljbh0j_fieldLabel {\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n.ljbh0j_input,\n.ljbh0j_select {\n height: 32px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 8px;\n padding: 0 10px;\n font-size: 14px;\n line-height: 20px;\n color: var(--dsw-alias-label-primary);\n background: var(--dsw-alias-bg-layer-1);\n outline: none;\n}\n\n.ljbh0j_input:focus,\n.ljbh0j_select:focus {\n border-color: var(--dsw-alias-state-focus-primary);\n}\n\n.ljbh0j_select {\n appearance: none;\n cursor: pointer;\n}\n\n.ljbh0j_actions {\n display: flex;\n align-items: center;\n gap: 10px;\n flex-wrap: wrap;\n}\n\n.ljbh0j_primaryButton {\n height: 36px;\n border: none;\n border-radius: 18px;\n padding: 0 18px;\n font-size: 14px;\n font-weight: 500;\n color: var(--dsw-alias-text-on-primary);\n background: var(--dsw-alias-interactive-bg-primary);\n cursor: pointer;\n}\n\n.ljbh0j_primaryButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.ljbh0j_secondaryButton {\n height: 36px;\n border: 1px solid var(--dsw-alias-border-l2);\n border-radius: 18px;\n padding: 0 18px;\n font-size: 14px;\n color: var(--dsw-alias-label-primary);\n background: var(--dsw-alias-bg-layer-1);\n cursor: pointer;\n}\n\n.ljbh0j_secondaryButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.ljbh0j_testOk {\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-state-success-primary);\n}\n\n.ljbh0j_testWarn {\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-state-warning-primary);\n}\n\n.ljbh0j_testErr {\n font-size: 12px;\n line-height: 18px;\n color: var(--dsw-alias-state-error-primary);\n}\n";
|
|
11
|
+
const classMap = {
|
|
12
|
+
"section": "ljbh0j_section",
|
|
13
|
+
"title": "ljbh0j_title",
|
|
14
|
+
"intro": "ljbh0j_intro",
|
|
15
|
+
"error": "ljbh0j_error",
|
|
16
|
+
"errorDismiss": "ljbh0j_errorDismiss",
|
|
17
|
+
"loading": "ljbh0j_loading",
|
|
18
|
+
"editor": "ljbh0j_editor",
|
|
19
|
+
"row": "ljbh0j_row",
|
|
20
|
+
"field": "ljbh0j_field",
|
|
21
|
+
"fieldLabel": "ljbh0j_fieldLabel",
|
|
22
|
+
"input": "ljbh0j_input",
|
|
23
|
+
"select": "ljbh0j_select",
|
|
24
|
+
"actions": "ljbh0j_actions",
|
|
25
|
+
"primaryButton": "ljbh0j_primaryButton",
|
|
26
|
+
"secondaryButton": "ljbh0j_secondaryButton",
|
|
27
|
+
"testOk": "ljbh0j_testOk",
|
|
28
|
+
"testWarn": "ljbh0j_testWarn",
|
|
29
|
+
"testErr": "ljbh0j_testErr"
|
|
30
|
+
};
|
|
31
|
+
const tagId = "@huanlin/dsh-plugin-mineru/SettingsPage.module.css";
|
|
32
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
33
|
+
const tag = document.createElement("style");
|
|
34
|
+
tag.dataset.plugin = "@huanlin/dsh-plugin-mineru";
|
|
35
|
+
tag.dataset.pluginCss = tagId;
|
|
36
|
+
tag.textContent = css;
|
|
37
|
+
document.head.appendChild(tag);
|
|
38
|
+
} else if (typeof document !== "undefined") {
|
|
39
|
+
const existing = document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]");
|
|
40
|
+
if (existing) existing.textContent = css;
|
|
75
41
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
} else setError(result.error.message);
|
|
93
|
-
} catch (err) {
|
|
94
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
95
|
-
} finally {
|
|
96
|
-
setSaving(false);
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/client/SettingsPage.tsx
|
|
44
|
+
const BACKENDS = [
|
|
45
|
+
"pipeline",
|
|
46
|
+
"vlm-engine",
|
|
47
|
+
"hybrid-engine",
|
|
48
|
+
"vlm-http-client",
|
|
49
|
+
"hybrid-http-client"
|
|
50
|
+
];
|
|
51
|
+
const PARSE_METHODS = [
|
|
52
|
+
"auto",
|
|
53
|
+
"txt",
|
|
54
|
+
"ocr"
|
|
55
|
+
];
|
|
56
|
+
async function callRpc(rpc, endpoint, payload) {
|
|
57
|
+
return rpc.call("/mineru-api", endpoint, payload);
|
|
97
58
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
59
|
+
function SettingsPage({ rpc, t }) {
|
|
60
|
+
const [config, setConfig] = (0, react.useState)(null);
|
|
61
|
+
const [draft, setDraft] = (0, react.useState)(null);
|
|
62
|
+
const [loading, setLoading] = (0, react.useState)(true);
|
|
63
|
+
const [saving, setSaving] = (0, react.useState)(false);
|
|
64
|
+
const [saved, setSaved] = (0, react.useState)(false);
|
|
65
|
+
const [error, setError] = (0, react.useState)(void 0);
|
|
66
|
+
const [testStatus, setTestStatus] = (0, react.useState)("idle");
|
|
67
|
+
const [testMessage, setTestMessage] = (0, react.useState)(void 0);
|
|
68
|
+
const refresh = (0, react.useCallback)(async () => {
|
|
69
|
+
setLoading(true);
|
|
70
|
+
setError(void 0);
|
|
71
|
+
try {
|
|
72
|
+
const result = await callRpc(rpc, "mineru/config.get", {});
|
|
73
|
+
if (result.ok) {
|
|
74
|
+
setConfig(result.value.config);
|
|
75
|
+
setDraft(result.value.config);
|
|
76
|
+
} else setError(result.error.message);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
79
|
+
} finally {
|
|
80
|
+
setLoading(false);
|
|
81
|
+
}
|
|
82
|
+
}, [rpc]);
|
|
83
|
+
(0, react.useEffect)(() => {
|
|
84
|
+
refresh();
|
|
85
|
+
}, [refresh]);
|
|
86
|
+
const save = (0, react.useCallback)(async () => {
|
|
87
|
+
if (draft === null) return;
|
|
88
|
+
setSaving(true);
|
|
89
|
+
setError(void 0);
|
|
90
|
+
setSaved(false);
|
|
91
|
+
try {
|
|
92
|
+
const result = await callRpc(rpc, "mineru/config.set", { config: draft });
|
|
93
|
+
if (result.ok) {
|
|
94
|
+
setConfig(result.value.config);
|
|
95
|
+
setDraft(result.value.config);
|
|
96
|
+
setSaved(true);
|
|
97
|
+
setTimeout(() => setSaved(false), 2e3);
|
|
98
|
+
} else setError(result.error.message);
|
|
99
|
+
} catch (err) {
|
|
100
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
101
|
+
} finally {
|
|
102
|
+
setSaving(false);
|
|
103
|
+
}
|
|
104
|
+
}, [draft, rpc]);
|
|
105
|
+
const testConnection = (0, react.useCallback)(async () => {
|
|
106
|
+
if (draft === null) return;
|
|
107
|
+
setTestStatus("testing");
|
|
108
|
+
setTestMessage(void 0);
|
|
109
|
+
try {
|
|
110
|
+
const result = await callRpc(rpc, "mineru/health", {});
|
|
111
|
+
if (result.ok && result.value.status === "healthy") {
|
|
112
|
+
setTestStatus("healthy");
|
|
113
|
+
const v = result.value.version ? ` v${result.value.version}` : "";
|
|
114
|
+
const q = result.value.queued_tasks !== void 0 ? ` (${result.value.queued_tasks} queued)` : "";
|
|
115
|
+
setTestMessage(`${t("test.healthy")}${v}${q}`);
|
|
116
|
+
} else if (result.ok) {
|
|
117
|
+
setTestStatus("unhealthy");
|
|
118
|
+
setTestMessage(t("test.unhealthy"));
|
|
119
|
+
} else {
|
|
120
|
+
setTestStatus("error");
|
|
121
|
+
setTestMessage(result.error.message);
|
|
122
|
+
}
|
|
123
|
+
} catch (err) {
|
|
124
|
+
setTestStatus("error");
|
|
125
|
+
setTestMessage(err instanceof Error ? err.message : String(err));
|
|
126
|
+
}
|
|
127
|
+
}, [
|
|
128
|
+
draft,
|
|
129
|
+
rpc,
|
|
130
|
+
t
|
|
131
|
+
]);
|
|
132
|
+
const patch = (p) => {
|
|
133
|
+
setDraft((prev) => prev === null ? prev : {
|
|
134
|
+
...prev,
|
|
135
|
+
...p
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
if (loading || draft === null) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
139
|
+
className: classMap.section,
|
|
140
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
141
|
+
className: classMap.title,
|
|
142
|
+
children: t("page.title")
|
|
143
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
144
|
+
className: classMap.loading,
|
|
145
|
+
children: "…"
|
|
161
146
|
})]
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
|
|
147
|
+
});
|
|
148
|
+
const dirty = JSON.stringify(draft) !== JSON.stringify(config);
|
|
149
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
150
|
+
className: classMap.section,
|
|
165
151
|
children: [
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
className: classMap.
|
|
168
|
-
children:
|
|
169
|
-
className: classMap.fieldLabel,
|
|
170
|
-
children: t("field.baseURL")
|
|
171
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
172
|
-
className: classMap.input,
|
|
173
|
-
value: draft.baseURL,
|
|
174
|
-
placeholder: t("field.baseURL.placeholder"),
|
|
175
|
-
onChange: (e) => patch({ baseURL: e.target.value })
|
|
176
|
-
})]
|
|
152
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
153
|
+
className: classMap.title,
|
|
154
|
+
children: t("page.title")
|
|
177
155
|
}),
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
-
className: classMap.
|
|
180
|
-
children:
|
|
181
|
-
className: classMap.fieldLabel,
|
|
182
|
-
children: t("field.apiKeyEnv")
|
|
183
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
184
|
-
className: classMap.input,
|
|
185
|
-
value: draft.apiKeyEnv,
|
|
186
|
-
placeholder: t("field.apiKeyEnv.placeholder"),
|
|
187
|
-
onChange: (e) => patch({ apiKeyEnv: e.target.value })
|
|
188
|
-
})]
|
|
189
|
-
}),
|
|
190
|
-
/* @__PURE__ */ jsxs("div", {
|
|
191
|
-
className: classMap.row,
|
|
192
|
-
children: [/* @__PURE__ */ jsxs("label", {
|
|
193
|
-
className: classMap.field,
|
|
194
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
195
|
-
className: classMap.fieldLabel,
|
|
196
|
-
children: t("field.defaultBackend")
|
|
197
|
-
}), /* @__PURE__ */ jsx("select", {
|
|
198
|
-
className: classMap.select,
|
|
199
|
-
value: draft.defaultBackend,
|
|
200
|
-
onChange: (e) => patch({ defaultBackend: e.target.value }),
|
|
201
|
-
children: BACKENDS.map((b) => /* @__PURE__ */ jsx("option", {
|
|
202
|
-
value: b,
|
|
203
|
-
children: t(`backend.${b}`)
|
|
204
|
-
}, b))
|
|
205
|
-
})]
|
|
206
|
-
}), /* @__PURE__ */ jsxs("label", {
|
|
207
|
-
className: classMap.field,
|
|
208
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
209
|
-
className: classMap.fieldLabel,
|
|
210
|
-
children: t("field.defaultParseMethod")
|
|
211
|
-
}), /* @__PURE__ */ jsx("select", {
|
|
212
|
-
className: classMap.select,
|
|
213
|
-
value: draft.defaultParseMethod,
|
|
214
|
-
onChange: (e) => patch({ defaultParseMethod: e.target.value }),
|
|
215
|
-
children: PARSE_METHODS.map((m) => /* @__PURE__ */ jsx("option", {
|
|
216
|
-
value: m,
|
|
217
|
-
children: t(`parse.${m}`)
|
|
218
|
-
}, m))
|
|
219
|
-
})]
|
|
220
|
-
})]
|
|
221
|
-
}),
|
|
222
|
-
/* @__PURE__ */ jsxs("div", {
|
|
223
|
-
className: classMap.row,
|
|
224
|
-
children: [/* @__PURE__ */ jsxs("label", {
|
|
225
|
-
className: classMap.field,
|
|
226
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
227
|
-
className: classMap.fieldLabel,
|
|
228
|
-
children: t("field.defaultLang")
|
|
229
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
230
|
-
className: classMap.input,
|
|
231
|
-
value: draft.defaultLang,
|
|
232
|
-
onChange: (e) => patch({ defaultLang: e.target.value })
|
|
233
|
-
})]
|
|
234
|
-
}), /* @__PURE__ */ jsxs("label", {
|
|
235
|
-
className: classMap.field,
|
|
236
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
237
|
-
className: classMap.fieldLabel,
|
|
238
|
-
children: t("field.pollIntervalMs")
|
|
239
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
240
|
-
type: "number",
|
|
241
|
-
className: classMap.input,
|
|
242
|
-
value: draft.pollIntervalMs,
|
|
243
|
-
onChange: (e) => patch({ pollIntervalMs: Number(e.target.value) })
|
|
244
|
-
})]
|
|
245
|
-
})]
|
|
246
|
-
}),
|
|
247
|
-
/* @__PURE__ */ jsxs("div", {
|
|
248
|
-
className: classMap.row,
|
|
249
|
-
children: [/* @__PURE__ */ jsxs("label", {
|
|
250
|
-
className: classMap.field,
|
|
251
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
252
|
-
className: classMap.fieldLabel,
|
|
253
|
-
children: t("field.pollTimeoutMs")
|
|
254
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
255
|
-
type: "number",
|
|
256
|
-
className: classMap.input,
|
|
257
|
-
value: draft.pollTimeoutMs,
|
|
258
|
-
onChange: (e) => patch({ pollTimeoutMs: Number(e.target.value) })
|
|
259
|
-
})]
|
|
260
|
-
}), /* @__PURE__ */ jsxs("label", {
|
|
261
|
-
className: classMap.field,
|
|
262
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
263
|
-
className: classMap.fieldLabel,
|
|
264
|
-
children: t("field.requestTimeoutMs")
|
|
265
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
266
|
-
type: "number",
|
|
267
|
-
className: classMap.input,
|
|
268
|
-
value: draft.requestTimeoutMs,
|
|
269
|
-
onChange: (e) => patch({ requestTimeoutMs: Number(e.target.value) })
|
|
270
|
-
})]
|
|
271
|
-
})]
|
|
156
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
157
|
+
className: classMap.intro,
|
|
158
|
+
children: t("page.intro")
|
|
272
159
|
}),
|
|
273
|
-
/* @__PURE__ */ jsxs("
|
|
274
|
-
className: classMap.
|
|
275
|
-
children: [/* @__PURE__ */ jsx("
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
className: classMap.input,
|
|
281
|
-
value: draft.maxMdOutputChars,
|
|
282
|
-
onChange: (e) => patch({ maxMdOutputChars: Number(e.target.value) })
|
|
160
|
+
error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
161
|
+
className: classMap.error,
|
|
162
|
+
children: [error, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
163
|
+
type: "button",
|
|
164
|
+
className: classMap.errorDismiss,
|
|
165
|
+
onClick: () => setError(void 0),
|
|
166
|
+
children: "×"
|
|
283
167
|
})]
|
|
284
|
-
})
|
|
285
|
-
]
|
|
286
|
-
}),
|
|
287
|
-
/* @__PURE__ */ jsxs("div", {
|
|
288
|
-
className: classMap.actions,
|
|
289
|
-
children: [
|
|
290
|
-
/* @__PURE__ */ jsx("button", {
|
|
291
|
-
type: "button",
|
|
292
|
-
className: classMap.primaryButton,
|
|
293
|
-
onClick: () => void save(),
|
|
294
|
-
disabled: !dirty || saving,
|
|
295
|
-
children: saving ? "…" : saved ? t("action.saved") : t("action.save")
|
|
296
|
-
}),
|
|
297
|
-
/* @__PURE__ */ jsx("button", {
|
|
298
|
-
type: "button",
|
|
299
|
-
className: classMap.secondaryButton,
|
|
300
|
-
onClick: () => void testConnection(),
|
|
301
|
-
disabled: testStatus === "testing",
|
|
302
|
-
children: testStatus === "testing" ? t("action.testing") : t("action.test")
|
|
303
|
-
}),
|
|
304
|
-
testStatus === "healthy" && testMessage !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
305
|
-
className: classMap.testOk,
|
|
306
|
-
children: testMessage
|
|
307
168
|
}),
|
|
308
|
-
|
|
309
|
-
className: classMap.
|
|
310
|
-
children:
|
|
169
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
170
|
+
className: classMap.editor,
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
173
|
+
className: classMap.field,
|
|
174
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
175
|
+
className: classMap.fieldLabel,
|
|
176
|
+
children: t("field.baseURL")
|
|
177
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
178
|
+
className: classMap.input,
|
|
179
|
+
value: draft.baseURL,
|
|
180
|
+
placeholder: t("field.baseURL.placeholder"),
|
|
181
|
+
onChange: (e) => patch({ baseURL: e.target.value })
|
|
182
|
+
})]
|
|
183
|
+
}),
|
|
184
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
185
|
+
className: classMap.field,
|
|
186
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
187
|
+
className: classMap.fieldLabel,
|
|
188
|
+
children: t("field.apiKeyEnv")
|
|
189
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
190
|
+
className: classMap.input,
|
|
191
|
+
value: draft.apiKeyEnv,
|
|
192
|
+
placeholder: t("field.apiKeyEnv.placeholder"),
|
|
193
|
+
onChange: (e) => patch({ apiKeyEnv: e.target.value })
|
|
194
|
+
})]
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
197
|
+
className: classMap.row,
|
|
198
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
199
|
+
className: classMap.field,
|
|
200
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
201
|
+
className: classMap.fieldLabel,
|
|
202
|
+
children: t("field.defaultBackend")
|
|
203
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
204
|
+
className: classMap.select,
|
|
205
|
+
value: draft.defaultBackend,
|
|
206
|
+
onChange: (e) => patch({ defaultBackend: e.target.value }),
|
|
207
|
+
children: BACKENDS.map((b) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
208
|
+
value: b,
|
|
209
|
+
children: t(`backend.${b}`)
|
|
210
|
+
}, b))
|
|
211
|
+
})]
|
|
212
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
213
|
+
className: classMap.field,
|
|
214
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
215
|
+
className: classMap.fieldLabel,
|
|
216
|
+
children: t("field.defaultParseMethod")
|
|
217
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
218
|
+
className: classMap.select,
|
|
219
|
+
value: draft.defaultParseMethod,
|
|
220
|
+
onChange: (e) => patch({ defaultParseMethod: e.target.value }),
|
|
221
|
+
children: PARSE_METHODS.map((m) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
222
|
+
value: m,
|
|
223
|
+
children: t(`parse.${m}`)
|
|
224
|
+
}, m))
|
|
225
|
+
})]
|
|
226
|
+
})]
|
|
227
|
+
}),
|
|
228
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
229
|
+
className: classMap.row,
|
|
230
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
231
|
+
className: classMap.field,
|
|
232
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
233
|
+
className: classMap.fieldLabel,
|
|
234
|
+
children: t("field.defaultLang")
|
|
235
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
236
|
+
className: classMap.input,
|
|
237
|
+
value: draft.defaultLang,
|
|
238
|
+
onChange: (e) => patch({ defaultLang: e.target.value })
|
|
239
|
+
})]
|
|
240
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
241
|
+
className: classMap.field,
|
|
242
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
243
|
+
className: classMap.fieldLabel,
|
|
244
|
+
children: t("field.pollIntervalMs")
|
|
245
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
246
|
+
type: "number",
|
|
247
|
+
className: classMap.input,
|
|
248
|
+
value: draft.pollIntervalMs,
|
|
249
|
+
onChange: (e) => patch({ pollIntervalMs: Number(e.target.value) })
|
|
250
|
+
})]
|
|
251
|
+
})]
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
254
|
+
className: classMap.row,
|
|
255
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
256
|
+
className: classMap.field,
|
|
257
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
258
|
+
className: classMap.fieldLabel,
|
|
259
|
+
children: t("field.pollTimeoutMs")
|
|
260
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
261
|
+
type: "number",
|
|
262
|
+
className: classMap.input,
|
|
263
|
+
value: draft.pollTimeoutMs,
|
|
264
|
+
onChange: (e) => patch({ pollTimeoutMs: Number(e.target.value) })
|
|
265
|
+
})]
|
|
266
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
267
|
+
className: classMap.field,
|
|
268
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
269
|
+
className: classMap.fieldLabel,
|
|
270
|
+
children: t("field.requestTimeoutMs")
|
|
271
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
272
|
+
type: "number",
|
|
273
|
+
className: classMap.input,
|
|
274
|
+
value: draft.requestTimeoutMs,
|
|
275
|
+
onChange: (e) => patch({ requestTimeoutMs: Number(e.target.value) })
|
|
276
|
+
})]
|
|
277
|
+
})]
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
280
|
+
className: classMap.field,
|
|
281
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
282
|
+
className: classMap.fieldLabel,
|
|
283
|
+
children: t("field.maxMdOutputChars")
|
|
284
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
285
|
+
type: "number",
|
|
286
|
+
className: classMap.input,
|
|
287
|
+
value: draft.maxMdOutputChars,
|
|
288
|
+
onChange: (e) => patch({ maxMdOutputChars: Number(e.target.value) })
|
|
289
|
+
})]
|
|
290
|
+
})
|
|
291
|
+
]
|
|
311
292
|
}),
|
|
312
|
-
|
|
313
|
-
className: classMap.
|
|
293
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
294
|
+
className: classMap.actions,
|
|
314
295
|
children: [
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
296
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
297
|
+
type: "button",
|
|
298
|
+
className: classMap.primaryButton,
|
|
299
|
+
onClick: () => void save(),
|
|
300
|
+
disabled: !dirty || saving,
|
|
301
|
+
children: saving ? "…" : saved ? t("action.saved") : t("action.save")
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
304
|
+
type: "button",
|
|
305
|
+
className: classMap.secondaryButton,
|
|
306
|
+
onClick: () => void testConnection(),
|
|
307
|
+
disabled: testStatus === "testing",
|
|
308
|
+
children: testStatus === "testing" ? t("action.testing") : t("action.test")
|
|
309
|
+
}),
|
|
310
|
+
testStatus === "healthy" && testMessage !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
311
|
+
className: classMap.testOk,
|
|
312
|
+
children: testMessage
|
|
313
|
+
}),
|
|
314
|
+
testStatus === "unhealthy" && testMessage !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
315
|
+
className: classMap.testWarn,
|
|
316
|
+
children: testMessage
|
|
317
|
+
}),
|
|
318
|
+
testStatus === "error" && testMessage !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
319
|
+
className: classMap.testErr,
|
|
320
|
+
children: [
|
|
321
|
+
t("test.error"),
|
|
322
|
+
": ",
|
|
323
|
+
testMessage
|
|
324
|
+
]
|
|
325
|
+
})
|
|
318
326
|
]
|
|
319
327
|
})
|
|
320
328
|
]
|
|
321
|
-
})
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/client/locales.ts
|
|
333
|
+
const NS = "dsh-mineru";
|
|
334
|
+
const en = {
|
|
335
|
+
"nav": "MinerU",
|
|
336
|
+
"page.title": "MinerU Configuration",
|
|
337
|
+
"page.intro": "Configure the MinerU document parsing server. Changes apply immediately to all mineru_* tools.",
|
|
338
|
+
"field.baseURL": "API Base URL",
|
|
339
|
+
"field.baseURL.placeholder": "http://your-mineru-host:18000",
|
|
340
|
+
"field.apiKeyEnv": "API Key Env Var",
|
|
341
|
+
"field.apiKeyEnv.placeholder": "MINERU_API_KEY",
|
|
342
|
+
"field.defaultBackend": "Default Backend",
|
|
343
|
+
"field.defaultParseMethod": "Default Parse Method",
|
|
344
|
+
"field.defaultLang": "Default Language",
|
|
345
|
+
"field.pollIntervalMs": "Poll Interval (ms)",
|
|
346
|
+
"field.pollTimeoutMs": "Poll Timeout (ms)",
|
|
347
|
+
"field.requestTimeoutMs": "Request Timeout (ms)",
|
|
348
|
+
"field.maxMdOutputChars": "Max Markdown Output Chars",
|
|
349
|
+
"action.save": "Save",
|
|
350
|
+
"action.saved": "Saved",
|
|
351
|
+
"action.test": "Test Connection",
|
|
352
|
+
"action.testing": "Testing…",
|
|
353
|
+
"test.healthy": "Healthy",
|
|
354
|
+
"test.unhealthy": "Unhealthy",
|
|
355
|
+
"test.error": "Connection failed",
|
|
356
|
+
"backend.pipeline": "pipeline (no VLM, multi-language)",
|
|
357
|
+
"backend.vlm-engine": "vlm-engine (VLM only)",
|
|
358
|
+
"backend.hybrid-engine": "hybrid-engine (VLM + pipeline)",
|
|
359
|
+
"backend.vlm-http-client": "vlm-http-client",
|
|
360
|
+
"backend.hybrid-http-client": "hybrid-http-client",
|
|
361
|
+
"parse.auto": "auto",
|
|
362
|
+
"parse.txt": "txt (text only, no OCR)",
|
|
363
|
+
"parse.ocr": "ocr (force OCR)"
|
|
364
|
+
};
|
|
365
|
+
const zh = {
|
|
366
|
+
"nav": "MinerU",
|
|
367
|
+
"page.title": "MinerU 配置",
|
|
368
|
+
"page.intro": "配置 MinerU 文档解析服务器。修改后立即对所有 mineru_* 工具生效。",
|
|
369
|
+
"field.baseURL": "API 地址",
|
|
370
|
+
"field.baseURL.placeholder": "http://your-mineru-host:18000",
|
|
371
|
+
"field.apiKeyEnv": "API Key 环境变量",
|
|
372
|
+
"field.apiKeyEnv.placeholder": "MINERU_API_KEY",
|
|
373
|
+
"field.defaultBackend": "默认后端",
|
|
374
|
+
"field.defaultParseMethod": "默认解析方式",
|
|
375
|
+
"field.defaultLang": "默认语言",
|
|
376
|
+
"field.pollIntervalMs": "轮询间隔 (ms)",
|
|
377
|
+
"field.pollTimeoutMs": "轮询超时 (ms)",
|
|
378
|
+
"field.requestTimeoutMs": "请求超时 (ms)",
|
|
379
|
+
"field.maxMdOutputChars": "Markdown 输出字符上限",
|
|
380
|
+
"action.save": "保存",
|
|
381
|
+
"action.saved": "已保存",
|
|
382
|
+
"action.test": "测试连接",
|
|
383
|
+
"action.testing": "测试中…",
|
|
384
|
+
"test.healthy": "健康",
|
|
385
|
+
"test.unhealthy": "异常",
|
|
386
|
+
"test.error": "连接失败",
|
|
387
|
+
"backend.pipeline": "pipeline(无 VLM,多语言)",
|
|
388
|
+
"backend.vlm-engine": "vlm-engine(仅 VLM)",
|
|
389
|
+
"backend.hybrid-engine": "hybrid-engine(VLM + pipeline)",
|
|
390
|
+
"backend.vlm-http-client": "vlm-http-client",
|
|
391
|
+
"backend.hybrid-http-client": "hybrid-http-client",
|
|
392
|
+
"parse.auto": "auto",
|
|
393
|
+
"parse.txt": "txt(仅文本,不 OCR)",
|
|
394
|
+
"parse.ocr": "ocr(强制 OCR)"
|
|
395
|
+
};
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region src/client/index.ts
|
|
398
|
+
const inject = [
|
|
399
|
+
"slots",
|
|
400
|
+
"locale",
|
|
401
|
+
"connection"
|
|
402
|
+
];
|
|
403
|
+
function apply(ctx) {
|
|
404
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
405
|
+
zh,
|
|
406
|
+
en
|
|
407
|
+
}), "dsh-mineru: dictionaries");
|
|
408
|
+
const connection = ctx.connection;
|
|
409
|
+
const t = ctx.locale.bind(NS);
|
|
410
|
+
const settingsInjected = () => ({
|
|
411
|
+
rpc: connection.rpc,
|
|
412
|
+
t
|
|
413
|
+
});
|
|
414
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
415
|
+
name: "settings.section",
|
|
416
|
+
id: "dsh-mineru",
|
|
417
|
+
order: 40,
|
|
418
|
+
label: () => t("nav"),
|
|
419
|
+
inject: settingsInjected
|
|
420
|
+
}, SettingsPage));
|
|
421
|
+
}
|
|
422
|
+
//#endregion
|
|
423
|
+
exports.apply = apply;
|
|
424
|
+
exports.inject = inject;
|
|
425
|
+
return module.exports;
|
|
426
|
+
}
|
|
427
|
+
});
|
|
418
428
|
|
|
419
429
|
//# sourceMappingURL=client.js.map
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["css"],"sources":["../src/client/SettingsPage.tsx","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\nimport type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ClientConnectionRpc, RpcResult } from '@deepseek-ai/dsh-client-connection/client'\nimport type { MineruRuntimeConfig } from '../rpc.js'\nimport type { MineruKey } from './locales.js'\nimport css from './SettingsPage.module.css'\n\nexport interface MineruSettingsInjected {\n readonly rpc: ClientConnectionRpc\n readonly t: (key: string) => string\n}\n\ntype SettingsPageProps = PropsRuntime<'settings.section'> & PropsLocale<'dsh-mineru'> & MineruSettingsInjected\n\ntype ConfigGetResult = RpcResult<{ readonly config: MineruRuntimeConfig }>\ntype ConfigSetResult = RpcResult<{ readonly config: MineruRuntimeConfig }>\ntype HealthResult = RpcResult<{ readonly status: string; readonly version?: string; readonly queued_tasks?: number; readonly processing_tasks?: number }>\n\nconst BACKENDS = ['pipeline', 'vlm-engine', 'hybrid-engine', 'vlm-http-client', 'hybrid-http-client'] as const\nconst PARSE_METHODS = ['auto', 'txt', 'ocr'] as const\n\nasync function callRpc<T>(rpc: ClientConnectionRpc, endpoint: string, payload: unknown): Promise<T> {\n return rpc.call('/mineru-api', endpoint, payload) as Promise<T>\n}\n\nexport function SettingsPage({ rpc, t }: SettingsPageProps) {\n const [config, setConfig] = useState<MineruRuntimeConfig | null>(null)\n const [draft, setDraft] = useState<MineruRuntimeConfig | null>(null)\n const [loading, setLoading] = useState(true)\n const [saving, setSaving] = useState(false)\n const [saved, setSaved] = useState(false)\n const [error, setError] = useState<string | undefined>(undefined)\n const [testStatus, setTestStatus] = useState<'idle' | 'testing' | 'healthy' | 'unhealthy' | 'error'>('idle')\n const [testMessage, setTestMessage] = useState<string | undefined>(undefined)\n\n const refresh = useCallback(async () => {\n setLoading(true)\n setError(undefined)\n try {\n const result = await callRpc<ConfigGetResult>(rpc, 'mineru/config.get', {})\n if (result.ok) {\n setConfig(result.value.config)\n setDraft(result.value.config)\n } else {\n setError(result.error.message)\n }\n } catch (err) {\n setError(err instanceof Error ? err.message : String(err))\n } finally {\n setLoading(false)\n }\n }, [rpc])\n\n useEffect(() => { void refresh() }, [refresh])\n\n const save = useCallback(async () => {\n if (draft === null) return\n setSaving(true)\n setError(undefined)\n setSaved(false)\n try {\n const result = await callRpc<ConfigSetResult>(rpc, 'mineru/config.set', { config: draft })\n if (result.ok) {\n setConfig(result.value.config)\n setDraft(result.value.config)\n setSaved(true)\n setTimeout(() => setSaved(false), 2000)\n } else {\n setError(result.error.message)\n }\n } catch (err) {\n setError(err instanceof Error ? err.message : String(err))\n } finally {\n setSaving(false)\n }\n }, [draft, rpc])\n\n const testConnection = useCallback(async () => {\n if (draft === null) return\n setTestStatus('testing')\n setTestMessage(undefined)\n try {\n const result = await callRpc<HealthResult>(rpc, 'mineru/health', {})\n if (result.ok && result.value.status === 'healthy') {\n setTestStatus('healthy')\n const v = result.value.version ? ` v${result.value.version}` : ''\n const q = result.value.queued_tasks !== undefined ? ` (${result.value.queued_tasks} queued)` : ''\n setTestMessage(`${t('test.healthy')}${v}${q}`)\n } else if (result.ok) {\n setTestStatus('unhealthy')\n setTestMessage(t('test.unhealthy'))\n } else {\n setTestStatus('error')\n setTestMessage(result.error.message)\n }\n } catch (err) {\n setTestStatus('error')\n setTestMessage(err instanceof Error ? err.message : String(err))\n }\n }, [draft, rpc, t])\n\n const patch = (p: Partial<MineruRuntimeConfig>): void => {\n setDraft(prev => prev === null ? prev : { ...prev, ...p })\n }\n\n if (loading || draft === null) {\n return (\n <section className={css.section}>\n <h2 className={css.title}>{t('page.title')}</h2>\n <div className={css.loading}>…</div>\n </section>\n )\n }\n\n const dirty = JSON.stringify(draft) !== JSON.stringify(config)\n\n return (\n <section className={css.section}>\n <h2 className={css.title}>{t('page.title')}</h2>\n <p className={css.intro}>{t('page.intro')}</p>\n\n {error !== undefined && (\n <div className={css.error}>\n {error}\n <button type=\"button\" className={css.errorDismiss} onClick={() => setError(undefined)}>×</button>\n </div>\n )}\n\n <div className={css.editor}>\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.baseURL')}</span>\n <input\n className={css.input}\n value={draft.baseURL}\n placeholder={t('field.baseURL.placeholder')}\n onChange={e => patch({ baseURL: e.target.value })}\n />\n </label>\n\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.apiKeyEnv')}</span>\n <input\n className={css.input}\n value={draft.apiKeyEnv}\n placeholder={t('field.apiKeyEnv.placeholder')}\n onChange={e => patch({ apiKeyEnv: e.target.value })}\n />\n </label>\n\n <div className={css.row}>\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.defaultBackend')}</span>\n <select\n className={css.select}\n value={draft.defaultBackend}\n onChange={e => patch({ defaultBackend: e.target.value })}\n >\n {BACKENDS.map(b => (\n <option key={b} value={b}>{t(`backend.${b}` as MineruKey)}</option>\n ))}\n </select>\n </label>\n\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.defaultParseMethod')}</span>\n <select\n className={css.select}\n value={draft.defaultParseMethod}\n onChange={e => patch({ defaultParseMethod: e.target.value })}\n >\n {PARSE_METHODS.map(m => (\n <option key={m} value={m}>{t(`parse.${m}` as MineruKey)}</option>\n ))}\n </select>\n </label>\n </div>\n\n <div className={css.row}>\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.defaultLang')}</span>\n <input\n className={css.input}\n value={draft.defaultLang}\n onChange={e => patch({ defaultLang: e.target.value })}\n />\n </label>\n\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.pollIntervalMs')}</span>\n <input\n type=\"number\"\n className={css.input}\n value={draft.pollIntervalMs}\n onChange={e => patch({ pollIntervalMs: Number(e.target.value) })}\n />\n </label>\n </div>\n\n <div className={css.row}>\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.pollTimeoutMs')}</span>\n <input\n type=\"number\"\n className={css.input}\n value={draft.pollTimeoutMs}\n onChange={e => patch({ pollTimeoutMs: Number(e.target.value) })}\n />\n </label>\n\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.requestTimeoutMs')}</span>\n <input\n type=\"number\"\n className={css.input}\n value={draft.requestTimeoutMs}\n onChange={e => patch({ requestTimeoutMs: Number(e.target.value) })}\n />\n </label>\n </div>\n\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.maxMdOutputChars')}</span>\n <input\n type=\"number\"\n className={css.input}\n value={draft.maxMdOutputChars}\n onChange={e => patch({ maxMdOutputChars: Number(e.target.value) })}\n />\n </label>\n </div>\n\n <div className={css.actions}>\n <button\n type=\"button\"\n className={css.primaryButton}\n onClick={() => void save()}\n disabled={!dirty || saving}\n >\n {saving ? '…' : saved ? t('action.saved') : t('action.save')}\n </button>\n <button\n type=\"button\"\n className={css.secondaryButton}\n onClick={() => void testConnection()}\n disabled={testStatus === 'testing'}\n >\n {testStatus === 'testing' ? t('action.testing') : t('action.test')}\n </button>\n {testStatus === 'healthy' && testMessage !== undefined && (\n <span className={css.testOk}>{testMessage}</span>\n )}\n {testStatus === 'unhealthy' && testMessage !== undefined && (\n <span className={css.testWarn}>{testMessage}</span>\n )}\n {testStatus === 'error' && testMessage !== undefined && (\n <span className={css.testErr}>{t('test.error')}: {testMessage}</span>\n )}\n </div>\n </section>\n )\n}\n","export type MineruKey =\n | 'nav'\n | 'page.title'\n | 'page.intro'\n | 'field.baseURL'\n | 'field.baseURL.placeholder'\n | 'field.apiKeyEnv'\n | 'field.apiKeyEnv.placeholder'\n | 'field.defaultBackend'\n | 'field.defaultParseMethod'\n | 'field.defaultLang'\n | 'field.pollIntervalMs'\n | 'field.pollTimeoutMs'\n | 'field.requestTimeoutMs'\n | 'field.maxMdOutputChars'\n | 'action.save'\n | 'action.saved'\n | 'action.test'\n | 'action.testing'\n | 'test.healthy'\n | 'test.unhealthy'\n | 'test.error'\n | 'backend.pipeline'\n | 'backend.vlm-engine'\n | 'backend.hybrid-engine'\n | 'backend.vlm-http-client'\n | 'backend.hybrid-http-client'\n | 'parse.auto'\n | 'parse.txt'\n | 'parse.ocr'\n\nexport const NS = 'dsh-mineru'\n\nexport const en: Record<MineruKey, string> = {\n 'nav': 'MinerU',\n 'page.title': 'MinerU Configuration',\n 'page.intro': 'Configure the MinerU document parsing server. Changes apply immediately to all mineru_* tools.',\n 'field.baseURL': 'API Base URL',\n 'field.baseURL.placeholder': 'http://your-mineru-host:18000',\n 'field.apiKeyEnv': 'API Key Env Var',\n 'field.apiKeyEnv.placeholder': 'MINERU_API_KEY',\n 'field.defaultBackend': 'Default Backend',\n 'field.defaultParseMethod': 'Default Parse Method',\n 'field.defaultLang': 'Default Language',\n 'field.pollIntervalMs': 'Poll Interval (ms)',\n 'field.pollTimeoutMs': 'Poll Timeout (ms)',\n 'field.requestTimeoutMs': 'Request Timeout (ms)',\n 'field.maxMdOutputChars': 'Max Markdown Output Chars',\n 'action.save': 'Save',\n 'action.saved': 'Saved',\n 'action.test': 'Test Connection',\n 'action.testing': 'Testing…',\n 'test.healthy': 'Healthy',\n 'test.unhealthy': 'Unhealthy',\n 'test.error': 'Connection failed',\n 'backend.pipeline': 'pipeline (no VLM, multi-language)',\n 'backend.vlm-engine': 'vlm-engine (VLM only)',\n 'backend.hybrid-engine': 'hybrid-engine (VLM + pipeline)',\n 'backend.vlm-http-client': 'vlm-http-client',\n 'backend.hybrid-http-client': 'hybrid-http-client',\n 'parse.auto': 'auto',\n 'parse.txt': 'txt (text only, no OCR)',\n 'parse.ocr': 'ocr (force OCR)',\n}\n\nexport const zh: Record<MineruKey, string> = {\n 'nav': 'MinerU',\n 'page.title': 'MinerU 配置',\n 'page.intro': '配置 MinerU 文档解析服务器。修改后立即对所有 mineru_* 工具生效。',\n 'field.baseURL': 'API 地址',\n 'field.baseURL.placeholder': 'http://your-mineru-host:18000',\n 'field.apiKeyEnv': 'API Key 环境变量',\n 'field.apiKeyEnv.placeholder': 'MINERU_API_KEY',\n 'field.defaultBackend': '默认后端',\n 'field.defaultParseMethod': '默认解析方式',\n 'field.defaultLang': '默认语言',\n 'field.pollIntervalMs': '轮询间隔 (ms)',\n 'field.pollTimeoutMs': '轮询超时 (ms)',\n 'field.requestTimeoutMs': '请求超时 (ms)',\n 'field.maxMdOutputChars': 'Markdown 输出字符上限',\n 'action.save': '保存',\n 'action.saved': '已保存',\n 'action.test': '测试连接',\n 'action.testing': '测试中…',\n 'test.healthy': '健康',\n 'test.unhealthy': '异常',\n 'test.error': '连接失败',\n 'backend.pipeline': 'pipeline(无 VLM,多语言)',\n 'backend.vlm-engine': 'vlm-engine(仅 VLM)',\n 'backend.hybrid-engine': 'hybrid-engine(VLM + pipeline)',\n 'backend.vlm-http-client': 'vlm-http-client',\n 'backend.hybrid-http-client': 'hybrid-http-client',\n 'parse.auto': 'auto',\n 'parse.txt': 'txt(仅文本,不 OCR)',\n 'parse.ocr': 'ocr(强制 OCR)',\n}\n","import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'\nimport type {} from '@deepseek-ai/dsh-client-connection/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport { SettingsPage, type MineruSettingsInjected } from './SettingsPage.js'\nimport { en, NS, zh, type MineruKey } from './locales.js'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n 'dsh-mineru': MineruKey\n }\n}\n\nexport const inject = ['slots', 'locale', 'connection']\n\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-mineru: dictionaries')\n\n const connection = ctx.connection as unknown as ConnectionHandle\n const t = ctx.locale.bind(NS) as (key: string) => string\n\n const settingsInjected = (): MineruSettingsInjected => ({\n rpc: connection.rpc,\n t,\n })\n\n ctx.slots.inject('settings.section', () => ctx.slots.register({\n name: 'settings.section',\n id: 'dsh-mineru',\n order: 40,\n label: () => t('nav'),\n inject: settingsInjected,\n }, SettingsPage))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,WAAW;CAAC;CAAY;CAA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,uBAAuB;CACvB,0BAA0B;CAC1B,0BAA0B;CAC1B,eAAe;CACf,gBAAgB;CAChB,eAAe;CACf,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;CAClB,cAAc;CACd,oBAAoB;CACpB,sBAAsB;CACtB,yBAAyB;CACzB,2BAA2B;CAC3B,8BAA8B;CAC9B,cAAc;CACd,aAAa;CACb,aAAa;AACf;;;ACjFA,MAAa,SAAS;CAAC;CAAS;CAAU;AAAY;AAEtD,SAAgB,MAAM,KAA0B;CAC9C,IAAI,aAAa,IAAI,OAAO,SAAS,IAAI;EAAE;EAAI;CAAG,CAAC,GAAG,0BAA0B;CAEhF,MAAM,aAAa,IAAI;CACvB,MAAM,IAAI,IAAI,OAAO,KAAK,EAAE;CAE5B,MAAM,0BAAkD;EACtD,KAAK,WAAW;EAChB;CACF;CAEA,IAAI,MAAM,OAAO,0BAA0B,IAAI,MAAM,SAAS;EAC5D,MAAM;EACN,IAAI;EACJ,OAAO;EACP,aAAa,EAAE,KAAK;EACpB,QAAQ;CACV,GAAG,YAAY,CAAC;AAClB"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["useState","useCallback","css"],"sources":["../src/client/SettingsPage.tsx","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\nimport type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ClientConnectionRpc, RpcResult } from '@deepseek-ai/dsh-client-connection/client'\nimport type { MineruRuntimeConfig } from '../rpc.js'\nimport type { MineruKey } from './locales.js'\nimport css from './SettingsPage.module.css'\n\nexport interface MineruSettingsInjected {\n readonly rpc: ClientConnectionRpc\n readonly t: (key: string) => string\n}\n\ntype SettingsPageProps = PropsRuntime<'settings.section'> & PropsLocale<'dsh-mineru'> & MineruSettingsInjected\n\ntype ConfigGetResult = RpcResult<{ readonly config: MineruRuntimeConfig }>\ntype ConfigSetResult = RpcResult<{ readonly config: MineruRuntimeConfig }>\ntype HealthResult = RpcResult<{ readonly status: string; readonly version?: string; readonly queued_tasks?: number; readonly processing_tasks?: number }>\n\nconst BACKENDS = ['pipeline', 'vlm-engine', 'hybrid-engine', 'vlm-http-client', 'hybrid-http-client'] as const\nconst PARSE_METHODS = ['auto', 'txt', 'ocr'] as const\n\nasync function callRpc<T>(rpc: ClientConnectionRpc, endpoint: string, payload: unknown): Promise<T> {\n return rpc.call('/mineru-api', endpoint, payload) as Promise<T>\n}\n\nexport function SettingsPage({ rpc, t }: SettingsPageProps) {\n const [config, setConfig] = useState<MineruRuntimeConfig | null>(null)\n const [draft, setDraft] = useState<MineruRuntimeConfig | null>(null)\n const [loading, setLoading] = useState(true)\n const [saving, setSaving] = useState(false)\n const [saved, setSaved] = useState(false)\n const [error, setError] = useState<string | undefined>(undefined)\n const [testStatus, setTestStatus] = useState<'idle' | 'testing' | 'healthy' | 'unhealthy' | 'error'>('idle')\n const [testMessage, setTestMessage] = useState<string | undefined>(undefined)\n\n const refresh = useCallback(async () => {\n setLoading(true)\n setError(undefined)\n try {\n const result = await callRpc<ConfigGetResult>(rpc, 'mineru/config.get', {})\n if (result.ok) {\n setConfig(result.value.config)\n setDraft(result.value.config)\n } else {\n setError(result.error.message)\n }\n } catch (err) {\n setError(err instanceof Error ? err.message : String(err))\n } finally {\n setLoading(false)\n }\n }, [rpc])\n\n useEffect(() => { void refresh() }, [refresh])\n\n const save = useCallback(async () => {\n if (draft === null) return\n setSaving(true)\n setError(undefined)\n setSaved(false)\n try {\n const result = await callRpc<ConfigSetResult>(rpc, 'mineru/config.set', { config: draft })\n if (result.ok) {\n setConfig(result.value.config)\n setDraft(result.value.config)\n setSaved(true)\n setTimeout(() => setSaved(false), 2000)\n } else {\n setError(result.error.message)\n }\n } catch (err) {\n setError(err instanceof Error ? err.message : String(err))\n } finally {\n setSaving(false)\n }\n }, [draft, rpc])\n\n const testConnection = useCallback(async () => {\n if (draft === null) return\n setTestStatus('testing')\n setTestMessage(undefined)\n try {\n const result = await callRpc<HealthResult>(rpc, 'mineru/health', {})\n if (result.ok && result.value.status === 'healthy') {\n setTestStatus('healthy')\n const v = result.value.version ? ` v${result.value.version}` : ''\n const q = result.value.queued_tasks !== undefined ? ` (${result.value.queued_tasks} queued)` : ''\n setTestMessage(`${t('test.healthy')}${v}${q}`)\n } else if (result.ok) {\n setTestStatus('unhealthy')\n setTestMessage(t('test.unhealthy'))\n } else {\n setTestStatus('error')\n setTestMessage(result.error.message)\n }\n } catch (err) {\n setTestStatus('error')\n setTestMessage(err instanceof Error ? err.message : String(err))\n }\n }, [draft, rpc, t])\n\n const patch = (p: Partial<MineruRuntimeConfig>): void => {\n setDraft(prev => prev === null ? prev : { ...prev, ...p })\n }\n\n if (loading || draft === null) {\n return (\n <section className={css.section}>\n <h2 className={css.title}>{t('page.title')}</h2>\n <div className={css.loading}>…</div>\n </section>\n )\n }\n\n const dirty = JSON.stringify(draft) !== JSON.stringify(config)\n\n return (\n <section className={css.section}>\n <h2 className={css.title}>{t('page.title')}</h2>\n <p className={css.intro}>{t('page.intro')}</p>\n\n {error !== undefined && (\n <div className={css.error}>\n {error}\n <button type=\"button\" className={css.errorDismiss} onClick={() => setError(undefined)}>×</button>\n </div>\n )}\n\n <div className={css.editor}>\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.baseURL')}</span>\n <input\n className={css.input}\n value={draft.baseURL}\n placeholder={t('field.baseURL.placeholder')}\n onChange={e => patch({ baseURL: e.target.value })}\n />\n </label>\n\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.apiKeyEnv')}</span>\n <input\n className={css.input}\n value={draft.apiKeyEnv}\n placeholder={t('field.apiKeyEnv.placeholder')}\n onChange={e => patch({ apiKeyEnv: e.target.value })}\n />\n </label>\n\n <div className={css.row}>\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.defaultBackend')}</span>\n <select\n className={css.select}\n value={draft.defaultBackend}\n onChange={e => patch({ defaultBackend: e.target.value })}\n >\n {BACKENDS.map(b => (\n <option key={b} value={b}>{t(`backend.${b}` as MineruKey)}</option>\n ))}\n </select>\n </label>\n\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.defaultParseMethod')}</span>\n <select\n className={css.select}\n value={draft.defaultParseMethod}\n onChange={e => patch({ defaultParseMethod: e.target.value })}\n >\n {PARSE_METHODS.map(m => (\n <option key={m} value={m}>{t(`parse.${m}` as MineruKey)}</option>\n ))}\n </select>\n </label>\n </div>\n\n <div className={css.row}>\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.defaultLang')}</span>\n <input\n className={css.input}\n value={draft.defaultLang}\n onChange={e => patch({ defaultLang: e.target.value })}\n />\n </label>\n\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.pollIntervalMs')}</span>\n <input\n type=\"number\"\n className={css.input}\n value={draft.pollIntervalMs}\n onChange={e => patch({ pollIntervalMs: Number(e.target.value) })}\n />\n </label>\n </div>\n\n <div className={css.row}>\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.pollTimeoutMs')}</span>\n <input\n type=\"number\"\n className={css.input}\n value={draft.pollTimeoutMs}\n onChange={e => patch({ pollTimeoutMs: Number(e.target.value) })}\n />\n </label>\n\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.requestTimeoutMs')}</span>\n <input\n type=\"number\"\n className={css.input}\n value={draft.requestTimeoutMs}\n onChange={e => patch({ requestTimeoutMs: Number(e.target.value) })}\n />\n </label>\n </div>\n\n <label className={css.field}>\n <span className={css.fieldLabel}>{t('field.maxMdOutputChars')}</span>\n <input\n type=\"number\"\n className={css.input}\n value={draft.maxMdOutputChars}\n onChange={e => patch({ maxMdOutputChars: Number(e.target.value) })}\n />\n </label>\n </div>\n\n <div className={css.actions}>\n <button\n type=\"button\"\n className={css.primaryButton}\n onClick={() => void save()}\n disabled={!dirty || saving}\n >\n {saving ? '…' : saved ? t('action.saved') : t('action.save')}\n </button>\n <button\n type=\"button\"\n className={css.secondaryButton}\n onClick={() => void testConnection()}\n disabled={testStatus === 'testing'}\n >\n {testStatus === 'testing' ? t('action.testing') : t('action.test')}\n </button>\n {testStatus === 'healthy' && testMessage !== undefined && (\n <span className={css.testOk}>{testMessage}</span>\n )}\n {testStatus === 'unhealthy' && testMessage !== undefined && (\n <span className={css.testWarn}>{testMessage}</span>\n )}\n {testStatus === 'error' && testMessage !== undefined && (\n <span className={css.testErr}>{t('test.error')}: {testMessage}</span>\n )}\n </div>\n </section>\n )\n}\n","export type MineruKey =\n | 'nav'\n | 'page.title'\n | 'page.intro'\n | 'field.baseURL'\n | 'field.baseURL.placeholder'\n | 'field.apiKeyEnv'\n | 'field.apiKeyEnv.placeholder'\n | 'field.defaultBackend'\n | 'field.defaultParseMethod'\n | 'field.defaultLang'\n | 'field.pollIntervalMs'\n | 'field.pollTimeoutMs'\n | 'field.requestTimeoutMs'\n | 'field.maxMdOutputChars'\n | 'action.save'\n | 'action.saved'\n | 'action.test'\n | 'action.testing'\n | 'test.healthy'\n | 'test.unhealthy'\n | 'test.error'\n | 'backend.pipeline'\n | 'backend.vlm-engine'\n | 'backend.hybrid-engine'\n | 'backend.vlm-http-client'\n | 'backend.hybrid-http-client'\n | 'parse.auto'\n | 'parse.txt'\n | 'parse.ocr'\n\nexport const NS = 'dsh-mineru'\n\nexport const en: Record<MineruKey, string> = {\n 'nav': 'MinerU',\n 'page.title': 'MinerU Configuration',\n 'page.intro': 'Configure the MinerU document parsing server. Changes apply immediately to all mineru_* tools.',\n 'field.baseURL': 'API Base URL',\n 'field.baseURL.placeholder': 'http://your-mineru-host:18000',\n 'field.apiKeyEnv': 'API Key Env Var',\n 'field.apiKeyEnv.placeholder': 'MINERU_API_KEY',\n 'field.defaultBackend': 'Default Backend',\n 'field.defaultParseMethod': 'Default Parse Method',\n 'field.defaultLang': 'Default Language',\n 'field.pollIntervalMs': 'Poll Interval (ms)',\n 'field.pollTimeoutMs': 'Poll Timeout (ms)',\n 'field.requestTimeoutMs': 'Request Timeout (ms)',\n 'field.maxMdOutputChars': 'Max Markdown Output Chars',\n 'action.save': 'Save',\n 'action.saved': 'Saved',\n 'action.test': 'Test Connection',\n 'action.testing': 'Testing…',\n 'test.healthy': 'Healthy',\n 'test.unhealthy': 'Unhealthy',\n 'test.error': 'Connection failed',\n 'backend.pipeline': 'pipeline (no VLM, multi-language)',\n 'backend.vlm-engine': 'vlm-engine (VLM only)',\n 'backend.hybrid-engine': 'hybrid-engine (VLM + pipeline)',\n 'backend.vlm-http-client': 'vlm-http-client',\n 'backend.hybrid-http-client': 'hybrid-http-client',\n 'parse.auto': 'auto',\n 'parse.txt': 'txt (text only, no OCR)',\n 'parse.ocr': 'ocr (force OCR)',\n}\n\nexport const zh: Record<MineruKey, string> = {\n 'nav': 'MinerU',\n 'page.title': 'MinerU 配置',\n 'page.intro': '配置 MinerU 文档解析服务器。修改后立即对所有 mineru_* 工具生效。',\n 'field.baseURL': 'API 地址',\n 'field.baseURL.placeholder': 'http://your-mineru-host:18000',\n 'field.apiKeyEnv': 'API Key 环境变量',\n 'field.apiKeyEnv.placeholder': 'MINERU_API_KEY',\n 'field.defaultBackend': '默认后端',\n 'field.defaultParseMethod': '默认解析方式',\n 'field.defaultLang': '默认语言',\n 'field.pollIntervalMs': '轮询间隔 (ms)',\n 'field.pollTimeoutMs': '轮询超时 (ms)',\n 'field.requestTimeoutMs': '请求超时 (ms)',\n 'field.maxMdOutputChars': 'Markdown 输出字符上限',\n 'action.save': '保存',\n 'action.saved': '已保存',\n 'action.test': '测试连接',\n 'action.testing': '测试中…',\n 'test.healthy': '健康',\n 'test.unhealthy': '异常',\n 'test.error': '连接失败',\n 'backend.pipeline': 'pipeline(无 VLM,多语言)',\n 'backend.vlm-engine': 'vlm-engine(仅 VLM)',\n 'backend.hybrid-engine': 'hybrid-engine(VLM + pipeline)',\n 'backend.vlm-http-client': 'vlm-http-client',\n 'backend.hybrid-http-client': 'hybrid-http-client',\n 'parse.auto': 'auto',\n 'parse.txt': 'txt(仅文本,不 OCR)',\n 'parse.ocr': 'ocr(强制 OCR)',\n}\n","import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'\nimport type {} from '@deepseek-ai/dsh-client-connection/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport { SettingsPage, type MineruSettingsInjected } from './SettingsPage.js'\nimport { en, NS, zh, type MineruKey } from './locales.js'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n 'dsh-mineru': MineruKey\n }\n}\n\nexport const inject = ['slots', 'locale', 'connection']\n\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-mineru: dictionaries')\n\n const connection = ctx.connection as unknown as ConnectionHandle\n const t = ctx.locale.bind(NS) as (key: string) => string\n\n const settingsInjected = (): MineruSettingsInjected => ({\n rpc: connection.rpc,\n t,\n })\n\n ctx.slots.inject('settings.section', () => ctx.slots.register({\n name: 'settings.section',\n id: 'dsh-mineru',\n order: 40,\n label: () => t('nav'),\n inject: settingsInjected,\n }, SettingsPage))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBA,MAAM,WAAW;GAAC;GAAY;GAAc;GAAiB;GAAmB;EAAoB;EACpG,MAAM,gBAAgB;GAAC;GAAQ;GAAO;EAAK;EAE3C,eAAe,QAAW,KAA0B,UAAkB,SAA8B;GAClG,OAAO,IAAI,KAAK,eAAe,UAAU,OAAO;EAClD;EAEA,SAAgB,aAAa,EAAE,KAAK,KAAwB;GAC1D,MAAM,CAAC,QAAQ,cAAA,GAAaA,MAAAA,SAAAA,CAAqC,IAAI;GACrE,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAqC,IAAI;GACnE,MAAM,CAAC,SAAS,eAAA,GAAcA,MAAAA,SAAAA,CAAS,IAA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GACzB,2BAA2B;GAC3B,8BAA8B;GAC9B,cAAc;GACd,aAAa;GACb,aAAa;EACf;;;ECjFA,MAAa,SAAS;GAAC;GAAS;GAAU;EAAY;EAEtD,SAAgB,MAAM,KAA0B;GAC9C,IAAI,aAAa,IAAI,OAAO,SAAS,IAAI;IAAE;IAAI;GAAG,CAAC,GAAG,0BAA0B;GAEhF,MAAM,aAAa,IAAI;GACvB,MAAM,IAAI,IAAI,OAAO,KAAK,EAAE;GAE5B,MAAM,0BAAkD;IACtD,KAAK,WAAW;IAChB;GACF;GAEA,IAAI,MAAM,OAAO,0BAA0B,IAAI,MAAM,SAAS;IAC5D,MAAM;IACN,IAAI;IACJ,OAAO;IACP,aAAa,EAAE,KAAK;IACpB,QAAQ;GACV,GAAG,YAAY,CAAC;EAClB"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import z from "schemastery";
|
|
2
|
+
import { Context } from "cordis";
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
declare const name = "dsh-mineru";
|
|
5
|
+
declare const inject: string[];
|
|
6
|
+
type MineruBackend = 'pipeline' | 'vlm-engine' | 'hybrid-engine' | 'vlm-http-client' | 'hybrid-http-client';
|
|
7
|
+
type MineruParseMethod = 'auto' | 'txt' | 'ocr';
|
|
8
|
+
interface Config {
|
|
9
|
+
baseURL: string;
|
|
10
|
+
apiKeyEnv?: string;
|
|
11
|
+
defaultBackend?: MineruBackend;
|
|
12
|
+
defaultParseMethod?: MineruParseMethod;
|
|
13
|
+
defaultLang?: string;
|
|
14
|
+
pollIntervalMs?: number;
|
|
15
|
+
pollTimeoutMs?: number;
|
|
16
|
+
requestTimeoutMs?: number;
|
|
17
|
+
maxMdOutputChars?: number;
|
|
18
|
+
}
|
|
19
|
+
declare const Config: z<Config>;
|
|
20
|
+
declare function apply(ctx: Context, config?: Config): void;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Config, MineruBackend, MineruParseMethod, apply, inject, name };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huanlin/dsh-plugin-mineru",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -45,8 +45,7 @@
|
|
|
45
45
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
46
46
|
"test": "vitest run",
|
|
47
47
|
"test:watch": "vitest",
|
|
48
|
-
"build": "tsdown --config tsdown.config.ts"
|
|
49
|
-
"prepare": "tsdown --config tsdown.prepare.config.ts"
|
|
48
|
+
"build": "tsdown --config tsdown.config.ts"
|
|
50
49
|
},
|
|
51
50
|
"dependencies": {
|
|
52
51
|
"schemastery": "^3.18.0"
|