@lemoncat7/dsh-knowledge 1.0.2 → 1.0.10
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 +5 -2
- package/docs/architecture.md +3 -3
- package/docs/requirements.md +3 -1
- package/lib/api.js +14 -1
- package/lib/api.js.map +1 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +123 -94
- package/lib/client.js.map +4 -4
- package/lib/documents/markdown.d.ts +4 -1
- package/lib/documents/markdown.d.ts.map +1 -1
- package/lib/documents/markdown.js +11 -1
- package/lib/documents/markdown.js.map +1 -1
- package/lib/domain.d.ts +12 -1
- package/lib/domain.d.ts.map +1 -1
- package/lib/domain.js +1 -0
- package/lib/domain.js.map +1 -1
- package/lib/extraction.d.ts.map +1 -1
- package/lib/extraction.js +25 -3
- package/lib/extraction.js.map +1 -1
- package/lib/local-provider.d.ts +3 -0
- package/lib/local-provider.d.ts.map +1 -1
- package/lib/local-provider.js +157 -11
- package/lib/local-provider.js.map +1 -1
- package/lib/provider.d.ts +2 -0
- package/lib/provider.d.ts.map +1 -1
- package/lib/remote-provider.d.ts +2 -0
- package/lib/remote-provider.d.ts.map +1 -1
- package/lib/remote-provider.js +8 -0
- package/lib/remote-provider.js.map +1 -1
- package/lib/retrieval.d.ts +1 -1
- package/lib/retrieval.d.ts.map +1 -1
- package/lib/retrieval.js +8 -22
- package/lib/retrieval.js.map +1 -1
- package/lib/theme-bridge.js +4 -4
- package/lib/theme-bridge.js.map +1 -1
- package/lib/tools.d.ts.map +1 -1
- package/lib/tools.js +5 -3
- package/lib/tools.js.map +1 -1
- package/package.json +2 -1
- package/web/app.js +94 -14
- package/web/styles.css +20 -1
package/lib/client.js
CHANGED
|
@@ -25,11 +25,32 @@ __export(client_exports, {
|
|
|
25
25
|
inject: () => inject
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(client_exports);
|
|
28
|
+
var import_react2 = require("react");
|
|
29
|
+
|
|
30
|
+
// node_modules/@lemoncat7/dsh-plugin-ui/lib/index.js
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
32
|
var import_react = require("react");
|
|
33
|
+
var PLUGIN_WORKSPACE_ACTIVATE_EVENT = "@lemoncat7/dsh-plugin-ui/workspace-activate";
|
|
34
|
+
function activatePluginWorkspace(pluginId) {
|
|
35
|
+
window.dispatchEvent(new CustomEvent(PLUGIN_WORKSPACE_ACTIVATE_EVENT, {
|
|
36
|
+
detail: { pluginId }
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
function observePluginWorkspace(pluginId, close) {
|
|
40
|
+
const onActivate = (event) => {
|
|
41
|
+
const detail = event.detail;
|
|
42
|
+
if (detail?.pluginId !== pluginId)
|
|
43
|
+
close();
|
|
44
|
+
};
|
|
45
|
+
window.addEventListener(PLUGIN_WORKSPACE_ACTIVATE_EVENT, onActivate);
|
|
46
|
+
return () => window.removeEventListener(PLUGIN_WORKSPACE_ACTIVATE_EVENT, onActivate);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/client.tsx
|
|
29
50
|
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
30
51
|
|
|
31
52
|
// src/client.css
|
|
32
|
-
var client_default = ".dsh-knowledge-trigger {\n flex: none;\n display: flex;\n align-items: center;\n gap: 8px;\n width: calc(100% + 8px);\n height: 34px;\n margin: 4px -4px;\n padding: 6px 2px 6px 10px;\n box-sizing: border-box;\n border: 0;\n border-radius: 12px;\n overflow: hidden;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n font: inherit;\n font-size: 14px;\n line-height: 22px;\n white-space: nowrap;\n}\n\n.dsh-knowledge-trigger:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.dsh-knowledge-trigger.is-active {\n background: var(--dsw-alias-interactive-bg-selected, var(--dsw-alias-interactive-bg-hover));\n color: var(--dsw-alias-interactive-primary, currentColor);\n}\n\n.dsh-knowledge-trigger--rail {\n width: 36px;\n height: 36px;\n margin: 8px 0 4px;\n padding: 0;\n justify-content: center;\n gap: 0;\n border-radius: 50%;\n}\n\n.dsh-knowledge-workspace {\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: var(--
|
|
53
|
+
var client_default = ".dsh-knowledge-trigger {\n flex: none;\n display: flex;\n align-items: center;\n gap: 8px;\n width: calc(100% + 8px);\n height: 34px;\n margin: 4px -4px;\n padding: 6px 2px 6px 10px;\n box-sizing: border-box;\n border: 0;\n border-radius: 12px;\n overflow: hidden;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n font: inherit;\n font-size: 14px;\n line-height: 22px;\n white-space: nowrap;\n}\n\n.dsh-knowledge-trigger:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.dsh-knowledge-trigger.is-active {\n background: var(--dsw-alias-interactive-bg-selected, var(--dsw-alias-interactive-bg-hover));\n color: var(--dsw-alias-interactive-primary, currentColor);\n}\n\n.dsh-knowledge-trigger--rail {\n width: 36px;\n height: 36px;\n margin: 8px 0 4px;\n padding: 0;\n justify-content: center;\n gap: 0;\n border-radius: 50%;\n}\n\n.dsh-knowledge-workspace {\n --knowledge-pane: var(--xiaohei-plugin-pane-fill, transparent);\n --knowledge-raised: var(--xiaohei-plugin-raised-fill, var(--dsw-alias-bg-layer-2, #fff));\n --knowledge-control: var(--xiaohei-plugin-control-fill, var(--dsw-alias-bg-layer-1, #fff));\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: var(--knowledge-pane);\n}\n\n.dsh-knowledge-workspace-header {\n flex: none;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n min-height: 56px;\n padding: 8px 16px 8px 20px;\n box-sizing: border-box;\n border-bottom: 1px solid var(--dsw-alias-divider-primary, rgba(128, 128, 128, .18));\n background: var(--knowledge-pane);\n}\n\n.dsh-knowledge-workspace-header > div {\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: 0;\n}\n\n.dsh-knowledge-workspace-header > div > span {\n display: grid;\n min-width: 0;\n gap: 2px;\n}\n\n.dsh-knowledge-workspace-header h2,\n.dsh-knowledge-workspace-header p {\n margin: 0;\n}\n\n.dsh-knowledge-workspace-header h2 {\n color: var(--dsw-alias-label-primary);\n font-size: 15px;\n line-height: 22px;\n font-weight: 600;\n}\n\n.dsh-knowledge-workspace-header p {\n color: var(--dsw-alias-label-secondary);\n font-size: 11px;\n line-height: 16px;\n}\n\n.dsh-knowledge-frame {\n flex: 1;\n width: 100%;\n min-height: 0;\n border: 0;\n background: transparent;\n}\n\n.dsh-knowledge-panel-state {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 16px;\n min-height: 0;\n padding: 32px;\n box-sizing: border-box;\n background: transparent;\n color: var(--dsw-alias-label-primary, #171719);\n}\n\n.dsh-knowledge-panel-state-icon {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n border-radius: 12px;\n background: var(--dsw-alias-interactive-bg-hover, rgba(128, 128, 128, .1));\n color: var(--dsw-alias-label-secondary, #68686f);\n font-size: 18px;\n font-weight: 600;\n}\n\n.dsh-knowledge-panel-state > div { max-width: 560px; }\n.dsh-knowledge-panel-state h3 { margin: 0 0 6px; font-size: 17px; line-height: 24px; font-weight: 600; }\n.dsh-knowledge-panel-state p { margin: 0; color: var(--dsw-alias-label-secondary, #68686f); font-size: 13px; line-height: 20px; }\n.dsh-knowledge-panel-state button {\n min-width: 72px;\n min-height: 32px;\n margin-top: 16px;\n padding: 6px 14px;\n border: 0;\n border-radius: 10px;\n background: var(--dsw-alias-interactive-primary, #335cff);\n color: #fff;\n cursor: pointer;\n font: inherit;\n}\n.dsh-knowledge-panel-state button:focus-visible {\n outline: 2px solid var(--dsw-alias-interactive-primary, #335cff);\n outline-offset: 2px;\n}\n\n.dsh-knowledge-settings-card {\n list-style: none;\n overflow: hidden;\n border: 1px solid var(--dsw-alias-divider-primary, rgba(128, 128, 128, .18));\n border-radius: 18px;\n background: var(--xiaohei-plugin-raised-fill, var(--dsw-alias-bg-layer-2, #fff));\n color: var(--dsw-alias-label-primary, #171719);\n}\n\n.dsh-knowledge-settings-card--open {\n box-shadow: 0 10px 32px rgba(0, 0, 0, .07);\n}\n\n.dsh-knowledge-settings-header {\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: space-between;\n gap: 20px;\n padding: 18px 20px;\n border: 0;\n background: transparent;\n color: inherit;\n text-align: left;\n cursor: pointer;\n}\n\n.dsh-knowledge-settings-header:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(128, 128, 128, .08)); }\n.dsh-knowledge-settings-header:focus-visible,\n.dsh-knowledge-settings-actions button:focus-visible,\n.dsh-knowledge-settings-load-error button:focus-visible {\n outline: 2px solid var(--dsw-alias-interactive-primary, #335cff);\n outline-offset: 2px;\n}\n.dsh-knowledge-settings-header > span:first-child { display: grid; gap: 3px; }\n.dsh-knowledge-settings-header strong { font-size: 15px; font-weight: 600; }\n.dsh-knowledge-settings-header small,\n.dsh-knowledge-source-picker small,\n.dsh-knowledge-remote-fields small { color: var(--dsw-alias-label-secondary, #68686f); font-size: 12px; }\n.dsh-knowledge-settings-summary { flex: none; color: var(--dsw-alias-label-secondary, #68686f); font-size: 12px; }\n\n.dsh-knowledge-settings-body {\n display: grid;\n gap: 18px;\n padding: 4px 20px 20px;\n border-top: 1px solid var(--dsw-alias-divider-primary, rgba(128, 128, 128, .14));\n}\n\n.dsh-knowledge-source-picker {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 10px;\n margin: 18px 0 0;\n padding: 0;\n border: 0;\n}\n\n.dsh-knowledge-source-picker legend { margin-bottom: 8px; font-size: 13px; font-weight: 600; }\n.dsh-knowledge-source-picker label {\n display: flex;\n gap: 10px;\n padding: 13px;\n border: 1px solid var(--dsw-alias-divider-primary, rgba(128, 128, 128, .2));\n border-radius: 14px;\n cursor: pointer;\n}\n.dsh-knowledge-source-picker label.is-selected {\n border-color: var(--dsw-alias-interactive-primary, #335cff);\n background: color-mix(in srgb, var(--dsw-alias-interactive-primary, #335cff) 7%, transparent);\n}\n.dsh-knowledge-source-picker label.is-disabled {\n cursor: default;\n opacity: .55;\n}\n.dsh-knowledge-source-picker label:focus-within {\n outline: 2px solid var(--dsw-alias-interactive-primary, #335cff);\n outline-offset: 2px;\n}\n.dsh-knowledge-source-picker input { margin-top: 2px; accent-color: var(--dsw-alias-interactive-primary, #335cff); }\n.dsh-knowledge-source-picker span { display: grid; gap: 3px; }\n\n.dsh-knowledge-remote-fields { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; }\n.dsh-knowledge-remote-fields label,\n.dsh-knowledge-timeout-field { display: grid; gap: 6px; color: var(--dsw-alias-label-secondary, #68686f); font-size: 12px; }\n.dsh-knowledge-remote-fields input,\n.dsh-knowledge-timeout-field input {\n min-height: 38px;\n box-sizing: border-box;\n padding: 8px 11px;\n border: 1px solid var(--dsw-alias-divider-primary, rgba(128, 128, 128, .25));\n border-radius: 10px;\n outline: none;\n background: var(--xiaohei-plugin-control-fill, var(--dsw-alias-bg-layer-1, #fff));\n color: var(--dsw-alias-label-primary, #171719);\n font: inherit;\n}\n.dsh-knowledge-remote-fields input:focus,\n.dsh-knowledge-timeout-field input:focus { border-color: var(--dsw-alias-interactive-primary, #335cff); box-shadow: 0 0 0 3px rgba(51, 92, 255, .12); }\n.dsh-knowledge-timeout-field { max-width: 240px; }\n.dsh-knowledge-field-error { color: #c9362b !important; }\n\n.dsh-knowledge-settings-message,\n.dsh-knowledge-settings-note { margin: 0; color: var(--dsw-alias-label-secondary, #68686f); font-size: 12px; }\n.dsh-knowledge-settings-message.is-success { color: #15803d; }\n.dsh-knowledge-settings-message.is-error { color: #c9362b; }\n.dsh-knowledge-settings-load-error {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n margin-top: 18px;\n padding: 12px 14px;\n border-radius: 12px;\n background: color-mix(in srgb, #c9362b 8%, transparent);\n color: #c9362b;\n font-size: 13px;\n}\n.dsh-knowledge-settings-load-error p { margin: 0; }\n.dsh-knowledge-settings-load-error button {\n flex: none;\n min-height: 30px;\n padding: 5px 10px;\n border: 0;\n border-radius: 9px;\n background: var(--xiaohei-plugin-control-fill, var(--dsw-alias-bg-layer-2, #fff));\n color: var(--dsw-alias-label-primary, #171719);\n cursor: pointer;\n font: inherit;\n}\n.dsh-knowledge-settings-actions { display: flex; justify-content: flex-end; gap: 8px; }\n.dsh-knowledge-settings-actions button {\n min-height: 34px;\n padding: 7px 13px;\n border: 0;\n border-radius: 10px;\n background: var(--dsw-alias-interactive-bg-hover, rgba(128, 128, 128, .1));\n color: var(--dsw-alias-label-primary, #171719);\n cursor: pointer;\n font: inherit;\n font-size: 13px;\n}\n.dsh-knowledge-settings-actions button.is-primary { background: var(--dsw-alias-interactive-primary, #335cff); color: #fff; }\n.dsh-knowledge-settings-actions button:disabled { cursor: default; opacity: .45; }\n\n@media (max-width: 720px) {\n .dsh-knowledge-source-picker,\n .dsh-knowledge-remote-fields { grid-template-columns: 1fr; }\n}\n\n.dsh-knowledge-writeback-status {\n display: flex;\n align-items: center;\n gap: 8px;\n min-width: 0;\n color: var(--dsw-alias-label-tertiary, #6b7280);\n font-size: 12px;\n line-height: 1.5;\n}\n.dsh-knowledge-writeback-status strong {\n color: var(--dsw-alias-label-secondary, #374151);\n font-weight: 600;\n}\n";
|
|
33
54
|
|
|
34
55
|
// src/constants.ts
|
|
35
56
|
var KNOWLEDGE_SETTINGS_NAMESPACE = "dsh-knowledge-connection";
|
|
@@ -39,10 +60,10 @@ var KNOWLEDGE_THEME_MESSAGE = "@lemoncat7/dsh-knowledge/host-theme";
|
|
|
39
60
|
var KNOWLEDGE_THEME_READY_MESSAGE = "@lemoncat7/dsh-knowledge/host-theme-ready";
|
|
40
61
|
var KNOWLEDGE_THEME_PROTOCOL_VERSION = 1;
|
|
41
62
|
var TOKEN_SOURCES = {
|
|
42
|
-
"--bg": ["--dsw-alias-bg-layer-1", "--dsw-alias-bg-base"],
|
|
43
|
-
"--surface": ["--dsw-alias-bg-layer-2", "--dsw-alias-bg-layer-1"],
|
|
44
|
-
"--surface-raised": ["--dsw-alias-bg-layer-3", "--dsw-alias-bg-overlay", "--dsw-alias-bg-layer-2"],
|
|
45
|
-
"--surface-soft": ["--dsw-alias-bg-module-platform", "--dsw-alias-bg-layer-3", "--dsw-alias-bg-layer-2"],
|
|
63
|
+
"--bg": ["--xiaohei-plugin-workspace-fill", "--dsw-alias-bg-layer-1", "--dsw-alias-bg-base"],
|
|
64
|
+
"--surface": ["--xiaohei-plugin-pane-fill", "--dsw-alias-bg-layer-2", "--dsw-alias-bg-layer-1"],
|
|
65
|
+
"--surface-raised": ["--xiaohei-plugin-raised-fill", "--dsw-alias-bg-layer-3", "--dsw-alias-bg-overlay", "--dsw-alias-bg-layer-2"],
|
|
66
|
+
"--surface-soft": ["--xiaohei-plugin-control-fill", "--dsw-alias-bg-module-platform", "--dsw-alias-bg-layer-3", "--dsw-alias-bg-layer-2"],
|
|
46
67
|
"--surface-hover": ["--dsw-alias-interactive-bg-hover", "--dsw-alias-bg-layer-3"],
|
|
47
68
|
"--text": ["--dsw-alias-label-primary"],
|
|
48
69
|
"--text-secondary": ["--dsw-alias-label-secondary", "--dsw-alias-label-primary-dimmed"],
|
|
@@ -133,7 +154,7 @@ function firstDefinedToken(computed, snapshotTokens, sources) {
|
|
|
133
154
|
}
|
|
134
155
|
|
|
135
156
|
// src/client.tsx
|
|
136
|
-
var
|
|
157
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
137
158
|
var PLUGIN_ID = "@lemoncat7/dsh-knowledge";
|
|
138
159
|
var STYLE_ID = `${PLUGIN_ID}/client`;
|
|
139
160
|
var CONNECTION_CONTROL_PATH = "/knowledge-control/v1/connection";
|
|
@@ -141,6 +162,7 @@ var inject = ["slots", "theme"];
|
|
|
141
162
|
function apply(ctx) {
|
|
142
163
|
ctx.effect(installStyles, "dsh-knowledge: client styles");
|
|
143
164
|
const workspace = createKnowledgeWorkspaceController(ctx);
|
|
165
|
+
ctx.effect(() => observePluginWorkspace(PLUGIN_ID, workspace.close), "dsh-knowledge: exclusive workspace");
|
|
144
166
|
ctx.effect(() => () => {
|
|
145
167
|
workspace.close();
|
|
146
168
|
}, "dsh-knowledge: workspace lifecycle");
|
|
@@ -148,7 +170,7 @@ function apply(ctx) {
|
|
|
148
170
|
name: "sidebar.footer.action",
|
|
149
171
|
id: "knowledge",
|
|
150
172
|
order: -10
|
|
151
|
-
}, (props) => /* @__PURE__ */ (0,
|
|
173
|
+
}, (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(KnowledgeLauncher, { ...props, workspace })));
|
|
152
174
|
ctx.slots.inject("settings.plugin.item", () => ctx.slots.register({
|
|
153
175
|
name: "settings.plugin.item",
|
|
154
176
|
key: KNOWLEDGE_SETTINGS_NAMESPACE
|
|
@@ -156,11 +178,11 @@ function apply(ctx) {
|
|
|
156
178
|
ctx.slots.inject("conversation.chat.turnTail", () => ctx.slots.register({
|
|
157
179
|
name: "conversation.chat.turnTail",
|
|
158
180
|
select: (owner) => ({ turn: owner.turn.turn })
|
|
159
|
-
}, (props) => /* @__PURE__ */ (0,
|
|
181
|
+
}, (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(KnowledgeWritebackStatus, { sessionId: String(props.sessionId), turn: props.matched.turn })));
|
|
160
182
|
}
|
|
161
183
|
function KnowledgeWritebackStatus({ sessionId, turn }) {
|
|
162
|
-
const [summary, setSummary] = (0,
|
|
163
|
-
(0,
|
|
184
|
+
const [summary, setSummary] = (0, import_react2.useState)();
|
|
185
|
+
(0, import_react2.useEffect)(() => {
|
|
164
186
|
const controller = new AbortController();
|
|
165
187
|
void fetch(`/knowledge-control/v1/writeback-status?sessionId=${encodeURIComponent(sessionId)}&turn=${turn}`, {
|
|
166
188
|
headers: { accept: "application/json" },
|
|
@@ -174,10 +196,10 @@ function KnowledgeWritebackStatus({ sessionId, turn }) {
|
|
|
174
196
|
};
|
|
175
197
|
}, [sessionId, turn]);
|
|
176
198
|
if (summary === void 0) return null;
|
|
177
|
-
return /* @__PURE__ */ (0,
|
|
178
|
-
/* @__PURE__ */ (0,
|
|
179
|
-
/* @__PURE__ */ (0,
|
|
180
|
-
/* @__PURE__ */ (0,
|
|
199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsh-knowledge-writeback-status", children: [
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u4E0A\u4E0B\u6587\u6CE8\u5165" }),
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: "dsh-knowledge" }),
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: summary })
|
|
181
203
|
] });
|
|
182
204
|
}
|
|
183
205
|
function createKnowledgeWorkspaceController(client) {
|
|
@@ -193,11 +215,12 @@ function createKnowledgeWorkspaceController(client) {
|
|
|
193
215
|
dispose();
|
|
194
216
|
notify();
|
|
195
217
|
};
|
|
196
|
-
|
|
218
|
+
const controller = {
|
|
197
219
|
isOpen: () => disposeWorkspace !== void 0,
|
|
198
220
|
toggle: () => {
|
|
199
221
|
if (disposeWorkspace !== void 0) return close();
|
|
200
|
-
|
|
222
|
+
activatePluginWorkspace(PLUGIN_ID);
|
|
223
|
+
const dispose = client.slots.register({ name: "conversation", priority: -1 }, (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(KnowledgeWorkspace, { ...props, client, workspace: controller }));
|
|
201
224
|
disposeWorkspace = dispose;
|
|
202
225
|
notify();
|
|
203
226
|
},
|
|
@@ -209,20 +232,21 @@ function createKnowledgeWorkspaceController(client) {
|
|
|
209
232
|
};
|
|
210
233
|
}
|
|
211
234
|
};
|
|
235
|
+
return controller;
|
|
212
236
|
}
|
|
213
237
|
function KnowledgeConnectionCard() {
|
|
214
|
-
const [current, setCurrent] = (0,
|
|
215
|
-
const [loadState, setLoadState] = (0,
|
|
216
|
-
const [loadError, setLoadError] = (0,
|
|
217
|
-
const [open, setOpen] = (0,
|
|
218
|
-
const [backend, setBackend] = (0,
|
|
219
|
-
const [remoteUrl, setRemoteUrl] = (0,
|
|
220
|
-
const [remoteToken, setRemoteToken] = (0,
|
|
221
|
-
const [timeout, setTimeoutValue] = (0,
|
|
222
|
-
const [dirty, setDirty] = (0,
|
|
223
|
-
const [saving, setSaving] = (0,
|
|
224
|
-
const [message, setMessage] = (0,
|
|
225
|
-
const load = (0,
|
|
238
|
+
const [current, setCurrent] = (0, import_react2.useState)();
|
|
239
|
+
const [loadState, setLoadState] = (0, import_react2.useState)("loading");
|
|
240
|
+
const [loadError, setLoadError] = (0, import_react2.useState)("");
|
|
241
|
+
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
242
|
+
const [backend, setBackend] = (0, import_react2.useState)("local");
|
|
243
|
+
const [remoteUrl, setRemoteUrl] = (0, import_react2.useState)("");
|
|
244
|
+
const [remoteToken, setRemoteToken] = (0, import_react2.useState)("");
|
|
245
|
+
const [timeout, setTimeoutValue] = (0, import_react2.useState)("10000");
|
|
246
|
+
const [dirty, setDirty] = (0, import_react2.useState)(false);
|
|
247
|
+
const [saving, setSaving] = (0, import_react2.useState)(false);
|
|
248
|
+
const [message, setMessage] = (0, import_react2.useState)();
|
|
249
|
+
const load = (0, import_react2.useCallback)(async (signal) => {
|
|
226
250
|
setLoadState("loading");
|
|
227
251
|
setLoadError("");
|
|
228
252
|
try {
|
|
@@ -235,14 +259,14 @@ function KnowledgeConnectionCard() {
|
|
|
235
259
|
setLoadState("error");
|
|
236
260
|
}
|
|
237
261
|
}, []);
|
|
238
|
-
(0,
|
|
262
|
+
(0, import_react2.useEffect)(() => {
|
|
239
263
|
const controller = new AbortController();
|
|
240
264
|
void load(controller.signal);
|
|
241
265
|
return () => {
|
|
242
266
|
controller.abort();
|
|
243
267
|
};
|
|
244
268
|
}, [load]);
|
|
245
|
-
(0,
|
|
269
|
+
(0, import_react2.useEffect)(() => {
|
|
246
270
|
if (dirty || current === void 0) return;
|
|
247
271
|
setBackend(current.backend);
|
|
248
272
|
setRemoteUrl(current.remoteUrl ?? "");
|
|
@@ -290,76 +314,76 @@ function KnowledgeConnectionCard() {
|
|
|
290
314
|
setSaving(false);
|
|
291
315
|
}
|
|
292
316
|
};
|
|
293
|
-
return /* @__PURE__ */ (0,
|
|
294
|
-
/* @__PURE__ */ (0,
|
|
317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { className: `dsh-knowledge-settings-card${open ? " dsh-knowledge-settings-card--open" : ""}`, children: [
|
|
318
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { type: "button", className: "dsh-knowledge-settings-header", "aria-expanded": open, onClick: () => {
|
|
295
319
|
setOpen((value) => !value);
|
|
296
320
|
}, children: [
|
|
297
|
-
/* @__PURE__ */ (0,
|
|
298
|
-
/* @__PURE__ */ (0,
|
|
299
|
-
/* @__PURE__ */ (0,
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: "\u77E5\u8BC6\u5E93\u8FDE\u63A5" }),
|
|
323
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: "\u9009\u62E9\u672C\u673A\u77E5\u8BC6\u5E93\uFF0C\u6216\u8FDE\u63A5\u4E00\u53F0\u4E2D\u592E DSH \u77E5\u8BC6\u5E93" })
|
|
300
324
|
] }),
|
|
301
|
-
/* @__PURE__ */ (0,
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dsh-knowledge-settings-summary", children: [
|
|
302
326
|
loadState === "loading" ? "\u8BFB\u53D6\u4E2D" : loadState === "error" ? "\u8FDE\u63A5\u5165\u53E3" : current?.backend === "remote" ? "\u8FDC\u7A0B" : "\u672C\u5730",
|
|
303
327
|
" \xB7 ",
|
|
304
328
|
open ? "\u6536\u8D77" : "\u8BBE\u7F6E"
|
|
305
329
|
] })
|
|
306
330
|
] }),
|
|
307
|
-
open && /* @__PURE__ */ (0,
|
|
308
|
-
/* @__PURE__ */ (0,
|
|
309
|
-
/* @__PURE__ */ (0,
|
|
331
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-knowledge-settings-body", children: loadState === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsh-knowledge-settings-note", role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u8FDE\u63A5\u914D\u7F6E\u2026" }) : loadState === "error" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsh-knowledge-settings-load-error", role: "alert", children: [
|
|
332
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: loadError }),
|
|
333
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: () => {
|
|
310
334
|
void load();
|
|
311
335
|
}, children: "\u91CD\u65B0\u8BFB\u53D6" })
|
|
312
|
-
] }) : /* @__PURE__ */ (0,
|
|
313
|
-
/* @__PURE__ */ (0,
|
|
314
|
-
/* @__PURE__ */ (0,
|
|
315
|
-
/* @__PURE__ */ (0,
|
|
316
|
-
/* @__PURE__ */ (0,
|
|
336
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
337
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("fieldset", { className: "dsh-knowledge-source-picker", children: [
|
|
338
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("legend", { children: "\u77E5\u8BC6\u5E93\u6765\u6E90" }),
|
|
339
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: backend === "local" ? "is-selected" : "", children: [
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { type: "radio", name: "dsh-knowledge-backend", checked: backend === "local", onChange: () => edit(() => {
|
|
317
341
|
setBackend("local");
|
|
318
342
|
}) }),
|
|
319
|
-
/* @__PURE__ */ (0,
|
|
320
|
-
/* @__PURE__ */ (0,
|
|
321
|
-
/* @__PURE__ */ (0,
|
|
343
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: "\u672C\u5730" }),
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: "\u6570\u636E\u4FDD\u5B58\u5728\u5F53\u524D DSH \u7684 SQLite \u4E2D" })
|
|
322
346
|
] })
|
|
323
347
|
] }),
|
|
324
|
-
/* @__PURE__ */ (0,
|
|
325
|
-
/* @__PURE__ */ (0,
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: `${backend === "remote" ? "is-selected" : ""}${!current?.canSwitchRemote ? " is-disabled" : ""}`, children: [
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { type: "radio", name: "dsh-knowledge-backend", checked: backend === "remote", disabled: !current?.canSwitchRemote, onChange: () => edit(() => {
|
|
326
350
|
setBackend("remote");
|
|
327
351
|
}) }),
|
|
328
|
-
/* @__PURE__ */ (0,
|
|
329
|
-
/* @__PURE__ */ (0,
|
|
330
|
-
/* @__PURE__ */ (0,
|
|
352
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
353
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: "\u8FDC\u7A0B" }),
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: "\u53EC\u56DE\u548C\u56DE\u5199\u7EDF\u4E00\u4F7F\u7528\u4E2D\u592E\u77E5\u8BC6\u5E93" })
|
|
331
355
|
] })
|
|
332
356
|
] })
|
|
333
357
|
] }),
|
|
334
|
-
!current?.canSwitchRemote && /* @__PURE__ */ (0,
|
|
335
|
-
backend === "remote" && /* @__PURE__ */ (0,
|
|
336
|
-
/* @__PURE__ */ (0,
|
|
358
|
+
!current?.canSwitchRemote && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsh-knowledge-settings-note", children: "\u5F53\u524D\u5B9E\u4F8B\u662F\u4E2D\u592E\u77E5\u8BC6\u5E93\u670D\u52A1\uFF0C\u4E0D\u80FD\u518D\u5207\u6362\u5230\u53E6\u4E00\u53F0\u8FDC\u7A0B\u670D\u52A1\u3002" }),
|
|
359
|
+
backend === "remote" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsh-knowledge-remote-fields", children: [
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { htmlFor: "dsh-knowledge-remote-url", children: [
|
|
337
361
|
"\u670D\u52A1\u5668\u5730\u5740",
|
|
338
|
-
/* @__PURE__ */ (0,
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { id: "dsh-knowledge-remote-url", type: "url", value: remoteUrl, placeholder: "https://example.com/knowledge-api/v1", autoComplete: "url", onChange: (event) => edit(() => {
|
|
339
363
|
setRemoteUrl(event.target.value);
|
|
340
364
|
}), "aria-invalid": urlError !== void 0, "aria-describedby": urlError ? "dsh-knowledge-url-error" : void 0 }),
|
|
341
|
-
urlError && /* @__PURE__ */ (0,
|
|
365
|
+
urlError && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { id: "dsh-knowledge-url-error", className: "dsh-knowledge-field-error", children: urlError })
|
|
342
366
|
] }),
|
|
343
|
-
/* @__PURE__ */ (0,
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { htmlFor: "dsh-knowledge-remote-token", children: [
|
|
344
368
|
"\u5BA2\u6237\u7AEF\u4EE4\u724C",
|
|
345
|
-
/* @__PURE__ */ (0,
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { id: "dsh-knowledge-remote-token", type: "password", value: remoteToken, placeholder: current?.tokenConfigured ? "\u5DF2\u4FDD\u5B58\uFF1B\u7559\u7A7A\u5219\u4FDD\u6301\u4E0D\u53D8" : "\u7C98\u8D34\u5BA2\u6237\u7AEF\u4EE4\u724C", autoComplete: "new-password", onChange: (event) => edit(() => {
|
|
346
370
|
setRemoteToken(event.target.value);
|
|
347
371
|
}), "aria-invalid": tokenError !== void 0, "aria-describedby": "dsh-knowledge-token-help" }),
|
|
348
|
-
/* @__PURE__ */ (0,
|
|
372
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { id: "dsh-knowledge-token-help", className: tokenError ? "dsh-knowledge-field-error" : void 0, children: tokenError ?? (current?.tokenConfigured ? "\u4EE4\u724C\u5DF2\u5B89\u5168\u4FDD\u5B58\uFF0C\u9875\u9762\u65E0\u6CD5\u8BFB\u53D6\uFF1B\u8F93\u5165\u65B0\u4EE4\u724C\u53EF\u8986\u76D6\u3002" : "\u4EE4\u724C\u4FDD\u5B58\u540E\u4E0D\u53EF\u8BFB\u53D6\uFF0C\u53EA\u80FD\u8986\u76D6\u3002") })
|
|
349
373
|
] })
|
|
350
374
|
] }),
|
|
351
|
-
/* @__PURE__ */ (0,
|
|
375
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "dsh-knowledge-timeout-field", htmlFor: "dsh-knowledge-timeout", children: [
|
|
352
376
|
"\u8BF7\u6C42\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
|
|
353
|
-
/* @__PURE__ */ (0,
|
|
377
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { id: "dsh-knowledge-timeout", type: "number", min: "100", max: "120000", step: "100", value: timeout, onChange: (event) => edit(() => {
|
|
354
378
|
setTimeoutValue(event.target.value);
|
|
355
379
|
}), "aria-invalid": timeoutError !== void 0 }),
|
|
356
|
-
timeoutError && /* @__PURE__ */ (0,
|
|
380
|
+
timeoutError && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { className: "dsh-knowledge-field-error", children: timeoutError })
|
|
357
381
|
] }),
|
|
358
|
-
!current?.writable && /* @__PURE__ */ (0,
|
|
359
|
-
message && /* @__PURE__ */ (0,
|
|
360
|
-
/* @__PURE__ */ (0,
|
|
361
|
-
/* @__PURE__ */ (0,
|
|
362
|
-
/* @__PURE__ */ (0,
|
|
382
|
+
!current?.writable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsh-knowledge-settings-note", children: "\u5F53\u524D\u63D2\u4EF6\u6CA1\u6709\u914D\u7F6E\u6301\u4E45\u5316\u8DEF\u5F84\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u8FDE\u63A5\u3002" }),
|
|
383
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: `dsh-knowledge-settings-message is-${message.kind}`, role: message.kind === "error" ? "alert" : "status", "aria-live": "polite", children: message.text }),
|
|
384
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsh-knowledge-settings-actions", children: [
|
|
385
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: reset, disabled: !dirty || saving, children: "\u653E\u5F03\u66F4\u6539" }),
|
|
386
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "is-primary", onClick: () => {
|
|
363
387
|
void save();
|
|
364
388
|
}, disabled: !dirty || invalid || saving || !current?.writable, children: saving ? "\u6B63\u5728\u9A8C\u8BC1\u2026" : "\u9A8C\u8BC1\u5E76\u8FDE\u63A5" })
|
|
365
389
|
] })
|
|
@@ -405,11 +429,11 @@ function isManagementPath(value) {
|
|
|
405
429
|
return typeof value === "string" && value.startsWith("/") && !value.startsWith("//");
|
|
406
430
|
}
|
|
407
431
|
function KnowledgeLauncher({ wide, workspace }) {
|
|
408
|
-
const [open, setOpen] = (0,
|
|
409
|
-
(0,
|
|
432
|
+
const [open, setOpen] = (0, import_react2.useState)(workspace.isOpen());
|
|
433
|
+
(0, import_react2.useEffect)(() => workspace.subscribe(() => {
|
|
410
434
|
setOpen(workspace.isOpen());
|
|
411
435
|
}), [workspace]);
|
|
412
|
-
return /* @__PURE__ */ (0,
|
|
436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
413
437
|
"button",
|
|
414
438
|
{
|
|
415
439
|
type: "button",
|
|
@@ -421,8 +445,8 @@ function KnowledgeLauncher({ wide, workspace }) {
|
|
|
421
445
|
workspace.toggle();
|
|
422
446
|
},
|
|
423
447
|
children: [
|
|
424
|
-
/* @__PURE__ */ (0,
|
|
425
|
-
wide && /* @__PURE__ */ (0,
|
|
448
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.IconDataOutline16, { size: wide ? 16 : 18 }),
|
|
449
|
+
wide && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: open ? "\u8FD4\u56DE\u5BF9\u8BDD" : "\u77E5\u8BC6\u5E93" })
|
|
426
450
|
]
|
|
427
451
|
}
|
|
428
452
|
);
|
|
@@ -430,16 +454,17 @@ function KnowledgeLauncher({ wide, workspace }) {
|
|
|
430
454
|
function KnowledgeWorkspace({
|
|
431
455
|
sessionId,
|
|
432
456
|
useSessions,
|
|
433
|
-
client
|
|
457
|
+
client,
|
|
458
|
+
workspace
|
|
434
459
|
}) {
|
|
435
|
-
const [panelState, setPanelState] = (0,
|
|
436
|
-
const [managementPath, setManagementPath] = (0,
|
|
437
|
-
const [panelError, setPanelError] = (0,
|
|
460
|
+
const [panelState, setPanelState] = (0, import_react2.useState)("loading");
|
|
461
|
+
const [managementPath, setManagementPath] = (0, import_react2.useState)();
|
|
462
|
+
const [panelError, setPanelError] = (0, import_react2.useState)("");
|
|
438
463
|
const projectId = useSessions((state) => sessionId === void 0 ? void 0 : state.byId[sessionId]?.cwd);
|
|
439
464
|
const knowledgeUrl = managementPath === void 0 ? void 0 : knowledgePanelUrl(managementPath, sessionId, projectId);
|
|
440
|
-
const frame = (0,
|
|
441
|
-
const themeFrame = (0,
|
|
442
|
-
const loadManagement = (0,
|
|
465
|
+
const frame = (0, import_react2.useRef)(null);
|
|
466
|
+
const themeFrame = (0, import_react2.useRef)(0);
|
|
467
|
+
const loadManagement = (0, import_react2.useCallback)(async () => {
|
|
443
468
|
setPanelState("loading");
|
|
444
469
|
setPanelError("");
|
|
445
470
|
try {
|
|
@@ -457,10 +482,10 @@ function KnowledgeWorkspace({
|
|
|
457
482
|
setPanelState("error");
|
|
458
483
|
}
|
|
459
484
|
}, []);
|
|
460
|
-
(0,
|
|
485
|
+
(0, import_react2.useEffect)(() => {
|
|
461
486
|
void loadManagement();
|
|
462
487
|
}, [loadManagement]);
|
|
463
|
-
const sendTheme = (0,
|
|
488
|
+
const sendTheme = (0, import_react2.useCallback)(() => {
|
|
464
489
|
const currentFrame = frame.current;
|
|
465
490
|
if (currentFrame === null) return;
|
|
466
491
|
const target = currentFrame.contentWindow;
|
|
@@ -471,14 +496,14 @@ function KnowledgeWorkspace({
|
|
|
471
496
|
frameOrigin(currentFrame) ?? "*"
|
|
472
497
|
);
|
|
473
498
|
}, [client]);
|
|
474
|
-
const scheduleTheme = (0,
|
|
499
|
+
const scheduleTheme = (0, import_react2.useCallback)(() => {
|
|
475
500
|
if (themeFrame.current !== 0) window.cancelAnimationFrame(themeFrame.current);
|
|
476
501
|
themeFrame.current = window.requestAnimationFrame(() => {
|
|
477
502
|
themeFrame.current = 0;
|
|
478
503
|
sendTheme();
|
|
479
504
|
});
|
|
480
505
|
}, [sendTheme]);
|
|
481
|
-
(0,
|
|
506
|
+
(0, import_react2.useEffect)(() => {
|
|
482
507
|
const off = client.on("theme/change", scheduleTheme);
|
|
483
508
|
const onMessage = (event) => {
|
|
484
509
|
const currentFrame = frame.current;
|
|
@@ -496,17 +521,21 @@ function KnowledgeWorkspace({
|
|
|
496
521
|
if (themeFrame.current !== 0) window.cancelAnimationFrame(themeFrame.current);
|
|
497
522
|
};
|
|
498
523
|
}, [client, scheduleTheme, sendTheme]);
|
|
499
|
-
return /* @__PURE__ */ (0,
|
|
500
|
-
/* @__PURE__ */ (0,
|
|
501
|
-
/* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "dsh-knowledge-workspace", "data-xiaohei-surface": "plugin-workspace", "aria-labelledby": "dsh-knowledge-workspace-title", children: [
|
|
525
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("header", { className: "dsh-knowledge-workspace-header", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
526
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", "data-xiaohei-workspace-close": true, onClick: workspace.close, "aria-label": "\u8FD4\u56DE\u4F1A\u8BDD", title: "\u8FD4\u56DE\u4F1A\u8BDD", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.IconChevronLeftOutline14, { size: 15 }) }),
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.IconDataOutline16, { size: 18 }),
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
529
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { id: "dsh-knowledge-workspace-title", children: "\u77E5\u8BC6\u5E93" }),
|
|
530
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u6587\u6863\u3001\u5BA1\u6838\u3001\u6302\u8F7D\u4E0E\u8BBF\u95EE\u7BA1\u7406" })
|
|
531
|
+
] })
|
|
503
532
|
] }) }),
|
|
504
|
-
panelState === "ready" && knowledgeUrl !== void 0 ? /* @__PURE__ */ (0,
|
|
505
|
-
/* @__PURE__ */ (0,
|
|
506
|
-
/* @__PURE__ */ (0,
|
|
507
|
-
/* @__PURE__ */ (0,
|
|
508
|
-
/* @__PURE__ */ (0,
|
|
509
|
-
panelState === "error" && /* @__PURE__ */ (0,
|
|
533
|
+
panelState === "ready" && knowledgeUrl !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("iframe", { ref: frame, className: "dsh-knowledge-frame", src: knowledgeUrl, title: "\u77E5\u8BC6\u5E93\u7BA1\u7406\u53F0", onLoad: sendTheme }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsh-knowledge-panel-state", role: panelState === "error" ? "alert" : "status", "aria-live": "polite", children: [
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dsh-knowledge-panel-state-icon", "aria-hidden": "true", children: panelState === "loading" ? "\xB7\xB7\xB7" : panelState === "error" ? "!" : "\u2014" }),
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: panelState === "loading" ? "\u6B63\u5728\u6253\u5F00\u77E5\u8BC6\u5E93\u2026" : panelState === "error" ? "\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\u77E5\u8BC6\u5E93" : "\u8FD9\u53F0 DSH \u672A\u542F\u7528\u77E5\u8BC6\u5E93\u7BA1\u7406\u53F0" }),
|
|
537
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: panelState === "loading" ? "\u6B63\u5728\u786E\u8BA4\u5F53\u524D\u5B9E\u4F8B\u662F\u5426\u63D0\u4F9B\u7BA1\u7406\u9875\u9762\u3002" : panelState === "error" ? panelError : "\u672C\u5730\u53EC\u56DE\u548C\u56DE\u5199\u4ECD\u53EF\u4F7F\u7528\u3002\u5F53\u524D profile \u5DF2\u663E\u5F0F\u5173\u95ED exposeWeb\uFF1B\u91CD\u65B0\u542F\u7528\u540E\u5373\u53EF\u5728\u8FD9\u91CC\u7BA1\u7406\u3002\u4F7F\u7528\u8FDC\u7A0B\u77E5\u8BC6\u5E93\u65F6\uFF0C\u8BF7\u524D\u5F80\u4E2D\u592E DSH \u7684\u77E5\u8BC6\u5E93\u7BA1\u7406\u53F0\u3002" }),
|
|
538
|
+
panelState === "error" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: () => {
|
|
510
539
|
void loadManagement();
|
|
511
540
|
}, children: "\u91CD\u8BD5" })
|
|
512
541
|
] })
|