mirror of
https://github.com/aiclientproxy/proxycast.git
synced 2026-09-24 23:10:56 +08:00
fix(agent-chat): align clearMessages signature with unified hook callers
This commit is contained in:
@@ -936,16 +936,29 @@ export function useAsterAgentChat(options: UseAsterAgentChatOptions) {
|
||||
await sendMessage("", [], false, false, true);
|
||||
}, [sendMessage]);
|
||||
|
||||
// 清空消息
|
||||
const clearMessages = useCallback(() => {
|
||||
setMessages([]);
|
||||
setSessionId(null);
|
||||
setPendingActions([]);
|
||||
restoredWorkspaceRef.current = null;
|
||||
hydratedSessionRef.current = null;
|
||||
skipAutoRestoreRef.current = true;
|
||||
toast.success("新话题已创建");
|
||||
}, []);
|
||||
// 清空消息(兼容 useAgentChat 的可选参数)
|
||||
const clearMessages = useCallback(
|
||||
(
|
||||
options: {
|
||||
showToast?: boolean;
|
||||
toastMessage?: string;
|
||||
} = {},
|
||||
) => {
|
||||
const { showToast = true, toastMessage = "新话题已创建" } = options;
|
||||
|
||||
setMessages([]);
|
||||
setSessionId(null);
|
||||
setPendingActions([]);
|
||||
restoredWorkspaceRef.current = null;
|
||||
hydratedSessionRef.current = null;
|
||||
skipAutoRestoreRef.current = true;
|
||||
|
||||
if (showToast) {
|
||||
toast.success(toastMessage);
|
||||
}
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
// 删除消息
|
||||
const deleteMessage = useCallback((id: string) => {
|
||||
|
||||
Reference in New Issue
Block a user