diff --git a/agent/stockbroker/nodes/tools.tsx b/agent/stockbroker/nodes/tools.tsx index d31a7dc..d434b06 100644 --- a/agent/stockbroker/nodes/tools.tsx +++ b/agent/stockbroker/nodes/tools.tsx @@ -65,7 +65,7 @@ export async function callTools( return { messages: [message], - ui: ui.collect, + ui: ui.collect as StockbrokerUpdate["ui"], timestamp: Date.now(), }; } diff --git a/agent/trip-planner/nodes/tools.tsx b/agent/trip-planner/nodes/tools.tsx index e32e2b4..be4e8d3 100644 --- a/agent/trip-planner/nodes/tools.tsx +++ b/agent/trip-planner/nodes/tools.tsx @@ -111,7 +111,7 @@ export async function callTools( return { messages: [response], - ui: ui.collect, + ui: ui.collect as TripPlannerUpdate["ui"], timestamp: Date.now(), }; } diff --git a/agent/trip-planner/types.ts b/agent/trip-planner/types.ts index 2fc66a4..391aa0d 100644 --- a/agent/trip-planner/types.ts +++ b/agent/trip-planner/types.ts @@ -16,4 +16,4 @@ export const TripPlannerAnnotation = Annotation.Root({ }); export type TripPlannerState = typeof TripPlannerAnnotation.State; -export type TripPlannerUpdate = typeof TripPlannerAnnotation.Update; \ No newline at end of file +export type TripPlannerUpdate = typeof TripPlannerAnnotation.Update; diff --git a/agent/types.ts b/agent/types.ts index a5355bb..4f109dc 100644 --- a/agent/types.ts +++ b/agent/types.ts @@ -1,9 +1,16 @@ import { MessagesAnnotation, Annotation } from "@langchain/langgraph"; -import { uiMessageReducer } from "@langchain/langgraph-sdk/react-ui/types"; +import { + RemoveUIMessage, + UIMessage, + uiMessageReducer, +} from "@langchain/langgraph-sdk/react-ui/types"; export const GenerativeUIAnnotation = Annotation.Root({ messages: MessagesAnnotation.spec["messages"], - ui: Annotation({ default: () => [], reducer: uiMessageReducer }), + ui: Annotation< + UIMessage[], + UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[] + >({ default: () => [], reducer: uiMessageReducer }), timestamp: Annotation, next: Annotation<"stockbroker" | "tripPlanner" | "generalInput">(), });