重构 Agent 聊天,支持分支管理与消息克隆
This commit is contained in:
@@ -41,6 +41,8 @@ interface ChatToolState {
|
||||
lastAction: ChatToolAction | null;
|
||||
/** Monotonically increasing counter – lets subscribers detect new actions. */
|
||||
actionSeq: number;
|
||||
/** Timestamp of the most recent action dispatch. */
|
||||
lastActionAt: number;
|
||||
/** Dispatch a tool action from the chat. */
|
||||
dispatch: (action: ChatToolAction) => void;
|
||||
}
|
||||
@@ -48,9 +50,11 @@ interface ChatToolState {
|
||||
export const useChatToolStore = create<ChatToolState>((set) => ({
|
||||
lastAction: null,
|
||||
actionSeq: 0,
|
||||
lastActionAt: 0,
|
||||
dispatch: (action) =>
|
||||
set((state) => ({
|
||||
lastAction: action,
|
||||
actionSeq: state.actionSeq + 1,
|
||||
lastActionAt: Date.now(),
|
||||
})),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user