@donglegeyu/company-ui 1.2.49 → 1.3.0
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/dist/cjs/ai-assistant/AiAssistantProvider.d.ts +20 -3
- package/dist/cjs/ai-assistant/AiAssistantProvider.js +35 -8
- package/dist/cjs/ai-assistant/AiSessionEngine.d.ts +9 -1
- package/dist/cjs/ai-assistant/AiSessionEngine.js +59 -9
- package/dist/cjs/ai-assistant/index.d.ts +1 -1
- package/dist/cjs/ai-assistant/types.d.ts +30 -1
- package/dist/cjs/shared-components/CompanyAiAssistant/index.d.ts +3 -1
- package/dist/cjs/shared-components/CompanyAiAssistant/index.js +33 -1
- package/dist/cjs/shared-components/CompanyAiAssistant/index.scss +5 -0
- package/dist/cjs/template-components/AdminLayoutTemplate/index.js +4 -0
- package/dist/cjs/template-components/AiAssistantDock/index.js +3 -0
- package/dist/cjs/template-components/StatisticsListPage/index.scss +1 -1
- package/dist/es/ai-assistant/AiAssistantProvider.d.ts +20 -3
- package/dist/es/ai-assistant/AiAssistantProvider.js +46 -11
- package/dist/es/ai-assistant/AiSessionEngine.d.ts +9 -1
- package/dist/es/ai-assistant/AiSessionEngine.js +65 -11
- package/dist/es/ai-assistant/index.d.ts +1 -1
- package/dist/es/ai-assistant/types.d.ts +30 -1
- package/dist/es/shared-components/CompanyAiAssistant/index.d.ts +3 -1
- package/dist/es/shared-components/CompanyAiAssistant/index.js +77 -37
- package/dist/es/shared-components/CompanyAiAssistant/index.scss +5 -0
- package/dist/es/template-components/AdminLayoutTemplate/index.js +7 -0
- package/dist/es/template-components/AiAssistantDock/index.js +3 -0
- package/dist/es/template-components/StatisticsListPage/index.scss +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { AiPageCapability, AiReference, AiReferenceTab, AiSession, AiSuggestion, AiTransport } from "./types";
|
|
2
|
+
import type { AiContext, AiNavigateTarget, AiNavigationSuggestion, AiPageCapability, AiReference, AiReferenceTab, AiSession, AiSuggestion, AiTransport } from "./types";
|
|
3
3
|
/** 页签元数据:@ 引用列表数据源(capability 供引用非活动页签时查找能力契约) */
|
|
4
4
|
export interface AiTabMeta extends AiReferenceTab {
|
|
5
5
|
/** 该页签的能力契约(页面未挂载时其 getContext 可能拿不到实时值) */
|
|
@@ -9,7 +9,7 @@ export interface AiTabMeta extends AiReferenceTab {
|
|
|
9
9
|
export interface AiAssistantContextValue {
|
|
10
10
|
/** 面板是否展开(当前页签) */
|
|
11
11
|
open: boolean;
|
|
12
|
-
/**
|
|
12
|
+
/** 是否钉住(跨页签常驻;未钉住时是否随页签切换收起由 autoCollapseOnTabChange 控制) */
|
|
13
13
|
pinned: boolean;
|
|
14
14
|
/** 当前活动页签 key(会话隔离键) */
|
|
15
15
|
activeTabKey: string;
|
|
@@ -30,6 +30,10 @@ export interface AiAssistantContextValue {
|
|
|
30
30
|
togglePin: () => void;
|
|
31
31
|
send: (text: string) => void;
|
|
32
32
|
confirmSuggestion: (suggestion: AiSuggestion) => void;
|
|
33
|
+
/** 确认导航(用户点击「前往」后由面板调用) */
|
|
34
|
+
confirmNavigation: (navigation: AiNavigationSuggestion) => void;
|
|
35
|
+
/** 导航执行入口是否已配置(未配置时导航卡片按钮不可用) */
|
|
36
|
+
canNavigate: boolean;
|
|
33
37
|
rollback: () => void;
|
|
34
38
|
validate: () => void;
|
|
35
39
|
}
|
|
@@ -47,6 +51,19 @@ export interface AiAssistantProviderProps {
|
|
|
47
51
|
transport?: AiTransport;
|
|
48
52
|
/** 初始是否展开面板,默认 false */
|
|
49
53
|
defaultOpen?: boolean;
|
|
54
|
+
/** 初始是否钉住面板(钉住后跨页签常驻),默认 false */
|
|
55
|
+
defaultPinned?: boolean;
|
|
56
|
+
/** 切换页签时是否自动收起面板(仅未钉住时生效),默认 true(保持 1.x 行为) */
|
|
57
|
+
autoCollapseOnTabChange?: boolean;
|
|
58
|
+
/** 系统级上下文:无页面能力契约时随请求发送(默认不启用,scene 仍为 system) */
|
|
59
|
+
systemContext?: AiContext;
|
|
60
|
+
/**
|
|
61
|
+
* 兜底能力契约:无页面能力契约时启用(默认不启用)。
|
|
62
|
+
* 注意:启用后系统级交互会按其 actions 显示系统级动作芯片,并以其 scene 路由请求。
|
|
63
|
+
*/
|
|
64
|
+
fallbackCapability?: AiPageCapability;
|
|
65
|
+
/** 导航执行入口:用户点击导航卡片「前往」时调用(默认不启用,仅渲染确认卡片) */
|
|
66
|
+
onNavigate?: (target: AiNavigateTarget) => void;
|
|
50
67
|
}
|
|
51
68
|
/**
|
|
52
69
|
* AI 助手全局状态层:持有面板两态(open/pinned)与按 tabKey 隔离的会话表。
|
|
@@ -54,6 +71,6 @@ export interface AiAssistantProviderProps {
|
|
|
54
71
|
* - 内部创建 AiSessionEngine 并镜像其会话快照到组件状态
|
|
55
72
|
* - 未钉住时切换页签自动收起面板;页签关闭经 tabKeys 自动回收会话
|
|
56
73
|
*/
|
|
57
|
-
export declare function AiAssistantProvider({ children, activeTabKey, tabKeys, tabs, capability, transport, defaultOpen, }: AiAssistantProviderProps): import("react").JSX.Element;
|
|
74
|
+
export declare function AiAssistantProvider({ children, activeTabKey, tabKeys, tabs, capability, transport, defaultOpen, defaultPinned, autoCollapseOnTabChange, systemContext, fallbackCapability, onNavigate, }: AiAssistantProviderProps): import("react").JSX.Element;
|
|
58
75
|
/** 读取 AI 助手全局状态(需在 AiAssistantProvider 内使用) */
|
|
59
76
|
export declare function useAiAssistantContext(): AiAssistantContextValue;
|
|
@@ -36,10 +36,15 @@ function AiAssistantProvider({
|
|
|
36
36
|
tabs,
|
|
37
37
|
capability,
|
|
38
38
|
transport,
|
|
39
|
-
defaultOpen = false
|
|
39
|
+
defaultOpen = false,
|
|
40
|
+
defaultPinned = false,
|
|
41
|
+
autoCollapseOnTabChange = true,
|
|
42
|
+
systemContext,
|
|
43
|
+
fallbackCapability,
|
|
44
|
+
onNavigate
|
|
40
45
|
}) {
|
|
41
46
|
const [open, setOpen] = (0, import_react.useState)(defaultOpen);
|
|
42
|
-
const [pinned, setPinned] = (0, import_react.useState)(
|
|
47
|
+
const [pinned, setPinned] = (0, import_react.useState)(defaultPinned);
|
|
43
48
|
const [sessions, setSessions] = (0, import_react.useState)({});
|
|
44
49
|
const [reference, setReference] = (0, import_react.useState)(() => {
|
|
45
50
|
var _a;
|
|
@@ -58,6 +63,14 @@ function AiAssistantProvider({
|
|
|
58
63
|
tabsRef.current = tabs ?? [];
|
|
59
64
|
const referenceRef = (0, import_react.useRef)(reference);
|
|
60
65
|
referenceRef.current = reference;
|
|
66
|
+
const fallbackCapabilityRef = (0, import_react.useRef)(fallbackCapability);
|
|
67
|
+
fallbackCapabilityRef.current = fallbackCapability;
|
|
68
|
+
const systemContextRef = (0, import_react.useRef)(systemContext);
|
|
69
|
+
systemContextRef.current = systemContext;
|
|
70
|
+
const onNavigateRef = (0, import_react.useRef)(onNavigate);
|
|
71
|
+
onNavigateRef.current = onNavigate;
|
|
72
|
+
const autoCollapseRef = (0, import_react.useRef)(autoCollapseOnTabChange);
|
|
73
|
+
autoCollapseRef.current = autoCollapseOnTabChange;
|
|
61
74
|
const engine = (0, import_react.useMemo)(() => {
|
|
62
75
|
return new import_AiSessionEngine.AiSessionEngine({
|
|
63
76
|
transport: transport ?? new import_MockAiTransport.MockAiTransport(),
|
|
@@ -68,10 +81,16 @@ function AiAssistantProvider({
|
|
|
68
81
|
return void 0;
|
|
69
82
|
const ref = referenceRef.current;
|
|
70
83
|
if (!ref)
|
|
71
|
-
return
|
|
72
|
-
if (ref.tabKey === activeTabKeyRef.current)
|
|
73
|
-
return capabilityRef.current;
|
|
84
|
+
return fallbackCapabilityRef.current;
|
|
85
|
+
if (ref.tabKey === activeTabKeyRef.current) {
|
|
86
|
+
return capabilityRef.current ?? fallbackCapabilityRef.current;
|
|
87
|
+
}
|
|
74
88
|
return (_a = tabsRef.current.find((tab) => tab.key === ref.tabKey)) == null ? void 0 : _a.capability;
|
|
89
|
+
},
|
|
90
|
+
getSystemContext: () => systemContextRef.current,
|
|
91
|
+
onNavigate: (target) => {
|
|
92
|
+
var _a;
|
|
93
|
+
return (_a = onNavigateRef.current) == null ? void 0 : _a.call(onNavigateRef, target);
|
|
75
94
|
}
|
|
76
95
|
});
|
|
77
96
|
}, []);
|
|
@@ -124,13 +143,18 @@ function AiAssistantProvider({
|
|
|
124
143
|
mountedRef.current = true;
|
|
125
144
|
return;
|
|
126
145
|
}
|
|
127
|
-
if (!pinnedRef.current)
|
|
128
|
-
|
|
146
|
+
if (!autoCollapseRef.current || pinnedRef.current)
|
|
147
|
+
return;
|
|
148
|
+
setOpen(false);
|
|
129
149
|
}, [activeTabKey]);
|
|
130
150
|
const togglePin = (0, import_react.useCallback)(() => setPinned((value2) => !value2), []);
|
|
131
151
|
const session = sessions[activeTabKey] ?? EMPTY_SESSION;
|
|
132
|
-
const
|
|
152
|
+
const actionCapability = capability ?? fallbackCapability;
|
|
153
|
+
const hasActions = Boolean(
|
|
154
|
+
(actionCapability == null ? void 0 : actionCapability.actions) && Object.keys(actionCapability.actions).length > 0
|
|
155
|
+
);
|
|
133
156
|
const canRollback = hasActions ? engine.canRollback(activeTabKey) : false;
|
|
157
|
+
const canNavigate = Boolean(onNavigate);
|
|
134
158
|
const value = (0, import_react.useMemo)(
|
|
135
159
|
() => ({
|
|
136
160
|
open,
|
|
@@ -147,6 +171,8 @@ function AiAssistantProvider({
|
|
|
147
171
|
togglePin,
|
|
148
172
|
send: (text) => engine.send(activeTabKey, text),
|
|
149
173
|
confirmSuggestion: (suggestion) => engine.confirmSuggestion(activeTabKey, suggestion),
|
|
174
|
+
confirmNavigation: (navigation) => engine.confirmNavigation(activeTabKey, navigation),
|
|
175
|
+
canNavigate,
|
|
150
176
|
rollback: () => engine.rollback(activeTabKey),
|
|
151
177
|
validate: () => engine.validate(activeTabKey)
|
|
152
178
|
}),
|
|
@@ -158,6 +184,7 @@ function AiAssistantProvider({
|
|
|
158
184
|
capability,
|
|
159
185
|
hasActions,
|
|
160
186
|
canRollback,
|
|
187
|
+
canNavigate,
|
|
161
188
|
reference,
|
|
162
189
|
tabs,
|
|
163
190
|
engine,
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type { AiPageCapability, AiSession, AiSuggestion, AiTransport } from "./types";
|
|
1
|
+
import type { AiContext, AiNavigateTarget, AiNavigationSuggestion, AiPageCapability, AiSession, AiSuggestion, AiTransport } from "./types";
|
|
2
2
|
/** 引擎选项 */
|
|
3
3
|
export interface AiSessionEngineOptions {
|
|
4
4
|
/** 流式传输(P1 mock / P2 SSE) */
|
|
5
5
|
transport: AiTransport;
|
|
6
6
|
/** 获取指定页签当前注册的能力契约(由 Provider 提供,返回 undefined 表示该页无契约) */
|
|
7
7
|
getCapability: (tabKey: string) => AiPageCapability | undefined;
|
|
8
|
+
/** 系统级上下文:无页面契约时随请求发送(缺省不启用,避免改变既有 system 场景语义) */
|
|
9
|
+
getSystemContext?: () => AiContext | undefined;
|
|
10
|
+
/** 导航执行入口:用户点击导航卡片「前往」时调用(缺省不启用,卡片按钮不可用) */
|
|
11
|
+
onNavigate?: (target: AiNavigateTarget) => void;
|
|
8
12
|
/** 版本栈深度,默认 10(超出丢弃最旧) */
|
|
9
13
|
maxSnapshots?: number;
|
|
10
14
|
/** 随请求发送的对话历史上限条数,默认 20(不含本轮消息) */
|
|
@@ -22,6 +26,8 @@ export declare class AiSessionEngine {
|
|
|
22
26
|
private readonly listeners;
|
|
23
27
|
private readonly transport;
|
|
24
28
|
private readonly getCapability;
|
|
29
|
+
private readonly getSystemContext;
|
|
30
|
+
private readonly onNavigate;
|
|
25
31
|
private readonly maxSnapshots;
|
|
26
32
|
private readonly maxHistory;
|
|
27
33
|
constructor(options: AiSessionEngineOptions);
|
|
@@ -33,6 +39,8 @@ export declare class AiSessionEngine {
|
|
|
33
39
|
send(tabKey: string, text: string): void;
|
|
34
40
|
/** 确认并回填:压栈快照 → 应用补丁 → 标记建议已应用 */
|
|
35
41
|
confirmSuggestion(tabKey: string, suggestion: AiSuggestion): void;
|
|
42
|
+
/** 确认导航:仅在用户点击「前往」后执行(不压栈、不回填,未配置 onNavigate 时为空操作) */
|
|
43
|
+
confirmNavigation(tabKey: string, navigation: AiNavigationSuggestion): void;
|
|
36
44
|
/** 撤回到上版:页面自管 rollback 优先,否则内置版本栈出栈并经 backfill 恢复 */
|
|
37
45
|
rollback(tabKey: string): void;
|
|
38
46
|
/** 核验表单/配置:报告以消息形式回显在对话流 */
|
|
@@ -52,6 +52,8 @@ var AiSessionEngine = class {
|
|
|
52
52
|
this.listeners = /* @__PURE__ */ new Set();
|
|
53
53
|
this.transport = options.transport;
|
|
54
54
|
this.getCapability = options.getCapability;
|
|
55
|
+
this.getSystemContext = options.getSystemContext;
|
|
56
|
+
this.onNavigate = options.onNavigate;
|
|
55
57
|
this.maxSnapshots = options.maxSnapshots ?? 10;
|
|
56
58
|
this.maxHistory = options.maxHistory ?? 20;
|
|
57
59
|
}
|
|
@@ -80,6 +82,7 @@ var AiSessionEngine = class {
|
|
|
80
82
|
}
|
|
81
83
|
/** 发送一轮对话:追加用户消息 + 流式占位助手消息,按帧更新 */
|
|
82
84
|
send(tabKey, text) {
|
|
85
|
+
var _a;
|
|
83
86
|
const trimmed = text.trim();
|
|
84
87
|
if (!trimmed)
|
|
85
88
|
return;
|
|
@@ -93,6 +96,13 @@ var AiSessionEngine = class {
|
|
|
93
96
|
} catch {
|
|
94
97
|
context = void 0;
|
|
95
98
|
}
|
|
99
|
+
if (!context) {
|
|
100
|
+
try {
|
|
101
|
+
context = (_a = this.getSystemContext) == null ? void 0 : _a.call(this);
|
|
102
|
+
} catch {
|
|
103
|
+
context = void 0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
96
106
|
const history = session.messages.filter((item) => item.content.trim().length > 0).slice(-this.maxHistory).map((item) => ({ role: item.role, content: item.content }));
|
|
97
107
|
this.update(tabKey, {
|
|
98
108
|
messages: [
|
|
@@ -129,15 +139,32 @@ var AiSessionEngine = class {
|
|
|
129
139
|
}
|
|
130
140
|
case "action": {
|
|
131
141
|
if (isPlaceholder) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
if (event.actionType === "backfill") {
|
|
143
|
+
messages[messages.length - 1] = {
|
|
144
|
+
...last,
|
|
145
|
+
suggestion: {
|
|
146
|
+
type: "backfill",
|
|
147
|
+
title: event.title ?? "建议草稿",
|
|
148
|
+
items: event.items ?? [],
|
|
149
|
+
patch: event.patch
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
} else if (event.actionType === "navigate") {
|
|
153
|
+
messages[messages.length - 1] = {
|
|
154
|
+
...last,
|
|
155
|
+
navigation: {
|
|
156
|
+
type: "navigate",
|
|
157
|
+
title: event.title ?? "建议前往",
|
|
158
|
+
items: event.items ?? [],
|
|
159
|
+
target: event.target
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
} else {
|
|
163
|
+
console.warn(
|
|
164
|
+
"[AiSessionEngine] 未知 actionType,已忽略:",
|
|
165
|
+
event.actionType
|
|
166
|
+
);
|
|
167
|
+
}
|
|
141
168
|
}
|
|
142
169
|
this.update(tabKey, { messages });
|
|
143
170
|
break;
|
|
@@ -235,6 +262,29 @@ ${reason}` : reason
|
|
|
235
262
|
);
|
|
236
263
|
this.update(tabKey, { snapshots, messages });
|
|
237
264
|
}
|
|
265
|
+
/** 确认导航:仅在用户点击「前往」后执行(不压栈、不回填,未配置 onNavigate 时为空操作) */
|
|
266
|
+
confirmNavigation(tabKey, navigation) {
|
|
267
|
+
const navigate = this.onNavigate;
|
|
268
|
+
if (!navigate)
|
|
269
|
+
return;
|
|
270
|
+
try {
|
|
271
|
+
navigate(navigation.target);
|
|
272
|
+
} catch (error) {
|
|
273
|
+
console.error("[AiSessionEngine] onNavigate 执行失败:", error);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const session = this.getSession(tabKey);
|
|
277
|
+
const messages = session.messages.map(
|
|
278
|
+
(message) => message.navigation === navigation ? { ...message, applied: true } : message
|
|
279
|
+
);
|
|
280
|
+
messages.push(
|
|
281
|
+
createMessage(
|
|
282
|
+
"assistant",
|
|
283
|
+
`已前往「${navigation.target.label ?? navigation.target.tabKey}」。`
|
|
284
|
+
)
|
|
285
|
+
);
|
|
286
|
+
this.update(tabKey, { messages });
|
|
287
|
+
}
|
|
238
288
|
/** 撤回到上版:页面自管 rollback 优先,否则内置版本栈出栈并经 backfill 恢复 */
|
|
239
289
|
rollback(tabKey) {
|
|
240
290
|
var _a, _b;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./AiActionGuard";
|
|
2
2
|
export * from "./aiDraft";
|
|
3
|
-
export type { AiContext, AiMessage, AiMessageRole, AiPageActions, AiPageCapability, AiReference, AiReferenceTab, AiSession, AiSnapshot, AiStreamEvent, AiSuggestion, AiToolCallStatus, AiToolCallView, AiTransport, AiValidateIssue, AiValidateReport, FormPatch, } from "./types";
|
|
3
|
+
export type { AiContext, AiMessage, AiMessageRole, AiNavigateTarget, AiNavigationSuggestion, AiPageActions, AiPageCapability, AiReference, AiReferenceTab, AiSession, AiSnapshot, AiStreamEvent, AiSuggestion, AiToolCallStatus, AiToolCallView, AiTransport, AiValidateIssue, AiValidateReport, FormPatch, } from "./types";
|
|
4
4
|
export { AiSessionEngine } from "./AiSessionEngine";
|
|
5
5
|
export type { AiSessionEngineOptions } from "./AiSessionEngine";
|
|
6
6
|
export { MockAiTransport } from "./MockAiTransport";
|
|
@@ -74,6 +74,26 @@ export interface AiSuggestion {
|
|
|
74
74
|
/** 补丁数据:确认后传给 actions.backfill */
|
|
75
75
|
patch: FormPatch;
|
|
76
76
|
}
|
|
77
|
+
/** 导航目标(navigate 动作帧携带,由布局侧 onNavigate 执行) */
|
|
78
|
+
export interface AiNavigateTarget {
|
|
79
|
+
/** 目标页签 key(对应布局页签体系) */
|
|
80
|
+
tabKey: string;
|
|
81
|
+
/** 目标页签显示名(卡片与提示文案) */
|
|
82
|
+
label?: string;
|
|
83
|
+
/** 附加参数(菜单参数、路由 query 等,原样透传给 onNavigate) */
|
|
84
|
+
params?: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
/** 结构化导航建议(navigate 帧携带,用户点击「前往」后才执行) */
|
|
87
|
+
export interface AiNavigationSuggestion {
|
|
88
|
+
/** 建议类型 */
|
|
89
|
+
type: "navigate";
|
|
90
|
+
/** 卡片标题(如「建议前往订单中心」) */
|
|
91
|
+
title: string;
|
|
92
|
+
/** 摘要行(目标说明) */
|
|
93
|
+
items: string[];
|
|
94
|
+
/** 导航目标 */
|
|
95
|
+
target: AiNavigateTarget;
|
|
96
|
+
}
|
|
77
97
|
/** 工具调用状态 */
|
|
78
98
|
export type AiToolCallStatus = "pending" | "running" | "succeeded" | "failed" | "skipped";
|
|
79
99
|
/** 工具调用视图(tool 帧按 callId 归并后的展示结构;面板受控渲染) */
|
|
@@ -99,7 +119,9 @@ export interface AiMessage {
|
|
|
99
119
|
reasoning?: string;
|
|
100
120
|
/** 携带的结构化建议(仅 assistant 消息) */
|
|
101
121
|
suggestion?: AiSuggestion;
|
|
102
|
-
/**
|
|
122
|
+
/** 携带的导航建议(navigate 帧;用户点击「前往」后才执行) */
|
|
123
|
+
navigation?: AiNavigationSuggestion;
|
|
124
|
+
/** 建议(回填或导航)是否已确认(已确认后卡片置为已完成态;导航仍需用户点击才执行) */
|
|
103
125
|
applied?: boolean;
|
|
104
126
|
/** 本轮工具调用(tool 帧按 callId 归并;仅 assistant 消息) */
|
|
105
127
|
toolCalls?: AiToolCallView[];
|
|
@@ -139,6 +161,13 @@ export type AiStreamEvent = {
|
|
|
139
161
|
patch: FormPatch;
|
|
140
162
|
title?: string;
|
|
141
163
|
items?: string[];
|
|
164
|
+
} | {
|
|
165
|
+
type: "action";
|
|
166
|
+
actionType: "navigate";
|
|
167
|
+
/** 导航目标(仅渲染确认卡片,用户点击后才执行) */
|
|
168
|
+
target: AiNavigateTarget;
|
|
169
|
+
title?: string;
|
|
170
|
+
items?: string[];
|
|
142
171
|
} | {
|
|
143
172
|
type: "tool";
|
|
144
173
|
/** 调用唯一标识(同一 callId 多帧归并为一次调用,后帧覆盖状态与结果) */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties } from "react";
|
|
2
|
-
import type { AiMessage, AiReference, AiReferenceTab, AiSuggestion, AiToolCallView } from "../../ai-assistant/types";
|
|
2
|
+
import type { AiMessage, AiNavigationSuggestion, AiReference, AiReferenceTab, AiSuggestion, AiToolCallView } from "../../ai-assistant/types";
|
|
3
3
|
import "./index.scss";
|
|
4
4
|
export interface CompanyAiAssistantProps {
|
|
5
5
|
/** 消息列表(含流式累积中的消息) */
|
|
@@ -30,6 +30,8 @@ export interface CompanyAiAssistantProps {
|
|
|
30
30
|
onClose?: () => void;
|
|
31
31
|
/** 确认并回填(参数为最近一条待确认建议) */
|
|
32
32
|
onBackfill?: (suggestion: AiSuggestion) => void;
|
|
33
|
+
/** 确认导航(用户点击导航卡片「前往」后触发;缺省时按钮禁用) */
|
|
34
|
+
onNavigate?: (navigation: AiNavigationSuggestion) => void;
|
|
33
35
|
/** 撤回到上版 */
|
|
34
36
|
onRollback?: () => void;
|
|
35
37
|
/** 核验表单 */
|
|
@@ -61,6 +61,29 @@ function SuggestionCard({
|
|
|
61
61
|
)
|
|
62
62
|
] });
|
|
63
63
|
}
|
|
64
|
+
function NavigationCard({
|
|
65
|
+
navigation,
|
|
66
|
+
applied,
|
|
67
|
+
onConfirm
|
|
68
|
+
}) {
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "company-ai-assistant__card", children: [
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "company-ai-assistant__card-title", children: navigation.title }),
|
|
71
|
+
navigation.items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "company-ai-assistant__card-items", children: navigation.items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: item }, `${navigation.title}-${index}`)) }),
|
|
72
|
+
applied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "company-ai-assistant__card-done", children: "已前往" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
73
|
+
"button",
|
|
74
|
+
{
|
|
75
|
+
type: "button",
|
|
76
|
+
className: "company-ai-assistant__card-confirm",
|
|
77
|
+
disabled: !onConfirm,
|
|
78
|
+
onClick: () => onConfirm == null ? void 0 : onConfirm(navigation),
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SvgIcon.default, { name: "right", size: 12 }),
|
|
81
|
+
"前往"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] });
|
|
86
|
+
}
|
|
64
87
|
function ActionChip({
|
|
65
88
|
icon,
|
|
66
89
|
label,
|
|
@@ -152,6 +175,7 @@ function AssistantPanel({
|
|
|
152
175
|
onPinToggle,
|
|
153
176
|
onClose,
|
|
154
177
|
onBackfill,
|
|
178
|
+
onNavigate,
|
|
155
179
|
onRollback,
|
|
156
180
|
onValidate,
|
|
157
181
|
placeholder = "请输入",
|
|
@@ -265,7 +289,7 @@ function AssistantPanel({
|
|
|
265
289
|
toolCalls && toolCalls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallChain, { toolCalls }),
|
|
266
290
|
messages.map((message) => {
|
|
267
291
|
const isThinking = streaming && message.role === "assistant" && !message.content;
|
|
268
|
-
const isStreamingTail = isThinking && !message.reasoning && !message.suggestion;
|
|
292
|
+
const isStreamingTail = isThinking && !message.reasoning && !message.suggestion && !message.navigation;
|
|
269
293
|
const messageToolCalls = (toolCalls == null ? void 0 : toolCalls.length) ? void 0 : message.toolCalls;
|
|
270
294
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
271
295
|
"div",
|
|
@@ -295,6 +319,14 @@ function AssistantPanel({
|
|
|
295
319
|
applied: message.applied,
|
|
296
320
|
onConfirm: onBackfill
|
|
297
321
|
}
|
|
322
|
+
),
|
|
323
|
+
message.navigation && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
324
|
+
NavigationCard,
|
|
325
|
+
{
|
|
326
|
+
navigation: message.navigation,
|
|
327
|
+
applied: message.applied,
|
|
328
|
+
onConfirm: onNavigate
|
|
329
|
+
}
|
|
298
330
|
)
|
|
299
331
|
] })
|
|
300
332
|
},
|
|
@@ -151,6 +151,8 @@ var AiAsideBody = (0, import_react.memo)(function AiAsideBody2() {
|
|
|
151
151
|
togglePin,
|
|
152
152
|
send,
|
|
153
153
|
confirmSuggestion,
|
|
154
|
+
confirmNavigation,
|
|
155
|
+
canNavigate,
|
|
154
156
|
rollback,
|
|
155
157
|
validate,
|
|
156
158
|
reference,
|
|
@@ -182,6 +184,7 @@ var AiAsideBody = (0, import_react.memo)(function AiAsideBody2() {
|
|
|
182
184
|
onPinToggle: togglePin,
|
|
183
185
|
onClose: () => setOpen(false),
|
|
184
186
|
onBackfill: confirmSuggestion,
|
|
187
|
+
onNavigate: canNavigate ? confirmNavigation : void 0,
|
|
185
188
|
onRollback: rollback,
|
|
186
189
|
onValidate: validate
|
|
187
190
|
}
|
|
@@ -745,6 +748,7 @@ function AdminLayoutTemplate({
|
|
|
745
748
|
capability: aiCapability,
|
|
746
749
|
transport: aiTransport,
|
|
747
750
|
defaultOpen: aiAssistantDefaultOpen,
|
|
751
|
+
onNavigate: (target) => openTab(target.tabKey, target.label ?? target.tabKey),
|
|
748
752
|
children: tree
|
|
749
753
|
}
|
|
750
754
|
) : tree;
|
|
@@ -88,6 +88,8 @@ function DockBody({ children, width = 375, className, style }) {
|
|
|
88
88
|
togglePin,
|
|
89
89
|
send,
|
|
90
90
|
confirmSuggestion,
|
|
91
|
+
confirmNavigation,
|
|
92
|
+
canNavigate,
|
|
91
93
|
rollback,
|
|
92
94
|
validate
|
|
93
95
|
} = (0, import_AiAssistantProvider.useAiAssistantContext)();
|
|
@@ -122,6 +124,7 @@ function DockBody({ children, width = 375, className, style }) {
|
|
|
122
124
|
onPinToggle: togglePin,
|
|
123
125
|
onClose: () => setOpen(false),
|
|
124
126
|
onBackfill: confirmSuggestion,
|
|
127
|
+
onNavigate: canNavigate ? confirmNavigation : void 0,
|
|
125
128
|
onRollback: rollback,
|
|
126
129
|
onValidate: validate
|
|
127
130
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { AiPageCapability, AiReference, AiReferenceTab, AiSession, AiSuggestion, AiTransport } from "./types";
|
|
2
|
+
import type { AiContext, AiNavigateTarget, AiNavigationSuggestion, AiPageCapability, AiReference, AiReferenceTab, AiSession, AiSuggestion, AiTransport } from "./types";
|
|
3
3
|
/** 页签元数据:@ 引用列表数据源(capability 供引用非活动页签时查找能力契约) */
|
|
4
4
|
export interface AiTabMeta extends AiReferenceTab {
|
|
5
5
|
/** 该页签的能力契约(页面未挂载时其 getContext 可能拿不到实时值) */
|
|
@@ -9,7 +9,7 @@ export interface AiTabMeta extends AiReferenceTab {
|
|
|
9
9
|
export interface AiAssistantContextValue {
|
|
10
10
|
/** 面板是否展开(当前页签) */
|
|
11
11
|
open: boolean;
|
|
12
|
-
/**
|
|
12
|
+
/** 是否钉住(跨页签常驻;未钉住时是否随页签切换收起由 autoCollapseOnTabChange 控制) */
|
|
13
13
|
pinned: boolean;
|
|
14
14
|
/** 当前活动页签 key(会话隔离键) */
|
|
15
15
|
activeTabKey: string;
|
|
@@ -30,6 +30,10 @@ export interface AiAssistantContextValue {
|
|
|
30
30
|
togglePin: () => void;
|
|
31
31
|
send: (text: string) => void;
|
|
32
32
|
confirmSuggestion: (suggestion: AiSuggestion) => void;
|
|
33
|
+
/** 确认导航(用户点击「前往」后由面板调用) */
|
|
34
|
+
confirmNavigation: (navigation: AiNavigationSuggestion) => void;
|
|
35
|
+
/** 导航执行入口是否已配置(未配置时导航卡片按钮不可用) */
|
|
36
|
+
canNavigate: boolean;
|
|
33
37
|
rollback: () => void;
|
|
34
38
|
validate: () => void;
|
|
35
39
|
}
|
|
@@ -47,6 +51,19 @@ export interface AiAssistantProviderProps {
|
|
|
47
51
|
transport?: AiTransport;
|
|
48
52
|
/** 初始是否展开面板,默认 false */
|
|
49
53
|
defaultOpen?: boolean;
|
|
54
|
+
/** 初始是否钉住面板(钉住后跨页签常驻),默认 false */
|
|
55
|
+
defaultPinned?: boolean;
|
|
56
|
+
/** 切换页签时是否自动收起面板(仅未钉住时生效),默认 true(保持 1.x 行为) */
|
|
57
|
+
autoCollapseOnTabChange?: boolean;
|
|
58
|
+
/** 系统级上下文:无页面能力契约时随请求发送(默认不启用,scene 仍为 system) */
|
|
59
|
+
systemContext?: AiContext;
|
|
60
|
+
/**
|
|
61
|
+
* 兜底能力契约:无页面能力契约时启用(默认不启用)。
|
|
62
|
+
* 注意:启用后系统级交互会按其 actions 显示系统级动作芯片,并以其 scene 路由请求。
|
|
63
|
+
*/
|
|
64
|
+
fallbackCapability?: AiPageCapability;
|
|
65
|
+
/** 导航执行入口:用户点击导航卡片「前往」时调用(默认不启用,仅渲染确认卡片) */
|
|
66
|
+
onNavigate?: (target: AiNavigateTarget) => void;
|
|
50
67
|
}
|
|
51
68
|
/**
|
|
52
69
|
* AI 助手全局状态层:持有面板两态(open/pinned)与按 tabKey 隔离的会话表。
|
|
@@ -54,6 +71,6 @@ export interface AiAssistantProviderProps {
|
|
|
54
71
|
* - 内部创建 AiSessionEngine 并镜像其会话快照到组件状态
|
|
55
72
|
* - 未钉住时切换页签自动收起面板;页签关闭经 tabKeys 自动回收会话
|
|
56
73
|
*/
|
|
57
|
-
export declare function AiAssistantProvider({ children, activeTabKey, tabKeys, tabs, capability, transport, defaultOpen, }: AiAssistantProviderProps): import("react").JSX.Element;
|
|
74
|
+
export declare function AiAssistantProvider({ children, activeTabKey, tabKeys, tabs, capability, transport, defaultOpen, defaultPinned, autoCollapseOnTabChange, systemContext, fallbackCapability, onNavigate, }: AiAssistantProviderProps): import("react").JSX.Element;
|
|
58
75
|
/** 读取 AI 助手全局状态(需在 AiAssistantProvider 内使用) */
|
|
59
76
|
export declare function useAiAssistantContext(): AiAssistantContextValue;
|
|
@@ -35,12 +35,19 @@ export function AiAssistantProvider(_ref) {
|
|
|
35
35
|
capability = _ref.capability,
|
|
36
36
|
transport = _ref.transport,
|
|
37
37
|
_ref$defaultOpen = _ref.defaultOpen,
|
|
38
|
-
defaultOpen = _ref$defaultOpen === void 0 ? false : _ref$defaultOpen
|
|
38
|
+
defaultOpen = _ref$defaultOpen === void 0 ? false : _ref$defaultOpen,
|
|
39
|
+
_ref$defaultPinned = _ref.defaultPinned,
|
|
40
|
+
defaultPinned = _ref$defaultPinned === void 0 ? false : _ref$defaultPinned,
|
|
41
|
+
_ref$autoCollapseOnTa = _ref.autoCollapseOnTabChange,
|
|
42
|
+
autoCollapseOnTabChange = _ref$autoCollapseOnTa === void 0 ? true : _ref$autoCollapseOnTa,
|
|
43
|
+
systemContext = _ref.systemContext,
|
|
44
|
+
fallbackCapability = _ref.fallbackCapability,
|
|
45
|
+
onNavigate = _ref.onNavigate;
|
|
39
46
|
var _useState = useState(defaultOpen),
|
|
40
47
|
_useState2 = _slicedToArray(_useState, 2),
|
|
41
48
|
open = _useState2[0],
|
|
42
49
|
setOpen = _useState2[1];
|
|
43
|
-
var _useState3 = useState(
|
|
50
|
+
var _useState3 = useState(defaultPinned),
|
|
44
51
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
52
|
pinned = _useState4[0],
|
|
46
53
|
setPinned = _useState4[1];
|
|
@@ -75,6 +82,15 @@ export function AiAssistantProvider(_ref) {
|
|
|
75
82
|
tabsRef.current = tabs !== null && tabs !== void 0 ? tabs : [];
|
|
76
83
|
var referenceRef = useRef(reference);
|
|
77
84
|
referenceRef.current = reference;
|
|
85
|
+
// 新增可选项同样以 ref 供给引擎,运行期更新无需重建 Provider
|
|
86
|
+
var fallbackCapabilityRef = useRef(fallbackCapability);
|
|
87
|
+
fallbackCapabilityRef.current = fallbackCapability;
|
|
88
|
+
var systemContextRef = useRef(systemContext);
|
|
89
|
+
systemContextRef.current = systemContext;
|
|
90
|
+
var onNavigateRef = useRef(onNavigate);
|
|
91
|
+
onNavigateRef.current = onNavigate;
|
|
92
|
+
var autoCollapseRef = useRef(autoCollapseOnTabChange);
|
|
93
|
+
autoCollapseRef.current = autoCollapseOnTabChange;
|
|
78
94
|
var engine = useMemo(function () {
|
|
79
95
|
return new AiSessionEngine({
|
|
80
96
|
transport: transport !== null && transport !== void 0 ? transport : new MockAiTransport(),
|
|
@@ -84,14 +100,25 @@ export function AiAssistantProvider(_ref) {
|
|
|
84
100
|
// 仅当前活动页签的会话提供能力(其余页签会话为只读历史)
|
|
85
101
|
if (tabKey !== activeTabKeyRef.current) return undefined;
|
|
86
102
|
var ref = referenceRef.current;
|
|
87
|
-
// 无引用 =
|
|
88
|
-
if (!ref) return
|
|
89
|
-
//
|
|
90
|
-
if (ref.tabKey === activeTabKeyRef.current)
|
|
91
|
-
|
|
103
|
+
// 无引用 = 系统级交互:使用兜底契约(缺省不启用,保持原有 system 语义)
|
|
104
|
+
if (!ref) return fallbackCapabilityRef.current;
|
|
105
|
+
// 引用当前页签:页面契约优先,缺省回落兜底契约
|
|
106
|
+
if (ref.tabKey === activeTabKeyRef.current) {
|
|
107
|
+
var _capabilityRef$curren;
|
|
108
|
+
return (_capabilityRef$curren = capabilityRef.current) !== null && _capabilityRef$curren !== void 0 ? _capabilityRef$curren : fallbackCapabilityRef.current;
|
|
109
|
+
}
|
|
110
|
+
// 引用其他页签:从页签元数据查找其契约(页面未挂载时可能无;不回落到兜底,
|
|
111
|
+
// 避免系统级动作误作用到当前活动页签)
|
|
92
112
|
return (_tabsRef$current$find = tabsRef.current.find(function (tab) {
|
|
93
113
|
return tab.key === ref.tabKey;
|
|
94
114
|
})) === null || _tabsRef$current$find === void 0 ? void 0 : _tabsRef$current$find.capability;
|
|
115
|
+
},
|
|
116
|
+
getSystemContext: function getSystemContext() {
|
|
117
|
+
return systemContextRef.current;
|
|
118
|
+
},
|
|
119
|
+
onNavigate: function onNavigate(target) {
|
|
120
|
+
var _onNavigateRef$curren;
|
|
121
|
+
return (_onNavigateRef$curren = onNavigateRef.current) === null || _onNavigateRef$curren === void 0 ? void 0 : _onNavigateRef$curren.call(onNavigateRef, target);
|
|
95
122
|
}
|
|
96
123
|
});
|
|
97
124
|
// transport 仅在挂载时取值一次;运行期更换传输需重建 Provider
|
|
@@ -161,14 +188,15 @@ export function AiAssistantProvider(_ref) {
|
|
|
161
188
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
162
189
|
}, [tabKeysKey]);
|
|
163
190
|
|
|
164
|
-
//
|
|
191
|
+
// 切换页签:默认未钉住时自动收起面板(autoCollapseOnTabChange=false 可关闭;首次挂载不触发)
|
|
165
192
|
var mountedRef = useRef(false);
|
|
166
193
|
useEffect(function () {
|
|
167
194
|
if (!mountedRef.current) {
|
|
168
195
|
mountedRef.current = true;
|
|
169
196
|
return;
|
|
170
197
|
}
|
|
171
|
-
if (!pinnedRef.current)
|
|
198
|
+
if (!autoCollapseRef.current || pinnedRef.current) return;
|
|
199
|
+
setOpen(false);
|
|
172
200
|
}, [activeTabKey]);
|
|
173
201
|
var togglePin = useCallback(function () {
|
|
174
202
|
return setPinned(function (value) {
|
|
@@ -176,8 +204,11 @@ export function AiAssistantProvider(_ref) {
|
|
|
176
204
|
});
|
|
177
205
|
}, []);
|
|
178
206
|
var session = (_sessions$activeTabKe = sessions[activeTabKey]) !== null && _sessions$activeTabKe !== void 0 ? _sessions$activeTabKe : EMPTY_SESSION;
|
|
179
|
-
|
|
207
|
+
// 动作芯片:页面契约优先,缺省回落到兜底契约(兜底契约即“系统级动作芯片”的来源)
|
|
208
|
+
var actionCapability = capability !== null && capability !== void 0 ? capability : fallbackCapability;
|
|
209
|
+
var hasActions = Boolean((actionCapability === null || actionCapability === void 0 ? void 0 : actionCapability.actions) && Object.keys(actionCapability.actions).length > 0);
|
|
180
210
|
var canRollback = hasActions ? engine.canRollback(activeTabKey) : false;
|
|
211
|
+
var canNavigate = Boolean(onNavigate);
|
|
181
212
|
var value = useMemo(function () {
|
|
182
213
|
return {
|
|
183
214
|
open: open,
|
|
@@ -198,6 +229,10 @@ export function AiAssistantProvider(_ref) {
|
|
|
198
229
|
confirmSuggestion: function confirmSuggestion(suggestion) {
|
|
199
230
|
return engine.confirmSuggestion(activeTabKey, suggestion);
|
|
200
231
|
},
|
|
232
|
+
confirmNavigation: function confirmNavigation(navigation) {
|
|
233
|
+
return engine.confirmNavigation(activeTabKey, navigation);
|
|
234
|
+
},
|
|
235
|
+
canNavigate: canNavigate,
|
|
201
236
|
rollback: function rollback() {
|
|
202
237
|
return engine.rollback(activeTabKey);
|
|
203
238
|
},
|
|
@@ -205,7 +240,7 @@ export function AiAssistantProvider(_ref) {
|
|
|
205
240
|
return engine.validate(activeTabKey);
|
|
206
241
|
}
|
|
207
242
|
};
|
|
208
|
-
}, [open, pinned, activeTabKey, session, capability, hasActions, canRollback, reference, tabs, engine, handleSetOpen, togglePin]);
|
|
243
|
+
}, [open, pinned, activeTabKey, session, capability, hasActions, canRollback, canNavigate, reference, tabs, engine, handleSetOpen, togglePin]);
|
|
209
244
|
return /*#__PURE__*/_jsx(AiAssistantContext.Provider, {
|
|
210
245
|
value: value,
|
|
211
246
|
children: children
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type { AiPageCapability, AiSession, AiSuggestion, AiTransport } from "./types";
|
|
1
|
+
import type { AiContext, AiNavigateTarget, AiNavigationSuggestion, AiPageCapability, AiSession, AiSuggestion, AiTransport } from "./types";
|
|
2
2
|
/** 引擎选项 */
|
|
3
3
|
export interface AiSessionEngineOptions {
|
|
4
4
|
/** 流式传输(P1 mock / P2 SSE) */
|
|
5
5
|
transport: AiTransport;
|
|
6
6
|
/** 获取指定页签当前注册的能力契约(由 Provider 提供,返回 undefined 表示该页无契约) */
|
|
7
7
|
getCapability: (tabKey: string) => AiPageCapability | undefined;
|
|
8
|
+
/** 系统级上下文:无页面契约时随请求发送(缺省不启用,避免改变既有 system 场景语义) */
|
|
9
|
+
getSystemContext?: () => AiContext | undefined;
|
|
10
|
+
/** 导航执行入口:用户点击导航卡片「前往」时调用(缺省不启用,卡片按钮不可用) */
|
|
11
|
+
onNavigate?: (target: AiNavigateTarget) => void;
|
|
8
12
|
/** 版本栈深度,默认 10(超出丢弃最旧) */
|
|
9
13
|
maxSnapshots?: number;
|
|
10
14
|
/** 随请求发送的对话历史上限条数,默认 20(不含本轮消息) */
|
|
@@ -22,6 +26,8 @@ export declare class AiSessionEngine {
|
|
|
22
26
|
private readonly listeners;
|
|
23
27
|
private readonly transport;
|
|
24
28
|
private readonly getCapability;
|
|
29
|
+
private readonly getSystemContext;
|
|
30
|
+
private readonly onNavigate;
|
|
25
31
|
private readonly maxSnapshots;
|
|
26
32
|
private readonly maxHistory;
|
|
27
33
|
constructor(options: AiSessionEngineOptions);
|
|
@@ -33,6 +39,8 @@ export declare class AiSessionEngine {
|
|
|
33
39
|
send(tabKey: string, text: string): void;
|
|
34
40
|
/** 确认并回填:压栈快照 → 应用补丁 → 标记建议已应用 */
|
|
35
41
|
confirmSuggestion(tabKey: string, suggestion: AiSuggestion): void;
|
|
42
|
+
/** 确认导航:仅在用户点击「前往」后执行(不压栈、不回填,未配置 onNavigate 时为空操作) */
|
|
43
|
+
confirmNavigation(tabKey: string, navigation: AiNavigationSuggestion): void;
|
|
36
44
|
/** 撤回到上版:页面自管 rollback 优先,否则内置版本栈出栈并经 backfill 恢复 */
|
|
37
45
|
rollback(tabKey: string): void;
|
|
38
46
|
/** 核验表单/配置:报告以消息形式回显在对话流 */
|
|
@@ -58,10 +58,14 @@ export var AiSessionEngine = /*#__PURE__*/function () {
|
|
|
58
58
|
_defineProperty(this, "listeners", new Set());
|
|
59
59
|
_defineProperty(this, "transport", void 0);
|
|
60
60
|
_defineProperty(this, "getCapability", void 0);
|
|
61
|
+
_defineProperty(this, "getSystemContext", void 0);
|
|
62
|
+
_defineProperty(this, "onNavigate", void 0);
|
|
61
63
|
_defineProperty(this, "maxSnapshots", void 0);
|
|
62
64
|
_defineProperty(this, "maxHistory", void 0);
|
|
63
65
|
this.transport = options.transport;
|
|
64
66
|
this.getCapability = options.getCapability;
|
|
67
|
+
this.getSystemContext = options.getSystemContext;
|
|
68
|
+
this.onNavigate = options.onNavigate;
|
|
65
69
|
this.maxSnapshots = (_options$maxSnapshots = options.maxSnapshots) !== null && _options$maxSnapshots !== void 0 ? _options$maxSnapshots : 10;
|
|
66
70
|
this.maxHistory = (_options$maxHistory = options.maxHistory) !== null && _options$maxHistory !== void 0 ? _options$maxHistory : 20;
|
|
67
71
|
}
|
|
@@ -111,6 +115,15 @@ export var AiSessionEngine = /*#__PURE__*/function () {
|
|
|
111
115
|
} catch (_unused3) {
|
|
112
116
|
context = undefined;
|
|
113
117
|
}
|
|
118
|
+
// 无页面上下文时回落系统级上下文(默认未配置,保持原有空 context 行为)
|
|
119
|
+
if (!context) {
|
|
120
|
+
try {
|
|
121
|
+
var _this$getSystemContex;
|
|
122
|
+
context = (_this$getSystemContex = this.getSystemContext) === null || _this$getSystemContex === void 0 ? void 0 : _this$getSystemContex.call(this);
|
|
123
|
+
} catch (_unused4) {
|
|
124
|
+
context = undefined;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
114
127
|
|
|
115
128
|
// 本轮消息之前的对话历史:过滤空内容(流式占位/中断残留),按 maxHistory 截断最近条目
|
|
116
129
|
var history = session.messages.filter(function (item) {
|
|
@@ -161,15 +174,31 @@ export var AiSessionEngine = /*#__PURE__*/function () {
|
|
|
161
174
|
case "action":
|
|
162
175
|
{
|
|
163
176
|
if (isPlaceholder) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
177
|
+
if (event.actionType === "backfill") {
|
|
178
|
+
var _event$title, _event$items;
|
|
179
|
+
messages[messages.length - 1] = _objectSpread(_objectSpread({}, last), {}, {
|
|
180
|
+
suggestion: {
|
|
181
|
+
type: "backfill",
|
|
182
|
+
title: (_event$title = event.title) !== null && _event$title !== void 0 ? _event$title : "建议草稿",
|
|
183
|
+
items: (_event$items = event.items) !== null && _event$items !== void 0 ? _event$items : [],
|
|
184
|
+
patch: event.patch
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
} else if (event.actionType === "navigate") {
|
|
188
|
+
var _event$title2, _event$items2;
|
|
189
|
+
// 导航仅渲染确认卡片,不在此处执行跳转(执行入口在用户点击后的 confirmNavigation)
|
|
190
|
+
messages[messages.length - 1] = _objectSpread(_objectSpread({}, last), {}, {
|
|
191
|
+
navigation: {
|
|
192
|
+
type: "navigate",
|
|
193
|
+
title: (_event$title2 = event.title) !== null && _event$title2 !== void 0 ? _event$title2 : "建议前往",
|
|
194
|
+
items: (_event$items2 = event.items) !== null && _event$items2 !== void 0 ? _event$items2 : [],
|
|
195
|
+
target: event.target
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
} else {
|
|
199
|
+
// 未知动作一律忽略,绝不回退为 backfill(避免误改页面数据)
|
|
200
|
+
console.warn("[AiSessionEngine] 未知 actionType,已忽略:", event.actionType);
|
|
201
|
+
}
|
|
173
202
|
}
|
|
174
203
|
_this2.update(tabKey, {
|
|
175
204
|
messages: messages
|
|
@@ -267,7 +296,7 @@ export var AiSessionEngine = /*#__PURE__*/function () {
|
|
|
267
296
|
try {
|
|
268
297
|
var _capability$getContex;
|
|
269
298
|
snapshotData = safeClone((_capability$getContex = capability === null || capability === void 0 ? void 0 : capability.getContext().values) !== null && _capability$getContex !== void 0 ? _capability$getContex : {});
|
|
270
|
-
} catch (
|
|
299
|
+
} catch (_unused5) {
|
|
271
300
|
snapshotData = {};
|
|
272
301
|
}
|
|
273
302
|
var snapshots = [].concat(_toConsumableArray(session.snapshots), [{
|
|
@@ -297,6 +326,31 @@ export var AiSessionEngine = /*#__PURE__*/function () {
|
|
|
297
326
|
});
|
|
298
327
|
}
|
|
299
328
|
|
|
329
|
+
/** 确认导航:仅在用户点击「前往」后执行(不压栈、不回填,未配置 onNavigate 时为空操作) */
|
|
330
|
+
}, {
|
|
331
|
+
key: "confirmNavigation",
|
|
332
|
+
value: function confirmNavigation(tabKey, navigation) {
|
|
333
|
+
var _navigation$target$la;
|
|
334
|
+
var navigate = this.onNavigate;
|
|
335
|
+
if (!navigate) return;
|
|
336
|
+
try {
|
|
337
|
+
navigate(navigation.target);
|
|
338
|
+
} catch (error) {
|
|
339
|
+
console.error("[AiSessionEngine] onNavigate 执行失败:", error);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
var session = this.getSession(tabKey);
|
|
343
|
+
var messages = session.messages.map(function (message) {
|
|
344
|
+
return message.navigation === navigation ? _objectSpread(_objectSpread({}, message), {}, {
|
|
345
|
+
applied: true
|
|
346
|
+
}) : message;
|
|
347
|
+
});
|
|
348
|
+
messages.push(createMessage("assistant", "\u5DF2\u524D\u5F80\u300C".concat((_navigation$target$la = navigation.target.label) !== null && _navigation$target$la !== void 0 ? _navigation$target$la : navigation.target.tabKey, "\u300D\u3002")));
|
|
349
|
+
this.update(tabKey, {
|
|
350
|
+
messages: messages
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
300
354
|
/** 撤回到上版:页面自管 rollback 优先,否则内置版本栈出栈并经 backfill 恢复 */
|
|
301
355
|
}, {
|
|
302
356
|
key: "rollback",
|
|
@@ -420,7 +474,7 @@ export var AiSessionEngine = /*#__PURE__*/function () {
|
|
|
420
474
|
var sceneTitle;
|
|
421
475
|
try {
|
|
422
476
|
sceneTitle = capability === null || capability === void 0 ? void 0 : capability.getContext().sceneTitle;
|
|
423
|
-
} catch (
|
|
477
|
+
} catch (_unused6) {
|
|
424
478
|
sceneTitle = undefined;
|
|
425
479
|
}
|
|
426
480
|
if (sceneTitle) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./AiActionGuard";
|
|
2
2
|
export * from "./aiDraft";
|
|
3
|
-
export type { AiContext, AiMessage, AiMessageRole, AiPageActions, AiPageCapability, AiReference, AiReferenceTab, AiSession, AiSnapshot, AiStreamEvent, AiSuggestion, AiToolCallStatus, AiToolCallView, AiTransport, AiValidateIssue, AiValidateReport, FormPatch, } from "./types";
|
|
3
|
+
export type { AiContext, AiMessage, AiMessageRole, AiNavigateTarget, AiNavigationSuggestion, AiPageActions, AiPageCapability, AiReference, AiReferenceTab, AiSession, AiSnapshot, AiStreamEvent, AiSuggestion, AiToolCallStatus, AiToolCallView, AiTransport, AiValidateIssue, AiValidateReport, FormPatch, } from "./types";
|
|
4
4
|
export { AiSessionEngine } from "./AiSessionEngine";
|
|
5
5
|
export type { AiSessionEngineOptions } from "./AiSessionEngine";
|
|
6
6
|
export { MockAiTransport } from "./MockAiTransport";
|
|
@@ -74,6 +74,26 @@ export interface AiSuggestion {
|
|
|
74
74
|
/** 补丁数据:确认后传给 actions.backfill */
|
|
75
75
|
patch: FormPatch;
|
|
76
76
|
}
|
|
77
|
+
/** 导航目标(navigate 动作帧携带,由布局侧 onNavigate 执行) */
|
|
78
|
+
export interface AiNavigateTarget {
|
|
79
|
+
/** 目标页签 key(对应布局页签体系) */
|
|
80
|
+
tabKey: string;
|
|
81
|
+
/** 目标页签显示名(卡片与提示文案) */
|
|
82
|
+
label?: string;
|
|
83
|
+
/** 附加参数(菜单参数、路由 query 等,原样透传给 onNavigate) */
|
|
84
|
+
params?: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
/** 结构化导航建议(navigate 帧携带,用户点击「前往」后才执行) */
|
|
87
|
+
export interface AiNavigationSuggestion {
|
|
88
|
+
/** 建议类型 */
|
|
89
|
+
type: "navigate";
|
|
90
|
+
/** 卡片标题(如「建议前往订单中心」) */
|
|
91
|
+
title: string;
|
|
92
|
+
/** 摘要行(目标说明) */
|
|
93
|
+
items: string[];
|
|
94
|
+
/** 导航目标 */
|
|
95
|
+
target: AiNavigateTarget;
|
|
96
|
+
}
|
|
77
97
|
/** 工具调用状态 */
|
|
78
98
|
export type AiToolCallStatus = "pending" | "running" | "succeeded" | "failed" | "skipped";
|
|
79
99
|
/** 工具调用视图(tool 帧按 callId 归并后的展示结构;面板受控渲染) */
|
|
@@ -99,7 +119,9 @@ export interface AiMessage {
|
|
|
99
119
|
reasoning?: string;
|
|
100
120
|
/** 携带的结构化建议(仅 assistant 消息) */
|
|
101
121
|
suggestion?: AiSuggestion;
|
|
102
|
-
/**
|
|
122
|
+
/** 携带的导航建议(navigate 帧;用户点击「前往」后才执行) */
|
|
123
|
+
navigation?: AiNavigationSuggestion;
|
|
124
|
+
/** 建议(回填或导航)是否已确认(已确认后卡片置为已完成态;导航仍需用户点击才执行) */
|
|
103
125
|
applied?: boolean;
|
|
104
126
|
/** 本轮工具调用(tool 帧按 callId 归并;仅 assistant 消息) */
|
|
105
127
|
toolCalls?: AiToolCallView[];
|
|
@@ -139,6 +161,13 @@ export type AiStreamEvent = {
|
|
|
139
161
|
patch: FormPatch;
|
|
140
162
|
title?: string;
|
|
141
163
|
items?: string[];
|
|
164
|
+
} | {
|
|
165
|
+
type: "action";
|
|
166
|
+
actionType: "navigate";
|
|
167
|
+
/** 导航目标(仅渲染确认卡片,用户点击后才执行) */
|
|
168
|
+
target: AiNavigateTarget;
|
|
169
|
+
title?: string;
|
|
170
|
+
items?: string[];
|
|
142
171
|
} | {
|
|
143
172
|
type: "tool";
|
|
144
173
|
/** 调用唯一标识(同一 callId 多帧归并为一次调用,后帧覆盖状态与结果) */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties } from "react";
|
|
2
|
-
import type { AiMessage, AiReference, AiReferenceTab, AiSuggestion, AiToolCallView } from "../../ai-assistant/types";
|
|
2
|
+
import type { AiMessage, AiNavigationSuggestion, AiReference, AiReferenceTab, AiSuggestion, AiToolCallView } from "../../ai-assistant/types";
|
|
3
3
|
import "./index.scss";
|
|
4
4
|
export interface CompanyAiAssistantProps {
|
|
5
5
|
/** 消息列表(含流式累积中的消息) */
|
|
@@ -30,6 +30,8 @@ export interface CompanyAiAssistantProps {
|
|
|
30
30
|
onClose?: () => void;
|
|
31
31
|
/** 确认并回填(参数为最近一条待确认建议) */
|
|
32
32
|
onBackfill?: (suggestion: AiSuggestion) => void;
|
|
33
|
+
/** 确认导航(用户点击导航卡片「前往」后触发;缺省时按钮禁用) */
|
|
34
|
+
onNavigate?: (navigation: AiNavigationSuggestion) => void;
|
|
33
35
|
/** 撤回到上版 */
|
|
34
36
|
onRollback?: () => void;
|
|
35
37
|
/** 核验表单 */
|
|
@@ -52,12 +52,47 @@ function SuggestionCard(_ref) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/** 导航建议卡片:默认只展示,用户点击「前往」后才执行 */
|
|
56
|
+
function NavigationCard(_ref2) {
|
|
57
|
+
var navigation = _ref2.navigation,
|
|
58
|
+
applied = _ref2.applied,
|
|
59
|
+
onConfirm = _ref2.onConfirm;
|
|
60
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
61
|
+
className: "company-ai-assistant__card",
|
|
62
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
63
|
+
className: "company-ai-assistant__card-title",
|
|
64
|
+
children: navigation.title
|
|
65
|
+
}), navigation.items.length > 0 && /*#__PURE__*/_jsx("ul", {
|
|
66
|
+
className: "company-ai-assistant__card-items",
|
|
67
|
+
children: navigation.items.map(function (item, index) {
|
|
68
|
+
return /*#__PURE__*/_jsx("li", {
|
|
69
|
+
children: item
|
|
70
|
+
}, "".concat(navigation.title, "-").concat(index));
|
|
71
|
+
})
|
|
72
|
+
}), applied ? /*#__PURE__*/_jsx("span", {
|
|
73
|
+
className: "company-ai-assistant__card-done",
|
|
74
|
+
children: "\u5DF2\u524D\u5F80"
|
|
75
|
+
}) : /*#__PURE__*/_jsxs("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
className: "company-ai-assistant__card-confirm",
|
|
78
|
+
disabled: !onConfirm,
|
|
79
|
+
onClick: function onClick() {
|
|
80
|
+
return onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(navigation);
|
|
81
|
+
},
|
|
82
|
+
children: [/*#__PURE__*/_jsx(SvgIcon, {
|
|
83
|
+
name: "right",
|
|
84
|
+
size: 12
|
|
85
|
+
}), "\u524D\u5F80"]
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
55
90
|
/** 动作芯片 */
|
|
56
|
-
function ActionChip(
|
|
57
|
-
var icon =
|
|
58
|
-
label =
|
|
59
|
-
disabled =
|
|
60
|
-
onClick =
|
|
91
|
+
function ActionChip(_ref3) {
|
|
92
|
+
var icon = _ref3.icon,
|
|
93
|
+
label = _ref3.label,
|
|
94
|
+
disabled = _ref3.disabled,
|
|
95
|
+
onClick = _ref3.onClick;
|
|
61
96
|
return /*#__PURE__*/_jsxs("button", {
|
|
62
97
|
type: "button",
|
|
63
98
|
className: "company-ai-assistant__chip",
|
|
@@ -96,8 +131,8 @@ function toChainStatus(status) {
|
|
|
96
131
|
}
|
|
97
132
|
|
|
98
133
|
/** 工具调用折叠思维链(每个调用一个可折叠节点,标题带状态色文案) */
|
|
99
|
-
function ToolCallChain(
|
|
100
|
-
var toolCalls =
|
|
134
|
+
function ToolCallChain(_ref4) {
|
|
135
|
+
var toolCalls = _ref4.toolCalls;
|
|
101
136
|
var items = toolCalls.map(function (call) {
|
|
102
137
|
var chainStatus = toChainStatus(call.status);
|
|
103
138
|
return _objectSpread(_objectSpread({
|
|
@@ -146,32 +181,33 @@ export default function CompanyAiAssistant(props) {
|
|
|
146
181
|
children: /*#__PURE__*/_jsx(AssistantPanel, _objectSpread({}, props))
|
|
147
182
|
});
|
|
148
183
|
}
|
|
149
|
-
function AssistantPanel(
|
|
150
|
-
var messages =
|
|
151
|
-
|
|
152
|
-
streaming =
|
|
153
|
-
|
|
154
|
-
pinned =
|
|
155
|
-
|
|
156
|
-
showActions =
|
|
157
|
-
|
|
158
|
-
canRollback =
|
|
159
|
-
|
|
160
|
-
canValidate =
|
|
161
|
-
reference =
|
|
162
|
-
referenceTabs =
|
|
163
|
-
toolCalls =
|
|
164
|
-
onSend =
|
|
165
|
-
onReferenceChange =
|
|
166
|
-
onPinToggle =
|
|
167
|
-
onClose =
|
|
168
|
-
onBackfill =
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
placeholder =
|
|
173
|
-
|
|
174
|
-
|
|
184
|
+
function AssistantPanel(_ref5) {
|
|
185
|
+
var messages = _ref5.messages,
|
|
186
|
+
_ref5$streaming = _ref5.streaming,
|
|
187
|
+
streaming = _ref5$streaming === void 0 ? false : _ref5$streaming,
|
|
188
|
+
_ref5$pinned = _ref5.pinned,
|
|
189
|
+
pinned = _ref5$pinned === void 0 ? false : _ref5$pinned,
|
|
190
|
+
_ref5$showActions = _ref5.showActions,
|
|
191
|
+
showActions = _ref5$showActions === void 0 ? false : _ref5$showActions,
|
|
192
|
+
_ref5$canRollback = _ref5.canRollback,
|
|
193
|
+
canRollback = _ref5$canRollback === void 0 ? false : _ref5$canRollback,
|
|
194
|
+
_ref5$canValidate = _ref5.canValidate,
|
|
195
|
+
canValidate = _ref5$canValidate === void 0 ? true : _ref5$canValidate,
|
|
196
|
+
reference = _ref5.reference,
|
|
197
|
+
referenceTabs = _ref5.referenceTabs,
|
|
198
|
+
toolCalls = _ref5.toolCalls,
|
|
199
|
+
onSend = _ref5.onSend,
|
|
200
|
+
onReferenceChange = _ref5.onReferenceChange,
|
|
201
|
+
onPinToggle = _ref5.onPinToggle,
|
|
202
|
+
onClose = _ref5.onClose,
|
|
203
|
+
onBackfill = _ref5.onBackfill,
|
|
204
|
+
onNavigate = _ref5.onNavigate,
|
|
205
|
+
onRollback = _ref5.onRollback,
|
|
206
|
+
onValidate = _ref5.onValidate,
|
|
207
|
+
_ref5$placeholder = _ref5.placeholder,
|
|
208
|
+
placeholder = _ref5$placeholder === void 0 ? "请输入" : _ref5$placeholder,
|
|
209
|
+
className = _ref5.className,
|
|
210
|
+
style = _ref5.style;
|
|
175
211
|
var _theme$useToken = theme.useToken(),
|
|
176
212
|
token = _theme$useToken.token;
|
|
177
213
|
var _useState = useState(""),
|
|
@@ -306,7 +342,7 @@ function AssistantPanel(_ref4) {
|
|
|
306
342
|
toolCalls: toolCalls
|
|
307
343
|
}), messages.map(function (message) {
|
|
308
344
|
var isThinking = streaming && message.role === "assistant" && !message.content;
|
|
309
|
-
var isStreamingTail = isThinking && !message.reasoning && !message.suggestion;
|
|
345
|
+
var isStreamingTail = isThinking && !message.reasoning && !message.suggestion && !message.navigation;
|
|
310
346
|
// 工具状态:顶层受控 toolCalls 优先,缺省时回落渲染该条消息自带的 toolCalls(引擎归并结果)
|
|
311
347
|
var messageToolCalls = toolCalls !== null && toolCalls !== void 0 && toolCalls.length ? undefined : message.toolCalls;
|
|
312
348
|
return /*#__PURE__*/_jsx("div", {
|
|
@@ -334,6 +370,10 @@ function AssistantPanel(_ref4) {
|
|
|
334
370
|
suggestion: message.suggestion,
|
|
335
371
|
applied: message.applied,
|
|
336
372
|
onConfirm: onBackfill
|
|
373
|
+
}), message.navigation && /*#__PURE__*/_jsx(NavigationCard, {
|
|
374
|
+
navigation: message.navigation,
|
|
375
|
+
applied: message.applied,
|
|
376
|
+
onConfirm: onNavigate
|
|
337
377
|
})]
|
|
338
378
|
})
|
|
339
379
|
}, message.id);
|
|
@@ -369,9 +409,9 @@ function AssistantPanel(_ref4) {
|
|
|
369
409
|
onOpenChange: setSuggestOpen,
|
|
370
410
|
onSelect: handleSelectReference,
|
|
371
411
|
block: true,
|
|
372
|
-
children: function children(
|
|
373
|
-
var onTrigger =
|
|
374
|
-
_onKeyDown =
|
|
412
|
+
children: function children(_ref6) {
|
|
413
|
+
var onTrigger = _ref6.onTrigger,
|
|
414
|
+
_onKeyDown = _ref6.onKeyDown;
|
|
375
415
|
return /*#__PURE__*/_jsxs("div", {
|
|
376
416
|
className: "company-ai-assistant__input-area",
|
|
377
417
|
children: [suggestEnabled && /*#__PURE__*/_jsx("div", {
|
|
@@ -241,6 +241,8 @@ var AiAsideBody = /*#__PURE__*/memo(function AiAsideBody() {
|
|
|
241
241
|
togglePin = _useAiAssistantContex2.togglePin,
|
|
242
242
|
send = _useAiAssistantContex2.send,
|
|
243
243
|
confirmSuggestion = _useAiAssistantContex2.confirmSuggestion,
|
|
244
|
+
confirmNavigation = _useAiAssistantContex2.confirmNavigation,
|
|
245
|
+
canNavigate = _useAiAssistantContex2.canNavigate,
|
|
244
246
|
rollback = _useAiAssistantContex2.rollback,
|
|
245
247
|
validate = _useAiAssistantContex2.validate,
|
|
246
248
|
reference = _useAiAssistantContex2.reference,
|
|
@@ -271,6 +273,7 @@ var AiAsideBody = /*#__PURE__*/memo(function AiAsideBody() {
|
|
|
271
273
|
return setOpen(false);
|
|
272
274
|
},
|
|
273
275
|
onBackfill: confirmSuggestion,
|
|
276
|
+
onNavigate: canNavigate ? confirmNavigation : undefined,
|
|
274
277
|
onRollback: rollback,
|
|
275
278
|
onValidate: validate
|
|
276
279
|
})
|
|
@@ -928,6 +931,10 @@ export default function AdminLayoutTemplate(_ref2) {
|
|
|
928
931
|
capability: aiCapability,
|
|
929
932
|
transport: aiTransport,
|
|
930
933
|
defaultOpen: aiAssistantDefaultOpen,
|
|
934
|
+
onNavigate: function onNavigate(target) {
|
|
935
|
+
var _target$label;
|
|
936
|
+
return openTab(target.tabKey, (_target$label = target.label) !== null && _target$label !== void 0 ? _target$label : target.tabKey);
|
|
937
|
+
},
|
|
931
938
|
children: tree
|
|
932
939
|
}) : tree;
|
|
933
940
|
}
|
|
@@ -132,6 +132,8 @@ function DockBody(_ref2) {
|
|
|
132
132
|
togglePin = _useAiAssistantContex2.togglePin,
|
|
133
133
|
send = _useAiAssistantContex2.send,
|
|
134
134
|
confirmSuggestion = _useAiAssistantContex2.confirmSuggestion,
|
|
135
|
+
confirmNavigation = _useAiAssistantContex2.confirmNavigation,
|
|
136
|
+
canNavigate = _useAiAssistantContex2.canNavigate,
|
|
135
137
|
rollback = _useAiAssistantContex2.rollback,
|
|
136
138
|
validate = _useAiAssistantContex2.validate;
|
|
137
139
|
var _theme$useToken = theme.useToken(),
|
|
@@ -168,6 +170,7 @@ function DockBody(_ref2) {
|
|
|
168
170
|
return setOpen(false);
|
|
169
171
|
},
|
|
170
172
|
onBackfill: confirmSuggestion,
|
|
173
|
+
onNavigate: canNavigate ? confirmNavigation : undefined,
|
|
171
174
|
onRollback: rollback,
|
|
172
175
|
onValidate: validate
|
|
173
176
|
})
|