@galaxycore/ai-chat 0.7.0 → 0.8.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.md +5 -0
- package/README.md +1 -1
- package/dist/{appearance-BUtKwRL5.d.ts → appearance-Bcj6SrBr.d.ts} +2 -2
- package/dist/appearance.d.ts +1 -1
- package/dist/appearance.js +1 -1
- package/dist/{labels-a_-_yLBi.d.ts → branches-4UjruXJV.d.ts} +97 -2
- package/dist/branches-MrtWHEkd.js +332 -0
- package/dist/branches-MrtWHEkd.js.map +1 -0
- package/dist/context.js +1 -1
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +2 -2
- package/dist/index.d.ts +24 -3
- package/dist/index.js +239 -82
- package/dist/index.js.map +1 -1
- package/dist/styles.css +9 -0
- package/dist/{ui-primitives-BCbe9Ds8.js → ui-primitives-BJFXxysT.js} +5 -2
- package/dist/{ui-primitives-BCbe9Ds8.js.map → ui-primitives-BJFXxysT.js.map} +1 -1
- package/package.json +1 -1
- package/dist/labels-BM5o9a9K.js +0 -116
- package/dist/labels-BM5o9a9K.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
- Add Cursor-style message branching and checkpoint revert primitives (`projectChatBranches`, `useChatBranches`, `ChatBranchSwitcher`, `ChatCheckpointBanner`), exported from both the root package and `/headless` (headless helpers).
|
|
6
|
+
- Add `branches`, `onSelectBranch`, `onRevertMessage`, `onBranchMessage`, and `renderUserMessageFooter` on `ChatMessages` / `ChatPanel`, along with bilingual labels (`zhCN` / `enUS`) and `chevronLeft` / `undo` / `branch` icons.
|
|
7
|
+
|
|
3
8
|
## 0.7.0
|
|
4
9
|
|
|
5
10
|
- Keep following streamed replies through consecutive layout changes. Deliberate upward scrolling still pauses following.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
GalaxyCore 通用 React AI 聊天组件。默认界面借鉴 Chrome AI 侧栏和 Codex 的消息阅读、工具状态与输入区布局,使用 Lucide 图标;支持完整面板、组合组件和 headless Hook。不同业务系统可分别适配文档、表格、图表或编辑器上下文,也可以使用自己的主题与组件库。
|
|
4
4
|
|
|
5
|
-
**当前版本:UI 包 0.
|
|
5
|
+
**当前版本:UI 包 0.8.0,网关包 0.2.0。** UI 提供平滑流式展示、历史会话菜单、消息撤回与分支切换、页面指向、语音输入、可部署示例和交互文档站。独立 Node 网关通过 pi core 实现流式文本、服务端工具调用、停止和持久化会话恢复。Codex 已预留运行时扩展接口,尚未实现其桥接。发布验收与真实模型联调状态见 [验证记录](docs/validation.md)。
|
|
6
6
|
|
|
7
7
|
## 本地运行
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ButtonHTMLAttributes, ComponentType, ReactNode } from "react";
|
|
3
3
|
import { LucideProps } from "lucide-react";
|
|
4
4
|
//#region src/icons.d.ts
|
|
5
|
-
type ChatIconName = 'send' | 'stop' | 'plus' | 'close' | 'copy' | 'check' | 'refresh' | 'down' | 'file' | 'sparkle' | 'more' | 'edit' | 'chevron' | 'link' | 'tool' | 'thinking' | 'warning' | 'blocked' | 'loader' | 'mic' | 'audio' | 'text' | 'table' | 'chart' | 'page' | 'target' | 'external' | 'search';
|
|
5
|
+
type ChatIconName = 'send' | 'stop' | 'plus' | 'close' | 'copy' | 'check' | 'refresh' | 'down' | 'file' | 'sparkle' | 'more' | 'edit' | 'chevron' | 'chevronLeft' | 'undo' | 'branch' | 'link' | 'tool' | 'thinking' | 'warning' | 'blocked' | 'loader' | 'mic' | 'audio' | 'text' | 'table' | 'chart' | 'page' | 'target' | 'external' | 'search';
|
|
6
6
|
type ChatIconProps = Omit<LucideProps, 'ref'>;
|
|
7
7
|
type ChatIconOverrides = Partial<Record<ChatIconName, ComponentType<ChatIconProps>>>;
|
|
8
8
|
interface ChatAppearanceProviderProps {
|
|
@@ -31,4 +31,4 @@ interface ChatIconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
31
31
|
declare const ChatIconButton: import("react").ForwardRefExoticComponent<ChatIconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
32
32
|
//#endregion
|
|
33
33
|
export { ChatIconName as a, Icon as c, ChatAppearanceProviderProps as i, ChatIconButtonProps as n, ChatIconOverrides as o, ChatAppearanceProvider as r, ChatIconProps as s, ChatIconButton as t };
|
|
34
|
-
//# sourceMappingURL=appearance-
|
|
34
|
+
//# sourceMappingURL=appearance-Bcj6SrBr.d.ts.map
|
package/dist/appearance.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as ChatIconName, c as Icon, i as ChatAppearanceProviderProps, n as ChatIconButtonProps, o as ChatIconOverrides, r as ChatAppearanceProvider, s as ChatIconProps, t as ChatIconButton } from "./appearance-
|
|
2
|
+
import { a as ChatIconName, c as Icon, i as ChatAppearanceProviderProps, n as ChatIconButtonProps, o as ChatIconOverrides, r as ChatAppearanceProvider, s as ChatIconProps, t as ChatIconButton } from "./appearance-Bcj6SrBr.js";
|
|
3
3
|
export { ChatAppearanceProvider, type ChatAppearanceProviderProps, Icon as ChatIcon, ChatIconButton, type ChatIconButtonProps, type ChatIconName, type ChatIconOverrides, type ChatIconProps };
|
package/dist/appearance.js
CHANGED
|
@@ -53,6 +53,23 @@ interface ChatLabels {
|
|
|
53
53
|
toolHideDetails?: string;
|
|
54
54
|
suggestions?: string;
|
|
55
55
|
composerHint?: string;
|
|
56
|
+
revert?: string;
|
|
57
|
+
branch?: string;
|
|
58
|
+
previousBranch?: string;
|
|
59
|
+
nextBranch?: string;
|
|
60
|
+
branchPosition?: string;
|
|
61
|
+
revertedBanner?: string;
|
|
62
|
+
restoreBranch?: string;
|
|
63
|
+
}
|
|
64
|
+
interface ChatBranchInfo {
|
|
65
|
+
/** 1-based position among sibling branches at this point. */
|
|
66
|
+
index: number;
|
|
67
|
+
/** Total number of sibling branches at this point. */
|
|
68
|
+
count: number;
|
|
69
|
+
/** Previous sibling message or turn ID, if any. */
|
|
70
|
+
prevId?: string;
|
|
71
|
+
/** Next sibling message or turn ID, if any. */
|
|
72
|
+
nextId?: string;
|
|
56
73
|
}
|
|
57
74
|
type TextRenderer = (props: {
|
|
58
75
|
text: string;
|
|
@@ -145,6 +162,16 @@ interface ChatMessagesProps<M extends UIMessage = UIMessage> {
|
|
|
145
162
|
suggestionsDescription?: ReactNode;
|
|
146
163
|
/** Inline confirmation/clarification content in the latest assistant turn. */
|
|
147
164
|
renderMessageActions?: (context: ChatMessageActionContext<M>) => ReactNode;
|
|
165
|
+
/** Custom footer rendered below each user message, replacing the default user action bar when set. */
|
|
166
|
+
renderUserMessageFooter?: (context: ChatMessageActionContext<M>) => ReactNode;
|
|
167
|
+
/** Sibling-branch metadata keyed by message ID for `< 1/2 >` navigation. */
|
|
168
|
+
branches?: Readonly<Record<string, ChatBranchInfo>>;
|
|
169
|
+
/** Called when the user switches to a sibling branch via `< 1/2 >`. */
|
|
170
|
+
onSelectBranch?: (messageId: string) => void;
|
|
171
|
+
/** Revert conversation checkpoint to immediately before this user message. */
|
|
172
|
+
onRevertMessage?: (message: M) => void | Promise<void>;
|
|
173
|
+
/** Fork or branch conversation from this message. */
|
|
174
|
+
onBranchMessage?: (message: M) => void | Promise<void>;
|
|
148
175
|
/** Return null to hide the default assistant identity; timestamps remain host-owned. */
|
|
149
176
|
renderMessageHeader?: (context: {
|
|
150
177
|
message: M;
|
|
@@ -191,5 +218,73 @@ declare function acceptsFile(file: Pick<File, 'name' | 'type'>, accept?: string)
|
|
|
191
218
|
declare const zhCN: Required<ChatLabels>;
|
|
192
219
|
declare const enUS: Required<ChatLabels>;
|
|
193
220
|
//#endregion
|
|
194
|
-
|
|
195
|
-
|
|
221
|
+
//#region src/branches.d.ts
|
|
222
|
+
interface ProjectChatBranchesOptions<T extends {
|
|
223
|
+
id: string;
|
|
224
|
+
}> {
|
|
225
|
+
/**
|
|
226
|
+
* Resolve an item's parent ID:
|
|
227
|
+
* - `string`: explicit parent item ID
|
|
228
|
+
* - `null`: explicit root item (starts a root-level branch)
|
|
229
|
+
* - `undefined`: legacy linear item (chains after `items[index - 1]`)
|
|
230
|
+
*/
|
|
231
|
+
getParentId?: (item: T, index: number, items: readonly T[]) => string | null | undefined;
|
|
232
|
+
/** Selected child ID keyed by parent ID (`'__root__'` for root-level siblings). */
|
|
233
|
+
selections?: Readonly<Record<string, string>>;
|
|
234
|
+
/**
|
|
235
|
+
* Active head or checkpoint stop position:
|
|
236
|
+
* - `undefined`: follow selected/latest children to a leaf
|
|
237
|
+
* - `null`: reverted to the empty root before the first message
|
|
238
|
+
* - `string`: follow ancestors of this item, stopping at it when `stopAtHead` is true
|
|
239
|
+
*/
|
|
240
|
+
headId?: string | null;
|
|
241
|
+
/** When true and `headId` is provided, stop at `headId` instead of descending to its leaf. */
|
|
242
|
+
stopAtHead?: boolean;
|
|
243
|
+
}
|
|
244
|
+
interface ChatBranchProjection<T extends {
|
|
245
|
+
id: string;
|
|
246
|
+
}> {
|
|
247
|
+
messages: T[];
|
|
248
|
+
branches: Record<string, ChatBranchInfo>;
|
|
249
|
+
/** Last visible item ID on the active path, or `null` when empty / reverted to root. */
|
|
250
|
+
headId: string | null;
|
|
251
|
+
/** Root-level branch navigation when reverted before the first message. */
|
|
252
|
+
rootBranches?: ChatBranchInfo;
|
|
253
|
+
}
|
|
254
|
+
declare function projectChatBranches<T extends {
|
|
255
|
+
id: string;
|
|
256
|
+
}>(items: readonly T[], options?: ProjectChatBranchesOptions<T>): ChatBranchProjection<T>;
|
|
257
|
+
interface ChatBranchesState {
|
|
258
|
+
selections: Record<string, string>;
|
|
259
|
+
checkpoint?: {
|
|
260
|
+
afterId: string | null;
|
|
261
|
+
revertedMessageId?: string;
|
|
262
|
+
restoreLeafId: string | null;
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
interface ChatBranchesController<T extends {
|
|
266
|
+
id: string;
|
|
267
|
+
}> extends ChatBranchProjection<T> {
|
|
268
|
+
/** Parent ID to attach to the next newly submitted user message (`null` when starting at root). */
|
|
269
|
+
nextParentId: string | null;
|
|
270
|
+
/** Message ID that was reverted to create the current checkpoint, if any. */
|
|
271
|
+
revertedMessageId?: string;
|
|
272
|
+
/** Whether a previous branch leaf can be restored after a revert/checkpoint action. */
|
|
273
|
+
canRestore: boolean;
|
|
274
|
+
/** Switch to the branch containing `messageId` and follow it to its leaf. */
|
|
275
|
+
selectBranch: (messageId: string) => void;
|
|
276
|
+
/** Revert the active view to immediately before `messageId`, keeping the old branch restorable. */
|
|
277
|
+
revertBefore: (messageId: string) => T | undefined;
|
|
278
|
+
/** Position the active view right after `messageId` so the next message branches from there. */
|
|
279
|
+
branchFrom: (messageId: string) => boolean;
|
|
280
|
+
/** Restore the branch leaf that was active before `revertBefore` or `branchFrom`. */
|
|
281
|
+
restore: () => void;
|
|
282
|
+
/** Clear any active checkpoint (call when submitting a new message from the checkpoint). */
|
|
283
|
+
commitFromCheckpoint: () => string | null;
|
|
284
|
+
}
|
|
285
|
+
declare function useChatBranches<T extends {
|
|
286
|
+
id: string;
|
|
287
|
+
}>(items: readonly T[], options?: Omit<ProjectChatBranchesOptions<T>, 'selections' | 'headId' | 'stopAtHead'>): ChatBranchesController<T>;
|
|
288
|
+
//#endregion
|
|
289
|
+
export { ToolPresentationResolver as A, ChatScrollHandle as C, TextRenderer as D, PartRenderers as E, ToolPart as O, ChatPanelProps as S, PartRendererProps as T, ChatBranchInfo as _, projectChatBranches as a, ChatMessageActionContext as b, zhCN as c, safeUrl as d, useAiChat as f, AttachmentOptions as g, AiChatProps as h, ProjectChatBranchesOptions as i, ToolRenderers as j, ToolPresentation as k, acceptsFile as l, AiChatOptions as m, ChatBranchesController as n, useChatBranches as o, AiChatController as p, ChatBranchesState as r, enUS as s, ChatBranchProjection as t, getMessageText as u, ChatComposerProps as v, ChatSuggestedAction as w, ChatMessagesProps as x, ChatLabels as y };
|
|
290
|
+
//# sourceMappingURL=branches-4UjruXJV.d.ts.map
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useChat } from "@ai-sdk/react";
|
|
3
|
+
import { useCallback, useMemo, useState } from "react";
|
|
4
|
+
//#region src/use-ai-chat.ts
|
|
5
|
+
/** Preserves the SDK's typed contract and throttles visual stream updates to 25 fps. */
|
|
6
|
+
function useAiChat(options = {}) {
|
|
7
|
+
const chat = useChat({
|
|
8
|
+
throttle: 40,
|
|
9
|
+
...options
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
...chat,
|
|
13
|
+
isBusy: chat.status === "submitted" || chat.status === "streaming"
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/labels.ts
|
|
18
|
+
const zhCN = {
|
|
19
|
+
title: "AI 助手",
|
|
20
|
+
assistant: "助手",
|
|
21
|
+
user: "你",
|
|
22
|
+
placeholder: "输入消息,与 AI 一起探索",
|
|
23
|
+
send: "发送消息",
|
|
24
|
+
stop: "停止生成",
|
|
25
|
+
attach: "添加附件",
|
|
26
|
+
removeAttachment: "移除附件",
|
|
27
|
+
uploading: "上传中",
|
|
28
|
+
uploadFailed: "附件上传失败,请重新添加",
|
|
29
|
+
tooManyFiles: "附件数量超过限制",
|
|
30
|
+
fileTooLarge: "文件大小超过限制",
|
|
31
|
+
fileNotAccepted: "不支持此文件类型",
|
|
32
|
+
emptyTitle: "有什么可以帮你?",
|
|
33
|
+
emptyDescription: "整理思路、理解资料,或从一个问题开始。",
|
|
34
|
+
thinking: "正在思考",
|
|
35
|
+
reasoning: "思考过程",
|
|
36
|
+
sources: "参考来源",
|
|
37
|
+
copy: "复制回答",
|
|
38
|
+
copied: "已复制",
|
|
39
|
+
regenerate: "重新生成",
|
|
40
|
+
retry: "重试",
|
|
41
|
+
error: "暂时无法完成回答,请重试。",
|
|
42
|
+
dismiss: "关闭提示",
|
|
43
|
+
jumpToLatest: "回到最新消息",
|
|
44
|
+
approve: "允许",
|
|
45
|
+
reject: "拒绝",
|
|
46
|
+
tool: "工具调用",
|
|
47
|
+
toolInput: "输入",
|
|
48
|
+
toolOutput: "结果",
|
|
49
|
+
toolPending: "准备中",
|
|
50
|
+
toolRunning: "执行中",
|
|
51
|
+
toolComplete: "已完成",
|
|
52
|
+
toolFailed: "执行失败",
|
|
53
|
+
toolDenied: "已拒绝",
|
|
54
|
+
toolApproval: "等待你的确认",
|
|
55
|
+
toolWaiting: "等待结果",
|
|
56
|
+
toolDetails: "展开详情",
|
|
57
|
+
toolHideDetails: "收起详情",
|
|
58
|
+
suggestions: "接下来可以",
|
|
59
|
+
composerHint: "Enter 发送 · Shift + Enter 换行",
|
|
60
|
+
revert: "撤回",
|
|
61
|
+
branch: "分支对话",
|
|
62
|
+
previousBranch: "上一分支",
|
|
63
|
+
nextBranch: "下一分支",
|
|
64
|
+
branchPosition: "分支 {current}/{total}",
|
|
65
|
+
revertedBanner: "已撤回到此消息之前",
|
|
66
|
+
restoreBranch: "恢复",
|
|
67
|
+
unsupportedPart: "此内容需要自定义渲染器",
|
|
68
|
+
disclaimer: "AI 生成的内容可能不准确,请核实重要信息。"
|
|
69
|
+
};
|
|
70
|
+
const enUS = {
|
|
71
|
+
title: "AI assistant",
|
|
72
|
+
assistant: "Assistant",
|
|
73
|
+
user: "You",
|
|
74
|
+
placeholder: "Ask a question or explore an idea",
|
|
75
|
+
send: "Send message",
|
|
76
|
+
stop: "Stop generating",
|
|
77
|
+
attach: "Attach files",
|
|
78
|
+
removeAttachment: "Remove attachment",
|
|
79
|
+
uploading: "Uploading",
|
|
80
|
+
uploadFailed: "Upload failed. Please attach the file again.",
|
|
81
|
+
tooManyFiles: "Too many attachments",
|
|
82
|
+
fileTooLarge: "File exceeds the size limit",
|
|
83
|
+
fileNotAccepted: "File type is not supported",
|
|
84
|
+
emptyTitle: "How can I help?",
|
|
85
|
+
emptyDescription: "Make sense of your documents, explore ideas, or start with a question.",
|
|
86
|
+
thinking: "Thinking",
|
|
87
|
+
reasoning: "Reasoning",
|
|
88
|
+
sources: "Sources",
|
|
89
|
+
copy: "Copy response",
|
|
90
|
+
copied: "Copied",
|
|
91
|
+
regenerate: "Regenerate",
|
|
92
|
+
retry: "Retry",
|
|
93
|
+
error: "Unable to complete the response. Please try again.",
|
|
94
|
+
dismiss: "Dismiss",
|
|
95
|
+
jumpToLatest: "Jump to latest",
|
|
96
|
+
approve: "Approve",
|
|
97
|
+
reject: "Deny",
|
|
98
|
+
tool: "Tool call",
|
|
99
|
+
toolInput: "Input",
|
|
100
|
+
toolOutput: "Result",
|
|
101
|
+
toolPending: "Preparing",
|
|
102
|
+
toolRunning: "Running",
|
|
103
|
+
toolComplete: "Completed",
|
|
104
|
+
toolFailed: "Failed",
|
|
105
|
+
toolDenied: "Denied",
|
|
106
|
+
toolApproval: "Waiting for your approval",
|
|
107
|
+
toolWaiting: "Awaiting result",
|
|
108
|
+
toolDetails: "Show details",
|
|
109
|
+
toolHideDetails: "Hide details",
|
|
110
|
+
suggestions: "Suggested next steps",
|
|
111
|
+
composerHint: "Enter to send · Shift + Enter for a new line",
|
|
112
|
+
revert: "Revert",
|
|
113
|
+
branch: "Branch chat",
|
|
114
|
+
previousBranch: "Previous branch",
|
|
115
|
+
nextBranch: "Next branch",
|
|
116
|
+
branchPosition: "Branch {current} of {total}",
|
|
117
|
+
revertedBanner: "Reverted before this message",
|
|
118
|
+
restoreBranch: "Restore",
|
|
119
|
+
unsupportedPart: "This content requires a custom renderer",
|
|
120
|
+
disclaimer: "AI can make mistakes. Verify important information."
|
|
121
|
+
};
|
|
122
|
+
function resolveLabels(overrides) {
|
|
123
|
+
return {
|
|
124
|
+
...zhCN,
|
|
125
|
+
...overrides
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/branches.ts
|
|
130
|
+
const ROOT_KEY = "__root__";
|
|
131
|
+
function parentKey(parentId) {
|
|
132
|
+
return parentId === null ? ROOT_KEY : `p:${parentId}`;
|
|
133
|
+
}
|
|
134
|
+
function projectChatBranches(items, options = {}) {
|
|
135
|
+
const { getParentId, selections, headId, stopAtHead = false } = options;
|
|
136
|
+
if (items.length === 0) return {
|
|
137
|
+
messages: [],
|
|
138
|
+
branches: {},
|
|
139
|
+
headId: null
|
|
140
|
+
};
|
|
141
|
+
const byId = /* @__PURE__ */ new Map();
|
|
142
|
+
for (const item of items) byId.set(item.id, item);
|
|
143
|
+
const parentOf = /* @__PURE__ */ new Map();
|
|
144
|
+
const childrenOf = /* @__PURE__ */ new Map();
|
|
145
|
+
items.forEach((item, index) => {
|
|
146
|
+
const raw = getParentId ? getParentId(item, index, items) : void 0;
|
|
147
|
+
const resolved = raw === void 0 ? index > 0 ? items[index - 1].id : null : raw !== null && byId.has(raw) ? raw : null;
|
|
148
|
+
const safeParent = resolved === item.id ? null : resolved;
|
|
149
|
+
parentOf.set(item.id, safeParent);
|
|
150
|
+
const key = parentKey(safeParent);
|
|
151
|
+
const group = childrenOf.get(key);
|
|
152
|
+
if (group) group.push(item);
|
|
153
|
+
else childrenOf.set(key, [item]);
|
|
154
|
+
});
|
|
155
|
+
const effectiveSelections = { ...selections };
|
|
156
|
+
if (typeof headId === "string" && byId.has(headId)) {
|
|
157
|
+
let cursor = headId;
|
|
158
|
+
const seen = /* @__PURE__ */ new Set();
|
|
159
|
+
while (cursor !== null && !seen.has(cursor)) {
|
|
160
|
+
seen.add(cursor);
|
|
161
|
+
const p = parentOf.get(cursor) ?? null;
|
|
162
|
+
effectiveSelections[parentKey(p)] = cursor;
|
|
163
|
+
cursor = p;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const toBranchInfo = (siblings, activeIndex) => {
|
|
167
|
+
if (siblings.length <= 1 || activeIndex < 0) return void 0;
|
|
168
|
+
return {
|
|
169
|
+
index: activeIndex + 1,
|
|
170
|
+
count: siblings.length,
|
|
171
|
+
prevId: activeIndex > 0 ? siblings[activeIndex - 1].id : void 0,
|
|
172
|
+
nextId: activeIndex + 1 < siblings.length ? siblings[activeIndex + 1].id : void 0
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
if (headId === null) {
|
|
176
|
+
const roots = childrenOf.get(ROOT_KEY) ?? [];
|
|
177
|
+
const chosenId = effectiveSelections[ROOT_KEY];
|
|
178
|
+
const idx = chosenId ? roots.findIndex((item) => item.id === chosenId) : roots.length - 1;
|
|
179
|
+
return {
|
|
180
|
+
messages: [],
|
|
181
|
+
branches: {},
|
|
182
|
+
headId: null,
|
|
183
|
+
rootBranches: toBranchInfo(roots, idx >= 0 ? idx : roots.length - 1)
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
const messages = [];
|
|
187
|
+
const branches = {};
|
|
188
|
+
const visited = /* @__PURE__ */ new Set();
|
|
189
|
+
let currentParent = null;
|
|
190
|
+
while (true) {
|
|
191
|
+
const siblings = childrenOf.get(parentKey(currentParent));
|
|
192
|
+
if (!siblings || siblings.length === 0) break;
|
|
193
|
+
const preferredId = effectiveSelections[parentKey(currentParent)];
|
|
194
|
+
let index = preferredId ? siblings.findIndex((item) => item.id === preferredId) : -1;
|
|
195
|
+
if (index < 0) index = siblings.length - 1;
|
|
196
|
+
const chosen = siblings[index];
|
|
197
|
+
if (visited.has(chosen.id)) break;
|
|
198
|
+
visited.add(chosen.id);
|
|
199
|
+
messages.push(chosen);
|
|
200
|
+
const info = toBranchInfo(siblings, index);
|
|
201
|
+
if (info) branches[chosen.id] = info;
|
|
202
|
+
if (stopAtHead && headId === chosen.id) break;
|
|
203
|
+
currentParent = chosen.id;
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
messages,
|
|
207
|
+
branches,
|
|
208
|
+
headId: messages.at(-1)?.id ?? null
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function useChatBranches(items, options = {}) {
|
|
212
|
+
const { getParentId } = options;
|
|
213
|
+
const [state, setState] = useState({ selections: {} });
|
|
214
|
+
const parentMap = useMemo(() => {
|
|
215
|
+
const byId = new Set(items.map((item) => item.id));
|
|
216
|
+
const map = /* @__PURE__ */ new Map();
|
|
217
|
+
items.forEach((item, index) => {
|
|
218
|
+
const raw = getParentId ? getParentId(item, index, items) : void 0;
|
|
219
|
+
const resolved = raw === void 0 ? index > 0 ? items[index - 1].id : null : raw !== null && byId.has(raw) ? raw : null;
|
|
220
|
+
map.set(item.id, resolved === item.id ? null : resolved);
|
|
221
|
+
});
|
|
222
|
+
return map;
|
|
223
|
+
}, [items, getParentId]);
|
|
224
|
+
const projection = useMemo(() => projectChatBranches(items, {
|
|
225
|
+
getParentId,
|
|
226
|
+
selections: state.selections,
|
|
227
|
+
headId: state.checkpoint ? state.checkpoint.afterId : void 0,
|
|
228
|
+
stopAtHead: state.checkpoint !== void 0
|
|
229
|
+
}), [
|
|
230
|
+
items,
|
|
231
|
+
getParentId,
|
|
232
|
+
state
|
|
233
|
+
]);
|
|
234
|
+
const selectBranch = useCallback((messageId) => {
|
|
235
|
+
if (!parentMap.has(messageId)) return;
|
|
236
|
+
setState((current) => {
|
|
237
|
+
const nextSelections = { ...current.selections };
|
|
238
|
+
let cursor = messageId;
|
|
239
|
+
const seen = /* @__PURE__ */ new Set();
|
|
240
|
+
while (cursor !== null && !seen.has(cursor)) {
|
|
241
|
+
seen.add(cursor);
|
|
242
|
+
const p = parentMap.get(cursor) ?? null;
|
|
243
|
+
nextSelections[parentKey(p)] = cursor;
|
|
244
|
+
cursor = p;
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
selections: nextSelections,
|
|
248
|
+
checkpoint: void 0
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
}, [parentMap]);
|
|
252
|
+
const revertBefore = useCallback((messageId) => {
|
|
253
|
+
const target = items.find((item) => item.id === messageId);
|
|
254
|
+
if (!target) return void 0;
|
|
255
|
+
const afterId = parentMap.get(messageId) ?? null;
|
|
256
|
+
const currentLeaf = projection.headId;
|
|
257
|
+
setState((current) => ({
|
|
258
|
+
selections: current.selections,
|
|
259
|
+
checkpoint: {
|
|
260
|
+
afterId,
|
|
261
|
+
revertedMessageId: messageId,
|
|
262
|
+
restoreLeafId: current.checkpoint?.restoreLeafId ?? currentLeaf
|
|
263
|
+
}
|
|
264
|
+
}));
|
|
265
|
+
return target;
|
|
266
|
+
}, [
|
|
267
|
+
items,
|
|
268
|
+
parentMap,
|
|
269
|
+
projection.headId
|
|
270
|
+
]);
|
|
271
|
+
const branchFrom = useCallback((messageId) => {
|
|
272
|
+
if (!parentMap.has(messageId)) return false;
|
|
273
|
+
const currentLeaf = projection.headId;
|
|
274
|
+
setState((current) => ({
|
|
275
|
+
selections: current.selections,
|
|
276
|
+
checkpoint: {
|
|
277
|
+
afterId: messageId,
|
|
278
|
+
restoreLeafId: current.checkpoint?.restoreLeafId ?? currentLeaf
|
|
279
|
+
}
|
|
280
|
+
}));
|
|
281
|
+
return true;
|
|
282
|
+
}, [parentMap, projection.headId]);
|
|
283
|
+
const restore = useCallback(() => {
|
|
284
|
+
setState((current) => {
|
|
285
|
+
const leaf = current.checkpoint?.restoreLeafId;
|
|
286
|
+
if (!leaf || !parentMap.has(leaf)) return {
|
|
287
|
+
...current,
|
|
288
|
+
checkpoint: void 0
|
|
289
|
+
};
|
|
290
|
+
const nextSelections = { ...current.selections };
|
|
291
|
+
let cursor = leaf;
|
|
292
|
+
const seen = /* @__PURE__ */ new Set();
|
|
293
|
+
while (cursor !== null && !seen.has(cursor)) {
|
|
294
|
+
seen.add(cursor);
|
|
295
|
+
const p = parentMap.get(cursor) ?? null;
|
|
296
|
+
nextSelections[parentKey(p)] = cursor;
|
|
297
|
+
cursor = p;
|
|
298
|
+
}
|
|
299
|
+
return {
|
|
300
|
+
selections: nextSelections,
|
|
301
|
+
checkpoint: void 0
|
|
302
|
+
};
|
|
303
|
+
});
|
|
304
|
+
}, [parentMap]);
|
|
305
|
+
const commitFromCheckpoint = useCallback(() => {
|
|
306
|
+
const parentId = projection.headId;
|
|
307
|
+
setState((current) => {
|
|
308
|
+
const nextSelections = { ...current.selections };
|
|
309
|
+
delete nextSelections[parentKey(parentId)];
|
|
310
|
+
return {
|
|
311
|
+
selections: nextSelections,
|
|
312
|
+
checkpoint: void 0
|
|
313
|
+
};
|
|
314
|
+
});
|
|
315
|
+
return parentId;
|
|
316
|
+
}, [projection.headId]);
|
|
317
|
+
return {
|
|
318
|
+
...projection,
|
|
319
|
+
nextParentId: projection.headId,
|
|
320
|
+
revertedMessageId: state.checkpoint?.revertedMessageId,
|
|
321
|
+
canRestore: Boolean(state.checkpoint?.restoreLeafId && parentMap.has(state.checkpoint.restoreLeafId)),
|
|
322
|
+
selectBranch,
|
|
323
|
+
revertBefore,
|
|
324
|
+
branchFrom,
|
|
325
|
+
restore,
|
|
326
|
+
commitFromCheckpoint
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
//#endregion
|
|
330
|
+
export { zhCN as a, resolveLabels as i, useChatBranches as n, useAiChat as o, enUS as r, projectChatBranches as t };
|
|
331
|
+
|
|
332
|
+
//# sourceMappingURL=branches-MrtWHEkd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branches-MrtWHEkd.js","names":[],"sources":["../src/use-ai-chat.ts","../src/labels.ts","../src/branches.ts"],"sourcesContent":["\"use client\";\n\nimport { useChat } from '@ai-sdk/react';\nimport type { UIMessage } from 'ai';\nimport type { AiChatController, AiChatOptions } from './types';\n\n/** Preserves the SDK's typed contract and throttles visual stream updates to 25 fps. */\nexport function useAiChat<M extends UIMessage = UIMessage>(options: AiChatOptions<M> = {}): AiChatController<M> {\n const chat = useChat<M>({ throttle: 40, ...options });\n return { ...chat, isBusy: chat.status === 'submitted' || chat.status === 'streaming' };\n}\n","import type { ChatLabels } from './types';\n\nexport const zhCN: Required<ChatLabels> = {\n title: 'AI 助手', assistant: '助手', user: '你', placeholder: '输入消息,与 AI 一起探索',\n send: '发送消息', stop: '停止生成', attach: '添加附件', removeAttachment: '移除附件',\n uploading: '上传中', uploadFailed: '附件上传失败,请重新添加', tooManyFiles: '附件数量超过限制',\n fileTooLarge: '文件大小超过限制', fileNotAccepted: '不支持此文件类型',\n emptyTitle: '有什么可以帮你?', emptyDescription: '整理思路、理解资料,或从一个问题开始。',\n thinking: '正在思考', reasoning: '思考过程', sources: '参考来源', copy: '复制回答', copied: '已复制',\n regenerate: '重新生成', retry: '重试', error: '暂时无法完成回答,请重试。', dismiss: '关闭提示',\n jumpToLatest: '回到最新消息', approve: '允许', reject: '拒绝', tool: '工具调用', toolInput: '输入',\n toolOutput: '结果', toolPending: '准备中', toolRunning: '执行中', toolComplete: '已完成',\n toolFailed: '执行失败', toolDenied: '已拒绝', toolApproval: '等待你的确认',\n toolWaiting: '等待结果', toolDetails: '展开详情', toolHideDetails: '收起详情',\n suggestions: '接下来可以', composerHint: 'Enter 发送 · Shift + Enter 换行',\n revert: '撤回', branch: '分支对话',\n previousBranch: '上一分支', nextBranch: '下一分支', branchPosition: '分支 {current}/{total}',\n revertedBanner: '已撤回到此消息之前', restoreBranch: '恢复',\n unsupportedPart: '此内容需要自定义渲染器', disclaimer: 'AI 生成的内容可能不准确,请核实重要信息。',\n};\n\nexport const enUS: Required<ChatLabels> = {\n title: 'AI assistant', assistant: 'Assistant', user: 'You', placeholder: 'Ask a question or explore an idea',\n send: 'Send message', stop: 'Stop generating', attach: 'Attach files', removeAttachment: 'Remove attachment',\n uploading: 'Uploading', uploadFailed: 'Upload failed. Please attach the file again.', tooManyFiles: 'Too many attachments',\n fileTooLarge: 'File exceeds the size limit', fileNotAccepted: 'File type is not supported',\n emptyTitle: 'How can I help?', emptyDescription: 'Make sense of your documents, explore ideas, or start with a question.',\n thinking: 'Thinking', reasoning: 'Reasoning', sources: 'Sources', copy: 'Copy response', copied: 'Copied',\n regenerate: 'Regenerate', retry: 'Retry', error: 'Unable to complete the response. Please try again.', dismiss: 'Dismiss',\n jumpToLatest: 'Jump to latest', approve: 'Approve', reject: 'Deny', tool: 'Tool call', toolInput: 'Input',\n toolOutput: 'Result', toolPending: 'Preparing', toolRunning: 'Running', toolComplete: 'Completed',\n toolFailed: 'Failed', toolDenied: 'Denied', toolApproval: 'Waiting for your approval',\n toolWaiting: 'Awaiting result', toolDetails: 'Show details', toolHideDetails: 'Hide details',\n suggestions: 'Suggested next steps', composerHint: 'Enter to send · Shift + Enter for a new line',\n revert: 'Revert', branch: 'Branch chat',\n previousBranch: 'Previous branch', nextBranch: 'Next branch', branchPosition: 'Branch {current} of {total}',\n revertedBanner: 'Reverted before this message', restoreBranch: 'Restore',\n unsupportedPart: 'This content requires a custom renderer', disclaimer: 'AI can make mistakes. Verify important information.',\n};\n\nexport function resolveLabels(overrides?: Partial<ChatLabels>): Required<ChatLabels> {\n return { ...zhCN, ...overrides };\n}\n","\"use client\";\n\nimport { useCallback, useMemo, useState } from 'react';\nimport type { ChatBranchInfo } from './types';\n\nconst ROOT_KEY = '__root__';\n\nexport interface ProjectChatBranchesOptions<T extends { id: string }> {\n /**\n * Resolve an item's parent ID:\n * - `string`: explicit parent item ID\n * - `null`: explicit root item (starts a root-level branch)\n * - `undefined`: legacy linear item (chains after `items[index - 1]`)\n */\n getParentId?: (item: T, index: number, items: readonly T[]) => string | null | undefined;\n /** Selected child ID keyed by parent ID (`'__root__'` for root-level siblings). */\n selections?: Readonly<Record<string, string>>;\n /**\n * Active head or checkpoint stop position:\n * - `undefined`: follow selected/latest children to a leaf\n * - `null`: reverted to the empty root before the first message\n * - `string`: follow ancestors of this item, stopping at it when `stopAtHead` is true\n */\n headId?: string | null;\n /** When true and `headId` is provided, stop at `headId` instead of descending to its leaf. */\n stopAtHead?: boolean;\n}\n\nexport interface ChatBranchProjection<T extends { id: string }> {\n messages: T[];\n branches: Record<string, ChatBranchInfo>;\n /** Last visible item ID on the active path, or `null` when empty / reverted to root. */\n headId: string | null;\n /** Root-level branch navigation when reverted before the first message. */\n rootBranches?: ChatBranchInfo;\n}\n\nfunction parentKey(parentId: string | null): string {\n return parentId === null ? ROOT_KEY : `p:${parentId}`;\n}\n\nexport function projectChatBranches<T extends { id: string }>(\n items: readonly T[],\n options: ProjectChatBranchesOptions<T> = {},\n): ChatBranchProjection<T> {\n const { getParentId, selections, headId, stopAtHead = false } = options;\n if (items.length === 0) {\n return { messages: [], branches: {}, headId: null };\n }\n\n const byId = new Map<string, T>();\n for (const item of items) byId.set(item.id, item);\n\n const parentOf = new Map<string, string | null>();\n const childrenOf = new Map<string, T[]>();\n\n items.forEach((item, index) => {\n const raw = getParentId ? getParentId(item, index, items) : undefined;\n const resolved =\n raw === undefined\n ? (index > 0 ? items[index - 1]!.id : null)\n : raw !== null && byId.has(raw)\n ? raw\n : null;\n const safeParent = resolved === item.id ? null : resolved;\n parentOf.set(item.id, safeParent);\n const key = parentKey(safeParent);\n const group = childrenOf.get(key);\n if (group) group.push(item);\n else childrenOf.set(key, [item]);\n });\n\n const effectiveSelections: Record<string, string> = { ...selections };\n if (typeof headId === 'string' && byId.has(headId)) {\n let cursor: string | null = headId;\n const seen = new Set<string>();\n while (cursor !== null && !seen.has(cursor)) {\n seen.add(cursor);\n const p: string | null = parentOf.get(cursor) ?? null;\n effectiveSelections[parentKey(p)] = cursor;\n cursor = p;\n }\n }\n\n const toBranchInfo = (siblings: readonly T[], activeIndex: number): ChatBranchInfo | undefined => {\n if (siblings.length <= 1 || activeIndex < 0) return undefined;\n return {\n index: activeIndex + 1,\n count: siblings.length,\n prevId: activeIndex > 0 ? siblings[activeIndex - 1]!.id : undefined,\n nextId: activeIndex + 1 < siblings.length ? siblings[activeIndex + 1]!.id : undefined,\n };\n };\n\n if (headId === null) {\n const roots = childrenOf.get(ROOT_KEY) ?? [];\n const chosenId = effectiveSelections[ROOT_KEY];\n const idx = chosenId ? roots.findIndex(item => item.id === chosenId) : roots.length - 1;\n return {\n messages: [],\n branches: {},\n headId: null,\n rootBranches: toBranchInfo(roots, idx >= 0 ? idx : roots.length - 1),\n };\n }\n\n const messages: T[] = [];\n const branches: Record<string, ChatBranchInfo> = {};\n const visited = new Set<string>();\n let currentParent: string | null = null;\n\n while (true) {\n const siblings: T[] | undefined = childrenOf.get(parentKey(currentParent));\n if (!siblings || siblings.length === 0) break;\n const preferredId: string | undefined = effectiveSelections[parentKey(currentParent)];\n let index: number = preferredId ? siblings.findIndex(item => item.id === preferredId) : -1;\n if (index < 0) index = siblings.length - 1;\n const chosen: T = siblings[index]!;\n if (visited.has(chosen.id)) break;\n visited.add(chosen.id);\n messages.push(chosen);\n const info = toBranchInfo(siblings, index);\n if (info) branches[chosen.id] = info;\n if (stopAtHead && headId === chosen.id) break;\n currentParent = chosen.id;\n }\n\n return {\n messages,\n branches,\n headId: messages.at(-1)?.id ?? null,\n };\n}\n\nexport interface ChatBranchesState {\n selections: Record<string, string>;\n checkpoint?: {\n afterId: string | null;\n revertedMessageId?: string;\n restoreLeafId: string | null;\n };\n}\n\nexport interface ChatBranchesController<T extends { id: string }> extends ChatBranchProjection<T> {\n /** Parent ID to attach to the next newly submitted user message (`null` when starting at root). */\n nextParentId: string | null;\n /** Message ID that was reverted to create the current checkpoint, if any. */\n revertedMessageId?: string;\n /** Whether a previous branch leaf can be restored after a revert/checkpoint action. */\n canRestore: boolean;\n /** Switch to the branch containing `messageId` and follow it to its leaf. */\n selectBranch: (messageId: string) => void;\n /** Revert the active view to immediately before `messageId`, keeping the old branch restorable. */\n revertBefore: (messageId: string) => T | undefined;\n /** Position the active view right after `messageId` so the next message branches from there. */\n branchFrom: (messageId: string) => boolean;\n /** Restore the branch leaf that was active before `revertBefore` or `branchFrom`. */\n restore: () => void;\n /** Clear any active checkpoint (call when submitting a new message from the checkpoint). */\n commitFromCheckpoint: () => string | null;\n}\n\nexport function useChatBranches<T extends { id: string }>(\n items: readonly T[],\n options: Omit<ProjectChatBranchesOptions<T>, 'selections' | 'headId' | 'stopAtHead'> = {},\n): ChatBranchesController<T> {\n const { getParentId } = options;\n const [state, setState] = useState<ChatBranchesState>({ selections: {} });\n\n const parentMap = useMemo(() => {\n const byId = new Set(items.map(item => item.id));\n const map = new Map<string, string | null>();\n items.forEach((item, index) => {\n const raw = getParentId ? getParentId(item, index, items) : undefined;\n const resolved =\n raw === undefined\n ? (index > 0 ? items[index - 1]!.id : null)\n : raw !== null && byId.has(raw)\n ? raw\n : null;\n map.set(item.id, resolved === item.id ? null : resolved);\n });\n return map;\n }, [items, getParentId]);\n\n const projection = useMemo(\n () =>\n projectChatBranches(items, {\n getParentId,\n selections: state.selections,\n headId: state.checkpoint ? state.checkpoint.afterId : undefined,\n stopAtHead: state.checkpoint !== undefined,\n }),\n [items, getParentId, state],\n );\n\n const selectBranch = useCallback(\n (messageId: string) => {\n if (!parentMap.has(messageId)) return;\n setState(current => {\n const nextSelections = { ...current.selections };\n let cursor: string | null = messageId;\n const seen = new Set<string>();\n while (cursor !== null && !seen.has(cursor)) {\n seen.add(cursor);\n const p: string | null = parentMap.get(cursor) ?? null;\n nextSelections[parentKey(p)] = cursor;\n cursor = p;\n }\n return { selections: nextSelections, checkpoint: undefined };\n });\n },\n [parentMap],\n );\n\n const revertBefore = useCallback(\n (messageId: string): T | undefined => {\n const target = items.find(item => item.id === messageId);\n if (!target) return undefined;\n const afterId = parentMap.get(messageId) ?? null;\n const currentLeaf = projection.headId;\n setState(current => ({\n selections: current.selections,\n checkpoint: {\n afterId,\n revertedMessageId: messageId,\n restoreLeafId: current.checkpoint?.restoreLeafId ?? currentLeaf,\n },\n }));\n return target;\n },\n [items, parentMap, projection.headId],\n );\n\n const branchFrom = useCallback(\n (messageId: string): boolean => {\n if (!parentMap.has(messageId)) return false;\n const currentLeaf = projection.headId;\n setState(current => ({\n selections: current.selections,\n checkpoint: {\n afterId: messageId,\n restoreLeafId: current.checkpoint?.restoreLeafId ?? currentLeaf,\n },\n }));\n return true;\n },\n [parentMap, projection.headId],\n );\n\n const restore = useCallback(() => {\n setState(current => {\n const leaf = current.checkpoint?.restoreLeafId;\n if (!leaf || !parentMap.has(leaf)) return { ...current, checkpoint: undefined };\n const nextSelections = { ...current.selections };\n let cursor: string | null = leaf;\n const seen = new Set<string>();\n while (cursor !== null && !seen.has(cursor)) {\n seen.add(cursor);\n const p: string | null = parentMap.get(cursor) ?? null;\n nextSelections[parentKey(p)] = cursor;\n cursor = p;\n }\n return { selections: nextSelections, checkpoint: undefined };\n });\n }, [parentMap]);\n\n const commitFromCheckpoint = useCallback(() => {\n const parentId = projection.headId;\n setState(current => {\n const nextSelections = { ...current.selections };\n delete nextSelections[parentKey(parentId)];\n return { selections: nextSelections, checkpoint: undefined };\n });\n return parentId;\n }, [projection.headId]);\n\n return {\n ...projection,\n nextParentId: projection.headId,\n revertedMessageId: state.checkpoint?.revertedMessageId,\n canRestore: Boolean(state.checkpoint?.restoreLeafId && parentMap.has(state.checkpoint.restoreLeafId)),\n selectBranch,\n revertBefore,\n branchFrom,\n restore,\n commitFromCheckpoint,\n };\n}\n"],"mappings":";;;;;AAOA,SAAgB,UAA2C,UAA4B,CAAC,GAAwB;CAC9G,MAAM,OAAO,QAAW;EAAE,UAAU;EAAI,GAAG;CAAQ,CAAC;CACpD,OAAO;EAAE,GAAG;EAAM,QAAQ,KAAK,WAAW,eAAe,KAAK,WAAW;CAAY;AACvF;;;ACRA,MAAa,OAA6B;CACxC,OAAO;CAAS,WAAW;CAAM,MAAM;CAAK,aAAa;CACzD,MAAM;CAAQ,MAAM;CAAQ,QAAQ;CAAQ,kBAAkB;CAC9D,WAAW;CAAO,cAAc;CAAgB,cAAc;CAC9D,cAAc;CAAY,iBAAiB;CAC3C,YAAY;CAAY,kBAAkB;CAC1C,UAAU;CAAQ,WAAW;CAAQ,SAAS;CAAQ,MAAM;CAAQ,QAAQ;CAC5E,YAAY;CAAQ,OAAO;CAAM,OAAO;CAAiB,SAAS;CAClE,cAAc;CAAU,SAAS;CAAM,QAAQ;CAAM,MAAM;CAAQ,WAAW;CAC9E,YAAY;CAAM,aAAa;CAAO,aAAa;CAAO,cAAc;CACxE,YAAY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,WAAW,MAAM,CAAC;CAEtB,OAAO;EACL,GAAG;EACH,cAAc,WAAW;EACzB,mBAAmB,MAAM,YAAY;EACrC,YAAY,QAAQ,MAAM,YAAY,iBAAiB,UAAU,IAAI,MAAM,WAAW,aAAa,CAAC;EACpG;EACA;EACA;EACA;EACA;CACF;AACF"}
|
package/dist/context.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { r as Icon, t as ChatIconButton } from "./ui-primitives-
|
|
3
|
+
import { r as Icon, t as ChatIconButton } from "./ui-primitives-BJFXxysT.js";
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/context.tsx
|
package/dist/headless.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
import { ChatContextAdapter, ChatContextController, ChatContextItem, ChatContextOptions, ChatContextValue, ChatRequestContext, SelectedChatContextItem, TextSelectionAdapterOptions, createTextSelectionAdapter, useChatContext } from "./context.js";
|
|
3
3
|
import { SpeechInputAdapter, SpeechInputController, SpeechInputError, SpeechInputOptions, SpeechInputResult, SpeechInputSession, SpeechInputStartOptions, createBrowserSpeechAdapter, defaultSpeechInputLabels, useSpeechInput } from "./voice.js";
|
|
4
|
-
import {
|
|
5
|
-
export { type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatLabels, type ChatMessageActionContext, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, type ChatScrollHandle, type ChatSuggestedAction, type PartRendererProps, type PartRenderers, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, acceptsFile, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, safeUrl, useAiChat, useChatContext, useSpeechInput, zhCN };
|
|
4
|
+
import { A as ToolPresentationResolver, C as ChatScrollHandle, D as TextRenderer, E as PartRenderers, O as ToolPart, S as ChatPanelProps, T as PartRendererProps, _ as ChatBranchInfo, a as projectChatBranches, b as ChatMessageActionContext, c as zhCN, d as safeUrl, f as useAiChat, g as AttachmentOptions, h as AiChatProps, i as ProjectChatBranchesOptions, j as ToolRenderers, k as ToolPresentation, l as acceptsFile, m as AiChatOptions, n as ChatBranchesController, o as useChatBranches, p as AiChatController, r as ChatBranchesState, s as enUS, t as ChatBranchProjection, u as getMessageText, v as ChatComposerProps, w as ChatSuggestedAction, x as ChatMessagesProps, y as ChatLabels } from "./branches-4UjruXJV.js";
|
|
5
|
+
export { type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, type ChatBranchInfo, type ChatBranchProjection, type ChatBranchesController, type ChatBranchesState, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatLabels, type ChatMessageActionContext, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, type ChatScrollHandle, type ChatSuggestedAction, type PartRendererProps, type PartRenderers, type ProjectChatBranchesOptions, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, acceptsFile, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, projectChatBranches, safeUrl, useAiChat, useChatBranches, useChatContext, useSpeechInput, zhCN };
|
package/dist/headless.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import {
|
|
3
|
+
import { a as zhCN, n as useChatBranches, o as useAiChat, r as enUS, t as projectChatBranches } from "./branches-MrtWHEkd.js";
|
|
4
4
|
import { i as safeUrl, r as getMessageText, t as acceptsFile } from "./utils-DqBGBYA1.js";
|
|
5
5
|
import { SpeechInputError, createBrowserSpeechAdapter, defaultSpeechInputLabels, useSpeechInput } from "./voice.js";
|
|
6
6
|
import { createTextSelectionAdapter, useChatContext } from "./context.js";
|
|
7
|
-
export { SpeechInputError, acceptsFile, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, safeUrl, useAiChat, useChatContext, useSpeechInput, zhCN };
|
|
7
|
+
export { SpeechInputError, acceptsFile, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, projectChatBranches, safeUrl, useAiChat, useChatBranches, useChatContext, useSpeechInput, zhCN };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as ChatIconName, c as Icon, i as ChatAppearanceProviderProps, n as ChatIconButtonProps, o as ChatIconOverrides, r as ChatAppearanceProvider, s as ChatIconProps, t as ChatIconButton } from "./appearance-
|
|
2
|
+
import { a as ChatIconName, c as Icon, i as ChatAppearanceProviderProps, n as ChatIconButtonProps, o as ChatIconOverrides, r as ChatAppearanceProvider, s as ChatIconProps, t as ChatIconButton } from "./appearance-Bcj6SrBr.js";
|
|
3
3
|
import { ChatContextAdapter, ChatContextController, ChatContextItem, ChatContextOptions, ChatContextValue, ChatRequestContext, ContextTray, ContextTrayLabels, ContextTrayProps, SelectedChatContextItem, TextSelectionAdapterOptions, createTextSelectionAdapter, useChatContext } from "./context.js";
|
|
4
4
|
import { SpeechInputAdapter, SpeechInputController, SpeechInputError, SpeechInputErrorCode, SpeechInputLabels, SpeechInputOptions, SpeechInputResult, SpeechInputSession, SpeechInputStartOptions, SpeechInputState, SpeechInputSupport, UseSpeechInputOptions, createBrowserSpeechAdapter, defaultSpeechInputLabels, useSpeechInput } from "./voice.js";
|
|
5
|
-
import {
|
|
5
|
+
import { A as ToolPresentationResolver, C as ChatScrollHandle, D as TextRenderer, E as PartRenderers, O as ToolPart, S as ChatPanelProps, T as PartRendererProps, _ as ChatBranchInfo, a as projectChatBranches, b as ChatMessageActionContext, c as zhCN, f as useAiChat, g as AttachmentOptions, h as AiChatProps, i as ProjectChatBranchesOptions, j as ToolRenderers, k as ToolPresentation, m as AiChatOptions, n as ChatBranchesController, o as useChatBranches, p as AiChatController, r as ChatBranchesState, s as enUS, t as ChatBranchProjection, u as getMessageText, v as ChatComposerProps, w as ChatSuggestedAction, x as ChatMessagesProps, y as ChatLabels } from "./branches-4UjruXJV.js";
|
|
6
6
|
import { ActiveMarquee, ChatTargetHit, ChatTargetKind, ChatTargetRect, ChatTargetingController, ChatTargetingLabels, ChatTargetingOverlay, ChatTargetingOverlayProps, PendingChatTarget, UseChatTargetingOptions, enUSTargetingLabels, toChatContextItem, useChatTargeting, zhCNTargetingLabels } from "./targeting.js";
|
|
7
7
|
import { HTMLAttributes, ReactNode } from "react";
|
|
8
8
|
import { UIMessage } from "ai";
|
|
@@ -60,5 +60,26 @@ export declare function ChatHistoryMenu({ conversations, currentId, onSelect, on
|
|
|
60
60
|
/** Drafts and upload requests are isolated by conversation id. */
|
|
61
61
|
export declare function ChatComposer<M extends UIMessage = UIMessage>(props: ChatComposerProps<M>): import("react").JSX.Element;
|
|
62
62
|
//#endregion
|
|
63
|
-
|
|
63
|
+
//#region src/branch-switcher.d.ts
|
|
64
|
+
interface ChatBranchSwitcherProps {
|
|
65
|
+
branch: ChatBranchInfo;
|
|
66
|
+
onSelect: (messageId: string) => void;
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
labels?: Partial<ChatLabels>;
|
|
69
|
+
className?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Compact `< 2 / 3 >` sibling-branch navigation control. */
|
|
72
|
+
export declare function ChatBranchSwitcher({ branch, onSelect, disabled, labels: overrides, className }: ChatBranchSwitcherProps): import("react").JSX.Element | null;
|
|
73
|
+
interface ChatCheckpointBannerProps {
|
|
74
|
+
message?: ReactNode;
|
|
75
|
+
onRestore?: () => void;
|
|
76
|
+
restoreLabel?: string;
|
|
77
|
+
disabled?: boolean;
|
|
78
|
+
labels?: Partial<ChatLabels>;
|
|
79
|
+
className?: string;
|
|
80
|
+
}
|
|
81
|
+
/** Cursor-style checkpoint status bar shown when reverted before a message, with one-click Restore. */
|
|
82
|
+
export declare function ChatCheckpointBanner({ message, onRestore, restoreLabel, disabled, labels: overrides, className }: ChatCheckpointBannerProps): import("react").JSX.Element;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { type ActiveMarquee, type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, ChatAppearanceProvider, type ChatAppearanceProviderProps, type ChatBranchInfo, type ChatBranchProjection, type ChatBranchSwitcherProps, type ChatBranchesController, type ChatBranchesState, type ChatCheckpointBannerProps, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatHistoryItem, type ChatHistoryLabels, type ChatHistoryMenuProps, Icon as ChatIcon, ChatIconButton, type ChatIconButtonProps, type ChatIconName, type ChatIconOverrides, type ChatIconProps, type ChatLabels, type ChatMessageActionContext, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, type ChatScrollHandle, type ChatSuggestedAction, type ChatTargetHit, type ChatTargetKind, type ChatTargetRect, type ChatTargetingController, type ChatTargetingLabels, ChatTargetingOverlay, type ChatTargetingOverlayProps, ContextTray, type ContextTrayLabels, type ContextTrayProps, type PartRendererProps, type PartRenderers, type PendingChatTarget, type ProjectChatBranchesOptions, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputErrorCode, type SpeechInputLabels, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type SpeechInputState, type SpeechInputSupport, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, type UseChatTargetingOptions, type UseSpeechInputOptions, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, enUSTargetingLabels, getMessageText, projectChatBranches, toChatContextItem, useAiChat, useChatBranches, useChatContext, useChatTargeting, useSpeechInput, zhCN, zhCNTargetingLabels };
|
|
64
85
|
//# sourceMappingURL=index.d.ts.map
|