@lemoncat7/dsh-knowledge 1.0.1 → 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 +7 -4
- package/docs/architecture.md +5 -5
- 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 +142 -87
- 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/index.d.ts.map +1 -1
- package/lib/index.js +24 -4
- package/lib/index.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 -21
- package/lib/retrieval.js.map +1 -1
- package/lib/runtime.d.ts +0 -4
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.js +0 -9
- package/lib/runtime.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 +35 -2
- package/lib/tools.js.map +1 -1
- package/package.json +3 -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,11 +170,37 @@ 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
|
|
155
177
|
}, KnowledgeConnectionCard));
|
|
178
|
+
ctx.slots.inject("conversation.chat.turnTail", () => ctx.slots.register({
|
|
179
|
+
name: "conversation.chat.turnTail",
|
|
180
|
+
select: (owner) => ({ turn: owner.turn.turn })
|
|
181
|
+
}, (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(KnowledgeWritebackStatus, { sessionId: String(props.sessionId), turn: props.matched.turn })));
|
|
182
|
+
}
|
|
183
|
+
function KnowledgeWritebackStatus({ sessionId, turn }) {
|
|
184
|
+
const [summary, setSummary] = (0, import_react2.useState)();
|
|
185
|
+
(0, import_react2.useEffect)(() => {
|
|
186
|
+
const controller = new AbortController();
|
|
187
|
+
void fetch(`/knowledge-control/v1/writeback-status?sessionId=${encodeURIComponent(sessionId)}&turn=${turn}`, {
|
|
188
|
+
headers: { accept: "application/json" },
|
|
189
|
+
signal: controller.signal
|
|
190
|
+
}).then(async (response) => response.ok ? response.json() : void 0).then((value) => {
|
|
191
|
+
if (value?.summary) setSummary(value.summary);
|
|
192
|
+
}).catch(() => {
|
|
193
|
+
});
|
|
194
|
+
return () => {
|
|
195
|
+
controller.abort();
|
|
196
|
+
};
|
|
197
|
+
}, [sessionId, turn]);
|
|
198
|
+
if (summary === void 0) return null;
|
|
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 })
|
|
203
|
+
] });
|
|
156
204
|
}
|
|
157
205
|
function createKnowledgeWorkspaceController(client) {
|
|
158
206
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -167,11 +215,12 @@ function createKnowledgeWorkspaceController(client) {
|
|
|
167
215
|
dispose();
|
|
168
216
|
notify();
|
|
169
217
|
};
|
|
170
|
-
|
|
218
|
+
const controller = {
|
|
171
219
|
isOpen: () => disposeWorkspace !== void 0,
|
|
172
220
|
toggle: () => {
|
|
173
221
|
if (disposeWorkspace !== void 0) return close();
|
|
174
|
-
|
|
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 }));
|
|
175
224
|
disposeWorkspace = dispose;
|
|
176
225
|
notify();
|
|
177
226
|
},
|
|
@@ -183,20 +232,21 @@ function createKnowledgeWorkspaceController(client) {
|
|
|
183
232
|
};
|
|
184
233
|
}
|
|
185
234
|
};
|
|
235
|
+
return controller;
|
|
186
236
|
}
|
|
187
237
|
function KnowledgeConnectionCard() {
|
|
188
|
-
const [current, setCurrent] = (0,
|
|
189
|
-
const [loadState, setLoadState] = (0,
|
|
190
|
-
const [loadError, setLoadError] = (0,
|
|
191
|
-
const [open, setOpen] = (0,
|
|
192
|
-
const [backend, setBackend] = (0,
|
|
193
|
-
const [remoteUrl, setRemoteUrl] = (0,
|
|
194
|
-
const [remoteToken, setRemoteToken] = (0,
|
|
195
|
-
const [timeout, setTimeoutValue] = (0,
|
|
196
|
-
const [dirty, setDirty] = (0,
|
|
197
|
-
const [saving, setSaving] = (0,
|
|
198
|
-
const [message, setMessage] = (0,
|
|
199
|
-
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) => {
|
|
200
250
|
setLoadState("loading");
|
|
201
251
|
setLoadError("");
|
|
202
252
|
try {
|
|
@@ -209,14 +259,14 @@ function KnowledgeConnectionCard() {
|
|
|
209
259
|
setLoadState("error");
|
|
210
260
|
}
|
|
211
261
|
}, []);
|
|
212
|
-
(0,
|
|
262
|
+
(0, import_react2.useEffect)(() => {
|
|
213
263
|
const controller = new AbortController();
|
|
214
264
|
void load(controller.signal);
|
|
215
265
|
return () => {
|
|
216
266
|
controller.abort();
|
|
217
267
|
};
|
|
218
268
|
}, [load]);
|
|
219
|
-
(0,
|
|
269
|
+
(0, import_react2.useEffect)(() => {
|
|
220
270
|
if (dirty || current === void 0) return;
|
|
221
271
|
setBackend(current.backend);
|
|
222
272
|
setRemoteUrl(current.remoteUrl ?? "");
|
|
@@ -264,76 +314,76 @@ function KnowledgeConnectionCard() {
|
|
|
264
314
|
setSaving(false);
|
|
265
315
|
}
|
|
266
316
|
};
|
|
267
|
-
return /* @__PURE__ */ (0,
|
|
268
|
-
/* @__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: () => {
|
|
269
319
|
setOpen((value) => !value);
|
|
270
320
|
}, children: [
|
|
271
|
-
/* @__PURE__ */ (0,
|
|
272
|
-
/* @__PURE__ */ (0,
|
|
273
|
-
/* @__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" })
|
|
274
324
|
] }),
|
|
275
|
-
/* @__PURE__ */ (0,
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dsh-knowledge-settings-summary", children: [
|
|
276
326
|
loadState === "loading" ? "\u8BFB\u53D6\u4E2D" : loadState === "error" ? "\u8FDE\u63A5\u5165\u53E3" : current?.backend === "remote" ? "\u8FDC\u7A0B" : "\u672C\u5730",
|
|
277
327
|
" \xB7 ",
|
|
278
328
|
open ? "\u6536\u8D77" : "\u8BBE\u7F6E"
|
|
279
329
|
] })
|
|
280
330
|
] }),
|
|
281
|
-
open && /* @__PURE__ */ (0,
|
|
282
|
-
/* @__PURE__ */ (0,
|
|
283
|
-
/* @__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: () => {
|
|
284
334
|
void load();
|
|
285
335
|
}, children: "\u91CD\u65B0\u8BFB\u53D6" })
|
|
286
|
-
] }) : /* @__PURE__ */ (0,
|
|
287
|
-
/* @__PURE__ */ (0,
|
|
288
|
-
/* @__PURE__ */ (0,
|
|
289
|
-
/* @__PURE__ */ (0,
|
|
290
|
-
/* @__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(() => {
|
|
291
341
|
setBackend("local");
|
|
292
342
|
}) }),
|
|
293
|
-
/* @__PURE__ */ (0,
|
|
294
|
-
/* @__PURE__ */ (0,
|
|
295
|
-
/* @__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" })
|
|
296
346
|
] })
|
|
297
347
|
] }),
|
|
298
|
-
/* @__PURE__ */ (0,
|
|
299
|
-
/* @__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(() => {
|
|
300
350
|
setBackend("remote");
|
|
301
351
|
}) }),
|
|
302
|
-
/* @__PURE__ */ (0,
|
|
303
|
-
/* @__PURE__ */ (0,
|
|
304
|
-
/* @__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" })
|
|
305
355
|
] })
|
|
306
356
|
] })
|
|
307
357
|
] }),
|
|
308
|
-
!current?.canSwitchRemote && /* @__PURE__ */ (0,
|
|
309
|
-
backend === "remote" && /* @__PURE__ */ (0,
|
|
310
|
-
/* @__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: [
|
|
311
361
|
"\u670D\u52A1\u5668\u5730\u5740",
|
|
312
|
-
/* @__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(() => {
|
|
313
363
|
setRemoteUrl(event.target.value);
|
|
314
364
|
}), "aria-invalid": urlError !== void 0, "aria-describedby": urlError ? "dsh-knowledge-url-error" : void 0 }),
|
|
315
|
-
urlError && /* @__PURE__ */ (0,
|
|
365
|
+
urlError && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { id: "dsh-knowledge-url-error", className: "dsh-knowledge-field-error", children: urlError })
|
|
316
366
|
] }),
|
|
317
|
-
/* @__PURE__ */ (0,
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { htmlFor: "dsh-knowledge-remote-token", children: [
|
|
318
368
|
"\u5BA2\u6237\u7AEF\u4EE4\u724C",
|
|
319
|
-
/* @__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(() => {
|
|
320
370
|
setRemoteToken(event.target.value);
|
|
321
371
|
}), "aria-invalid": tokenError !== void 0, "aria-describedby": "dsh-knowledge-token-help" }),
|
|
322
|
-
/* @__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") })
|
|
323
373
|
] })
|
|
324
374
|
] }),
|
|
325
|
-
/* @__PURE__ */ (0,
|
|
375
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "dsh-knowledge-timeout-field", htmlFor: "dsh-knowledge-timeout", children: [
|
|
326
376
|
"\u8BF7\u6C42\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
|
|
327
|
-
/* @__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(() => {
|
|
328
378
|
setTimeoutValue(event.target.value);
|
|
329
379
|
}), "aria-invalid": timeoutError !== void 0 }),
|
|
330
|
-
timeoutError && /* @__PURE__ */ (0,
|
|
380
|
+
timeoutError && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { className: "dsh-knowledge-field-error", children: timeoutError })
|
|
331
381
|
] }),
|
|
332
|
-
!current?.writable && /* @__PURE__ */ (0,
|
|
333
|
-
message && /* @__PURE__ */ (0,
|
|
334
|
-
/* @__PURE__ */ (0,
|
|
335
|
-
/* @__PURE__ */ (0,
|
|
336
|
-
/* @__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: () => {
|
|
337
387
|
void save();
|
|
338
388
|
}, disabled: !dirty || invalid || saving || !current?.writable, children: saving ? "\u6B63\u5728\u9A8C\u8BC1\u2026" : "\u9A8C\u8BC1\u5E76\u8FDE\u63A5" })
|
|
339
389
|
] })
|
|
@@ -379,11 +429,11 @@ function isManagementPath(value) {
|
|
|
379
429
|
return typeof value === "string" && value.startsWith("/") && !value.startsWith("//");
|
|
380
430
|
}
|
|
381
431
|
function KnowledgeLauncher({ wide, workspace }) {
|
|
382
|
-
const [open, setOpen] = (0,
|
|
383
|
-
(0,
|
|
432
|
+
const [open, setOpen] = (0, import_react2.useState)(workspace.isOpen());
|
|
433
|
+
(0, import_react2.useEffect)(() => workspace.subscribe(() => {
|
|
384
434
|
setOpen(workspace.isOpen());
|
|
385
435
|
}), [workspace]);
|
|
386
|
-
return /* @__PURE__ */ (0,
|
|
436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
387
437
|
"button",
|
|
388
438
|
{
|
|
389
439
|
type: "button",
|
|
@@ -395,8 +445,8 @@ function KnowledgeLauncher({ wide, workspace }) {
|
|
|
395
445
|
workspace.toggle();
|
|
396
446
|
},
|
|
397
447
|
children: [
|
|
398
|
-
/* @__PURE__ */ (0,
|
|
399
|
-
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" })
|
|
400
450
|
]
|
|
401
451
|
}
|
|
402
452
|
);
|
|
@@ -404,16 +454,17 @@ function KnowledgeLauncher({ wide, workspace }) {
|
|
|
404
454
|
function KnowledgeWorkspace({
|
|
405
455
|
sessionId,
|
|
406
456
|
useSessions,
|
|
407
|
-
client
|
|
457
|
+
client,
|
|
458
|
+
workspace
|
|
408
459
|
}) {
|
|
409
|
-
const [panelState, setPanelState] = (0,
|
|
410
|
-
const [managementPath, setManagementPath] = (0,
|
|
411
|
-
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)("");
|
|
412
463
|
const projectId = useSessions((state) => sessionId === void 0 ? void 0 : state.byId[sessionId]?.cwd);
|
|
413
464
|
const knowledgeUrl = managementPath === void 0 ? void 0 : knowledgePanelUrl(managementPath, sessionId, projectId);
|
|
414
|
-
const frame = (0,
|
|
415
|
-
const themeFrame = (0,
|
|
416
|
-
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 () => {
|
|
417
468
|
setPanelState("loading");
|
|
418
469
|
setPanelError("");
|
|
419
470
|
try {
|
|
@@ -431,10 +482,10 @@ function KnowledgeWorkspace({
|
|
|
431
482
|
setPanelState("error");
|
|
432
483
|
}
|
|
433
484
|
}, []);
|
|
434
|
-
(0,
|
|
485
|
+
(0, import_react2.useEffect)(() => {
|
|
435
486
|
void loadManagement();
|
|
436
487
|
}, [loadManagement]);
|
|
437
|
-
const sendTheme = (0,
|
|
488
|
+
const sendTheme = (0, import_react2.useCallback)(() => {
|
|
438
489
|
const currentFrame = frame.current;
|
|
439
490
|
if (currentFrame === null) return;
|
|
440
491
|
const target = currentFrame.contentWindow;
|
|
@@ -445,14 +496,14 @@ function KnowledgeWorkspace({
|
|
|
445
496
|
frameOrigin(currentFrame) ?? "*"
|
|
446
497
|
);
|
|
447
498
|
}, [client]);
|
|
448
|
-
const scheduleTheme = (0,
|
|
499
|
+
const scheduleTheme = (0, import_react2.useCallback)(() => {
|
|
449
500
|
if (themeFrame.current !== 0) window.cancelAnimationFrame(themeFrame.current);
|
|
450
501
|
themeFrame.current = window.requestAnimationFrame(() => {
|
|
451
502
|
themeFrame.current = 0;
|
|
452
503
|
sendTheme();
|
|
453
504
|
});
|
|
454
505
|
}, [sendTheme]);
|
|
455
|
-
(0,
|
|
506
|
+
(0, import_react2.useEffect)(() => {
|
|
456
507
|
const off = client.on("theme/change", scheduleTheme);
|
|
457
508
|
const onMessage = (event) => {
|
|
458
509
|
const currentFrame = frame.current;
|
|
@@ -470,17 +521,21 @@ function KnowledgeWorkspace({
|
|
|
470
521
|
if (themeFrame.current !== 0) window.cancelAnimationFrame(themeFrame.current);
|
|
471
522
|
};
|
|
472
523
|
}, [client, scheduleTheme, sendTheme]);
|
|
473
|
-
return /* @__PURE__ */ (0,
|
|
474
|
-
/* @__PURE__ */ (0,
|
|
475
|
-
/* @__PURE__ */ (0,
|
|
476
|
-
/* @__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
|
+
] })
|
|
477
532
|
] }) }),
|
|
478
|
-
panelState === "ready" && knowledgeUrl !== void 0 ? /* @__PURE__ */ (0,
|
|
479
|
-
/* @__PURE__ */ (0,
|
|
480
|
-
/* @__PURE__ */ (0,
|
|
481
|
-
/* @__PURE__ */ (0,
|
|
482
|
-
/* @__PURE__ */ (0,
|
|
483
|
-
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: () => {
|
|
484
539
|
void loadManagement();
|
|
485
540
|
}, children: "\u91CD\u8BD5" })
|
|
486
541
|
] })
|