dsh-ai-courses 0.1.2 → 0.1.3
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 +33 -14
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -4715,19 +4715,38 @@ function aicCoursesApply (ctx) {
|
|
|
4715
4715
|
|
|
4716
4716
|
const disposers = []
|
|
4717
4717
|
|
|
4718
|
-
/*
|
|
4719
|
-
`
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4718
|
+
/* 侧边栏面板图标 / 主面板:**等槽声明后再注册**。
|
|
4719
|
+
`sidebar.panellist` 由 `@deepseek-ai/dsh-client-ui-sidebar` 声明;在 `dsh web` 里这个声明
|
|
4720
|
+
发生在 sidebar 首次渲染时,比插件 apply 晚 —— 直接 `slots.register` 会抛
|
|
4721
|
+
「slot "sidebar.panellist" is not declared」,整个 client entry 被标 failed(真机踩到)。
|
|
4722
|
+
用 `slots.inject` 等声明;老宿主没有 inject 时退回直接注册。 */
|
|
4723
|
+
if (slots && typeof slots.inject === 'function') {
|
|
4724
|
+
/* `id` 必须与 `main` 的 `key` 是同一字符串(宿主按 list id 寻址 main 面板,E-8);
|
|
4725
|
+
`label` 必须是函数。 */
|
|
4726
|
+
disposers.push(
|
|
4727
|
+
slots.inject('sidebar.panellist', () => slots.register(
|
|
4728
|
+
{ name: 'sidebar.panellist', id: 'ai-courses', order: 30, label: () => t('panel.title') },
|
|
4729
|
+
(props) => h(CoursePanelIcon, props),
|
|
4730
|
+
)),
|
|
4731
|
+
)
|
|
4732
|
+
/* 主面板。key = 'ai-courses'(**不能**用 'course':那是 dsh-course-plugin 的格位) */
|
|
4733
|
+
disposers.push(
|
|
4734
|
+
slots.inject('main', () => slots.register(
|
|
4735
|
+
{ name: 'main', key: 'ai-courses' },
|
|
4736
|
+
() => h(AicCoursesApp, { t: t, ctx: ctx }),
|
|
4737
|
+
)),
|
|
4738
|
+
)
|
|
4739
|
+
} else {
|
|
4740
|
+
disposers.push(
|
|
4741
|
+
slots.register(
|
|
4742
|
+
{ name: 'sidebar.panellist', id: 'ai-courses', order: 30, label: () => t('panel.title') },
|
|
4743
|
+
(props) => h(CoursePanelIcon, props),
|
|
4744
|
+
),
|
|
4745
|
+
)
|
|
4746
|
+
disposers.push(
|
|
4747
|
+
slots.register({ name: 'main', key: 'ai-courses' }, () => h(AicCoursesApp, { t: t, ctx: ctx })),
|
|
4748
|
+
)
|
|
4749
|
+
}
|
|
4731
4750
|
|
|
4732
4751
|
/* 主会话里的 `/ai-course` 实时状态卡片(conversation.chat.commandview,见 55-status-card.js):
|
|
4733
4752
|
宿主 ui-chat 声明该槽,用 inject 等声明出现再注册(直接 register 会抛「未声明」)。 */
|
|
@@ -4748,7 +4767,7 @@ function aicCoursesApply (ctx) {
|
|
|
4748
4767
|
if (styleEl && styleEl.parentNode) styleEl.parentNode.removeChild(styleEl)
|
|
4749
4768
|
})
|
|
4750
4769
|
|
|
4751
|
-
console.log('[ai-courses] 客户端已就绪(sidebar
|
|
4770
|
+
console.log('[ai-courses] 客户端已就绪(sidebar/main 等槽声明后注册;主会话槽已注册)')
|
|
4752
4771
|
}
|
|
4753
4772
|
|
|
4754
4773
|
/* ==================== src/client/99-shell-tail.js ==================== */
|