@auipage/core 0.1.0-alpha.5 → 0.2.0-alpha.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/CHANGELOG +26 -1
- package/README.md +99 -25
- package/dist/index.js +711 -282
- package/package.json +2 -2
- package/src/AuiPage.js +563 -256
- package/src/ChatContentRuntime.js +3 -0
- package/src/ChatTransportAdapter.js +5 -0
- package/src/MessageStream.js +2 -0
- package/src/ThreadListAdapter.js +2 -0
- package/src/defineTool.js +2 -0
- package/src/generator.js +40 -26
- package/src/index.js +5 -1
- package/src/tools/toHistoryMessages.js +6 -3
- package/src/tools/toModelMessages.js +89 -0
- package/types/adapters/chat-transport.d.ts +5 -0
- package/types/auipage.d.ts +56 -3
- package/types/index.d.ts +2 -0
- package/types/message.d.ts +6 -0
- package/types/to-model-messages.d.ts +15 -0
- package/types/tool.d.ts +6 -0
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { initOption } from "oipage/web/option/index.js";
|
|
2
2
|
import { EmptyFunction } from "./tools/enum.js";
|
|
3
3
|
|
|
4
|
+
// #doc:ctor
|
|
4
5
|
const DEFAUTL_OPTIONS = {
|
|
5
6
|
init: EmptyFunction,
|
|
6
7
|
append: EmptyFunction,
|
|
7
8
|
};
|
|
8
9
|
|
|
10
|
+
// #end
|
|
11
|
+
|
|
9
12
|
function ChatContentRuntime(options) {
|
|
10
13
|
this.name="ChatContentRuntime";
|
|
11
14
|
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { initOption } from "oipage/web/option/index.js";
|
|
2
2
|
import { EmptyFunction } from "./tools/enum.js";
|
|
3
3
|
|
|
4
|
+
// #doc:ctor
|
|
4
5
|
const DEFAUTL_OPTIONS = {
|
|
5
6
|
run: EmptyFunction,
|
|
6
7
|
response: EmptyFunction,
|
|
7
8
|
};
|
|
8
9
|
|
|
10
|
+
// #end
|
|
11
|
+
|
|
9
12
|
function ChatTransportAdapter(options) {
|
|
10
13
|
this.name="ChatTransportAdapter";
|
|
11
14
|
|
|
15
|
+
// #doc:merge
|
|
12
16
|
let value = initOption(options, { ...DEFAUTL_OPTIONS });
|
|
13
17
|
for (let key in DEFAUTL_OPTIONS) {
|
|
14
18
|
this[key] = value[key];
|
|
15
19
|
}
|
|
20
|
+
// #end
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
export default ChatTransportAdapter;
|
package/src/MessageStream.js
CHANGED
package/src/ThreadListAdapter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { initOption } from "oipage/web/option/index.js";
|
|
2
2
|
import { EmptyFunction } from "./tools/enum.js";
|
|
3
3
|
|
|
4
|
+
// #doc:methods
|
|
4
5
|
const DEFAUTL_OPTIONS = {
|
|
5
6
|
list: EmptyFunction,
|
|
6
7
|
new: EmptyFunction,
|
|
@@ -8,6 +9,7 @@ const DEFAUTL_OPTIONS = {
|
|
|
8
9
|
unarchive: EmptyFunction,
|
|
9
10
|
delete: EmptyFunction
|
|
10
11
|
};
|
|
12
|
+
// #end
|
|
11
13
|
|
|
12
14
|
function ThreadListAdapter(options) {
|
|
13
15
|
this.name="ThreadListAdapter";
|
package/src/defineTool.js
CHANGED
package/src/generator.js
CHANGED
|
@@ -8,16 +8,24 @@ export default async function* (rawFun) {
|
|
|
8
8
|
let ended = false;
|
|
9
9
|
// 生产者是否已报错;一旦设置,后续 next/done 调用被忽略
|
|
10
10
|
let errored = null;
|
|
11
|
+
// 消费者是否已退出(return / throw),退出后不再接收生产者推送
|
|
12
|
+
let cancelled = false;
|
|
13
|
+
|
|
14
|
+
const resolvePending = (payload) => {
|
|
15
|
+
if (!pending) return;
|
|
16
|
+
const p = pending;
|
|
17
|
+
pending = null;
|
|
18
|
+
p.resolve(payload);
|
|
19
|
+
};
|
|
11
20
|
|
|
12
21
|
// 启动生产者,三个回调驱动数据流
|
|
13
22
|
rawFun(
|
|
14
23
|
// next:推送下一个值
|
|
15
24
|
(value) => {
|
|
16
|
-
if (errored) return;
|
|
25
|
+
if (errored || cancelled) return;
|
|
17
26
|
if (pending) {
|
|
18
27
|
// 有等待中的消费者,立刻交值
|
|
19
|
-
|
|
20
|
-
pending = null;
|
|
28
|
+
resolvePending({ value, done: false });
|
|
21
29
|
} else {
|
|
22
30
|
// 否则入队缓存
|
|
23
31
|
queue.push(value);
|
|
@@ -25,40 +33,46 @@ export default async function* (rawFun) {
|
|
|
25
33
|
},
|
|
26
34
|
// done:结束
|
|
27
35
|
() => {
|
|
28
|
-
if (errored) return;
|
|
36
|
+
if (errored || cancelled) return;
|
|
29
37
|
ended = true;
|
|
30
|
-
|
|
31
|
-
pending.resolve({ value: void 0, done: true });
|
|
32
|
-
pending = null;
|
|
33
|
-
}
|
|
38
|
+
resolvePending({ value: void 0, done: true });
|
|
34
39
|
},
|
|
35
40
|
// error:异常
|
|
36
41
|
(err) => {
|
|
42
|
+
if (cancelled) return;
|
|
37
43
|
errored = err;
|
|
38
44
|
if (pending) {
|
|
39
|
-
pending
|
|
45
|
+
const p = pending;
|
|
40
46
|
pending = null;
|
|
47
|
+
p.reject(err);
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
50
|
);
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
try {
|
|
53
|
+
// 消费者主循环
|
|
54
|
+
while (true) {
|
|
55
|
+
if (errored) throw errored;
|
|
56
|
+
// 优先消费缓冲
|
|
57
|
+
if (queue.length) {
|
|
58
|
+
yield queue.shift();
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
// 缓冲空且生产者已结束 → 终止迭代
|
|
62
|
+
if (ended) return;
|
|
63
|
+
// 缓冲空且未结束 → 挂起等待生产者回调唤醒
|
|
64
|
+
const result = await new Promise((resolve, reject) => {
|
|
65
|
+
pending = { resolve, reject };
|
|
66
|
+
});
|
|
67
|
+
// 被唤醒后再判一次 error,防止回调已设 errored 但未分发
|
|
68
|
+
if (errored) throw errored;
|
|
69
|
+
if (result.done) return;
|
|
70
|
+
yield result.value;
|
|
52
71
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
59
|
-
// 被唤醒后再判一次 error,防止回调已设 errored 但未分发
|
|
60
|
-
if (errored) throw errored;
|
|
61
|
-
if (result.done) return;
|
|
62
|
-
yield result.value;
|
|
72
|
+
} finally {
|
|
73
|
+
// 消费者提前退出:停止接收,释放缓冲与挂起的控制器
|
|
74
|
+
cancelled = true;
|
|
75
|
+
queue.length = 0;
|
|
76
|
+
resolvePending({ value: void 0, done: true });
|
|
63
77
|
}
|
|
64
78
|
}
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// #doc:exports
|
|
1
2
|
export { default as AuiPage } from "./AuiPage.js";
|
|
2
3
|
|
|
3
4
|
export { default as ChatTransportAdapter } from "./ChatTransportAdapter.js";
|
|
@@ -9,4 +10,7 @@ export { default as ChatContentRuntime } from "./ChatContentRuntime.js";
|
|
|
9
10
|
|
|
10
11
|
export { default as defineTool } from "./defineTool.js";
|
|
11
12
|
export { default as generator } from "./generator.js";
|
|
12
|
-
export { default as MessageStream } from "./MessageStream.js";
|
|
13
|
+
export { default as MessageStream } from "./MessageStream.js";
|
|
14
|
+
|
|
15
|
+
export { default as toModelMessages } from "./tools/toModelMessages.js";
|
|
16
|
+
// #end
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
// #doc:merge
|
|
1
2
|
export default function (value) {
|
|
2
3
|
|
|
3
4
|
let messages = [], index = -1;
|
|
4
|
-
for (let message of value.messages) {
|
|
5
|
+
for (let message of value.messages || []) {
|
|
5
6
|
|
|
6
7
|
if (index != -1 && messages[index].role === message.role) {
|
|
8
|
+
// 复制内容数组,避免改写入参消息对象
|
|
7
9
|
messages[index].content.push(...message.content);
|
|
8
10
|
} else {
|
|
9
|
-
messages.push(message);
|
|
11
|
+
messages.push(Object.assign({}, message, { content: (message.content || []).slice() }));
|
|
10
12
|
index = messages.length - 1;
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
value.messages = messages;
|
|
15
17
|
return value;
|
|
16
|
-
}
|
|
18
|
+
}
|
|
19
|
+
// #end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// 页面消息(富片段)→ 模型线上消息(纯文本 + tool_calls / tool 结果)
|
|
2
|
+
|
|
3
|
+
// 入参既可以是历史消息组数组,也可以是纯消息数组
|
|
4
|
+
// #doc:flat
|
|
5
|
+
function flatten(input) {
|
|
6
|
+
const list = [];
|
|
7
|
+
for (const item of input || []) {
|
|
8
|
+
if (!item) continue;
|
|
9
|
+
if (Array.isArray(item.messages)) list.push(...item.messages);
|
|
10
|
+
else list.push(item);
|
|
11
|
+
}
|
|
12
|
+
return list;
|
|
13
|
+
}
|
|
14
|
+
// #end
|
|
15
|
+
|
|
16
|
+
// 只拼接 text 片段;thinking / loading 与自定义片段不进模型上下文
|
|
17
|
+
function textOf(parts) {
|
|
18
|
+
let text = "";
|
|
19
|
+
for (const part of parts) {
|
|
20
|
+
if (!part || part.type !== "text" || typeof part.text !== "string") continue;
|
|
21
|
+
text += part.text;
|
|
22
|
+
}
|
|
23
|
+
return text;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function contentOf(value) {
|
|
27
|
+
if (typeof value === "string") return value;
|
|
28
|
+
if (value instanceof Error) return String(value);
|
|
29
|
+
try {
|
|
30
|
+
const text = JSON.stringify(value);
|
|
31
|
+
return typeof text === "string" ? text : "";
|
|
32
|
+
} catch (e) {
|
|
33
|
+
return String(value);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 把页面侧的历史消息转换为模型可用的 ChatMessage 数组。
|
|
39
|
+
*
|
|
40
|
+
* @param {Array} input 历史消息组数组(HistoryMessageGroup[])或消息数组(ChatContentMessage[])
|
|
41
|
+
* @returns {Array} 可直接作为 completions.messages 的数组
|
|
42
|
+
*/
|
|
43
|
+
export default function toModelMessages(input) {
|
|
44
|
+
const messages = flatten(input);
|
|
45
|
+
const result = [];
|
|
46
|
+
let seq = 0;
|
|
47
|
+
|
|
48
|
+
for (const message of messages) {
|
|
49
|
+
const parts = Array.isArray(message.content) ? message.content : [];
|
|
50
|
+
const text = typeof message.content === "string" ? message.content : textOf(parts);
|
|
51
|
+
|
|
52
|
+
// #doc:calls
|
|
53
|
+
// 只保留已结束的工具调用,避免模型收到没有结果的 tool_call
|
|
54
|
+
const calls = parts.filter(part => part
|
|
55
|
+
&& part.type === "tool-call"
|
|
56
|
+
&& typeof part.name === "string"
|
|
57
|
+
&& (part.status === "success" || part.status === "error"));
|
|
58
|
+
|
|
59
|
+
if (calls.length === 0) {
|
|
60
|
+
if (text) result.push({ role: message.role, content: text });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 历史片段可能没有 id,这里补一个稳定 id,让 tool 消息能对应上
|
|
65
|
+
const tool_calls = calls.map(call => ({
|
|
66
|
+
id: call.id || ("call_" + (++seq)),
|
|
67
|
+
type: "function",
|
|
68
|
+
function: {
|
|
69
|
+
name: call.name,
|
|
70
|
+
arguments: JSON.stringify(call.args || {})
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
|
|
74
|
+
result.push({ role: "assistant", content: text || void 0, tool_calls });
|
|
75
|
+
|
|
76
|
+
calls.forEach((call, i) => {
|
|
77
|
+
const payload = call.ui && call.ui.status ? call.ui.result : call.result;
|
|
78
|
+
result.push({
|
|
79
|
+
role: "tool",
|
|
80
|
+
tool_call_id: tool_calls[i].id,
|
|
81
|
+
tool_name: call.name,
|
|
82
|
+
content: contentOf(payload)
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
// #end
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
@@ -18,6 +18,11 @@ export interface ChatTransportRunParams {
|
|
|
18
18
|
history: HistoryMessageGroup[];
|
|
19
19
|
/** AuiPage 构造时注册的工具描述 */
|
|
20
20
|
tools: Array<{ description: ToolDescription }>;
|
|
21
|
+
/**
|
|
22
|
+
* 取消信号(0.2.0 起提供):透传给底层 HTTP / 模型请求,
|
|
23
|
+
* AuiPage.stop() 时 abort。不接则取消只在页面侧生效,底层请求仍会跑完。
|
|
24
|
+
*/
|
|
25
|
+
signal?: AbortSignal;
|
|
21
26
|
};
|
|
22
27
|
}
|
|
23
28
|
|
package/types/auipage.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type { ToolDescription, ToolExecutor } from "@auipage/types";
|
|
6
6
|
import type {
|
|
7
7
|
ChatContentMessage,
|
|
8
|
+
ContentPart,
|
|
8
9
|
HistoryMessageGroup
|
|
9
10
|
} from "./message.js";
|
|
10
11
|
import type { Tool, ToolRender } from "./tool.js";
|
|
@@ -32,13 +33,27 @@ export interface AuiPageOptions {
|
|
|
32
33
|
runtime: AuiPageRuntimeSet;
|
|
33
34
|
/** 页面侧工具列表;可选,不使用工具时省略 */
|
|
34
35
|
tools?: Tool[];
|
|
36
|
+
/**
|
|
37
|
+
* 主动结束 / 取消时等待当前分片落定的兜底时长(毫秒),默认 5000(0.2.0 起提供)。
|
|
38
|
+
* 适配器忽略 signal 而不返回时,到点强制收尾,避免页面停在“执行中”。
|
|
39
|
+
*/
|
|
40
|
+
stopTimeout?: number;
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
/** 任务生命周期事件名 */
|
|
38
44
|
export type AuiLifecycleEvent = "task:start" | "task:end";
|
|
39
45
|
|
|
40
|
-
/**
|
|
41
|
-
|
|
46
|
+
/**
|
|
47
|
+
* 任务结束状态(0.2.0 起提供完整四态):
|
|
48
|
+
* - complete:模型流自然结束
|
|
49
|
+
* - stopped:主动结束(stop(),含工具里调用),当成功收尾
|
|
50
|
+
* - cancelled:取消(cancel(),含工具里调用),当失败收尾
|
|
51
|
+
* - error:流式过程抛错或入库失败
|
|
52
|
+
*/
|
|
53
|
+
export type AuiTaskStatus = "complete" | "stopped" | "cancelled" | "error";
|
|
54
|
+
|
|
55
|
+
/** 主动结束 / 取消的发起方(0.2.0 起提供) */
|
|
56
|
+
export type AuiEndBy = "user" | "tool";
|
|
42
57
|
|
|
43
58
|
/** task:start 回调载荷 */
|
|
44
59
|
export interface TaskLifecyclePayload {
|
|
@@ -50,9 +65,26 @@ export interface TaskLifecyclePayload {
|
|
|
50
65
|
message: ChatContentMessage;
|
|
51
66
|
}
|
|
52
67
|
|
|
68
|
+
/**
|
|
69
|
+
* 本次任务已交给界面渲染的条目(0.2.0 起提供)。
|
|
70
|
+
* part 是交给 ChatContentRuntime.append 的原始片段引用,可用它找回自己渲染的节点。
|
|
71
|
+
*/
|
|
72
|
+
export interface DisplayedPart {
|
|
73
|
+
/** 任务内的显示序号,从 0 开始 */
|
|
74
|
+
index: number;
|
|
75
|
+
/** 渲染时使用的角色 */
|
|
76
|
+
role: string;
|
|
77
|
+
/** 渲染时交给 append 的原始片段 */
|
|
78
|
+
part: ContentPart;
|
|
79
|
+
}
|
|
80
|
+
|
|
53
81
|
/** task:end 回调载荷;在 TaskLifecyclePayload 基础上附带 status */
|
|
54
82
|
export interface TaskEndPayload extends TaskLifecyclePayload {
|
|
55
83
|
status: AuiTaskStatus;
|
|
84
|
+
/** 仅在 status 为 stopped / cancelled 时提供:谁发起的结束 */
|
|
85
|
+
by?: AuiEndBy;
|
|
86
|
+
/** 仅在 status 为 cancelled 时提供:本轮涉及的已显示条目 */
|
|
87
|
+
displayed?: DisplayedPart[];
|
|
56
88
|
}
|
|
57
89
|
|
|
58
90
|
/** 生命周期事件 handler 签名 */
|
|
@@ -83,11 +115,32 @@ export declare class AuiPage {
|
|
|
83
115
|
|
|
84
116
|
/**
|
|
85
117
|
* 发送一条消息并驱动完整的流式对话流程;
|
|
86
|
-
* 上一轮执行中时以 "当前正在执行中" reject
|
|
118
|
+
* 上一轮执行中时以 "当前正在执行中" reject,被 cancel() 取消时以 "已取消" reject;
|
|
119
|
+
* 全部完成(含落库)后 resolve;被 stop() 主动结束时同样 resolve;
|
|
87
120
|
* 流式过程出错时以原始 error reject(同时触发 task:end { status: "error" })。
|
|
88
121
|
*/
|
|
89
122
|
sendMessage(message: ChatContentMessage): Promise<void>;
|
|
90
123
|
|
|
124
|
+
/**
|
|
125
|
+
* 主动结束当前任务(0.2.0 起提供):中断底层请求(context.signal 被 abort),
|
|
126
|
+
* 已产出的内容保留,消息组以 status: "stopped" 入库,
|
|
127
|
+
* 触发 task:end { status: "stopped", by } 后让 sendMessage 正常 resolve。
|
|
128
|
+
*
|
|
129
|
+
* 工具里调用时优先用 execute / render 拿到的 control.stop(),那会带上 by: "tool"。
|
|
130
|
+
*
|
|
131
|
+
* @returns 当时是否有正在执行的任务;没有则返回 false
|
|
132
|
+
*/
|
|
133
|
+
stop(): boolean;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 取消当前任务(0.2.0 起提供):与 stop() 相同的打断方式,但按失败收尾——
|
|
137
|
+
* 消息组以 status: "cancelled" 入库,task:end 附带 displayed(本轮已显示条目),
|
|
138
|
+
* sendMessage 以 "已取消" reject,界面可据此撤销已渲染的内容。
|
|
139
|
+
*
|
|
140
|
+
* @returns 当时是否有正在执行的任务;没有则返回 false
|
|
141
|
+
*/
|
|
142
|
+
cancel(): boolean;
|
|
143
|
+
|
|
91
144
|
/**
|
|
92
145
|
* 订阅任务生命周期事件。同名事件可注册多个 handler,触发时按注册顺序串行调用,
|
|
93
146
|
* handler 内部抛错被吞掉,不会影响 sendMessage 主流程。链式返回 AuiPage。
|
package/types/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export {
|
|
|
14
14
|
type AuiPageRuntimeSet,
|
|
15
15
|
type AuiLifecycleEvent,
|
|
16
16
|
type AuiTaskStatus,
|
|
17
|
+
type AuiEndBy,
|
|
17
18
|
type TaskLifecyclePayload,
|
|
18
19
|
type TaskEndPayload,
|
|
19
20
|
type TaskStartHandler,
|
|
@@ -71,6 +72,7 @@ export type {
|
|
|
71
72
|
export { default as defineTool } from "./define-tool.js";
|
|
72
73
|
|
|
73
74
|
/* ---------- 消息与会话 ---------- */
|
|
75
|
+
export { default as toModelMessages } from "./to-model-messages.js";
|
|
74
76
|
export type {
|
|
75
77
|
TextContentType,
|
|
76
78
|
TextContentPart,
|
package/types/message.d.ts
CHANGED
|
@@ -57,4 +57,10 @@ export interface ChatContentMessage {
|
|
|
57
57
|
*/
|
|
58
58
|
export interface HistoryMessageGroup {
|
|
59
59
|
messages: ChatContentMessage[];
|
|
60
|
+
/**
|
|
61
|
+
* 该轮的状态,0.2.0 起提供:
|
|
62
|
+
* complete(正常完成,通常省略)、cancelled(被 AuiPage.stop() 取消)。
|
|
63
|
+
* append 时据此决定入库、丢弃还是另做标记。
|
|
64
|
+
*/
|
|
65
|
+
status?: "complete" | "stopped" | "cancelled";
|
|
60
66
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toModelMessages:把页面侧历史消息(富片段)转换为模型线上消息
|
|
3
|
+
*/
|
|
4
|
+
import type { ChatMessage } from "@auipage/types";
|
|
5
|
+
import type { ChatContentMessage, HistoryMessageGroup } from "./message.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param input 历史消息组数组或消息数组
|
|
9
|
+
* @returns 可直接作为 completions.messages 的数组
|
|
10
|
+
*/
|
|
11
|
+
declare function toModelMessages(
|
|
12
|
+
input: Array<HistoryMessageGroup | ChatContentMessage>
|
|
13
|
+
): ChatMessage[];
|
|
14
|
+
|
|
15
|
+
export default toModelMessages;
|
package/types/tool.d.ts
CHANGED
|
@@ -16,6 +16,12 @@ export interface ToolRenderData {
|
|
|
16
16
|
result: unknown;
|
|
17
17
|
/** execute 的执行状态 */
|
|
18
18
|
status: ToolCallStatus;
|
|
19
|
+
/** 当前任务 id(0.2.0 起提供) */
|
|
20
|
+
taskId?: string;
|
|
21
|
+
/** 主动结束这一轮:内容保留、标记 stopped、sendMessage resolve(0.2.0 起提供) */
|
|
22
|
+
stop?: () => boolean;
|
|
23
|
+
/** 取消这一轮:丢弃界面、标记 cancelled、sendMessage 以 "已取消" reject(0.2.0 起提供) */
|
|
24
|
+
cancel?: () => boolean;
|
|
19
25
|
[key: string]: unknown;
|
|
20
26
|
}
|
|
21
27
|
|