diff --git a/packages/ai-core b/packages/ai-core index 7e277aa55c..8192fb940d 160000 --- a/packages/ai-core +++ b/packages/ai-core @@ -1 +1 @@ -Subproject commit 7e277aa55cfbfffd481f0149eb2e30edc8b4d8ee +Subproject commit 8192fb940dc1e8973da43482677a9ef44456f505 diff --git a/packages/pro-components/chat/chat-engine/hooks/useAgentState.ts b/packages/pro-components/chat/chat-engine/hooks/useAgentState.ts index 6682ad36f8..77470872e9 100644 --- a/packages/pro-components/chat/chat-engine/hooks/useAgentState.ts +++ b/packages/pro-components/chat/chat-engine/hooks/useAgentState.ts @@ -2,6 +2,8 @@ import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react'; import { stateManager } from '@tdesign/ai-chat-engine'; +import type { ChatJSONObject } from '@tdesign/ai-chat-engine'; + /** * 状态订阅相关类型定义 */ @@ -41,7 +43,7 @@ export interface UseStateActionReturn { getStateByKey: (key: string) => any; } -export const useAgentState = (options: StateActionOptions = {}): UseStateActionReturn => { +export const useAgentState = (options: StateActionOptions = {}): UseStateActionReturn => { const { initialState, subscribeKey } = options; const [stateMap, setStateMap] = useState>(initialState || {}); const [currentStateKey, setCurrentStateKey] = useState(null); @@ -52,7 +54,7 @@ export const useAgentState = (options: StateActionOptions = {}): UseSta useEffect( () => - stateManager.subscribeToLatest((newState: T, newStateKey: string) => { + stateManager.subscribeToLatest((newState: ChatJSONObject, newStateKey: string) => { // 如果指定了 subscribeKey,只有匹配时才更新状态 if (subscribeKey && newStateKey !== subscribeKey) { // 仍然更新内部状态,但不触发重新渲染