fix some types

This commit is contained in:
bracesproul
2025-03-05 12:09:57 -08:00
parent e64e87b428
commit 16470a75c0
4 changed files with 12 additions and 5 deletions

View File

@@ -65,7 +65,7 @@ export async function callTools(
return { return {
messages: [message], messages: [message],
ui: ui.collect, ui: ui.collect as StockbrokerUpdate["ui"],
timestamp: Date.now(), timestamp: Date.now(),
}; };
} }

View File

@@ -111,7 +111,7 @@ export async function callTools(
return { return {
messages: [response], messages: [response],
ui: ui.collect, ui: ui.collect as TripPlannerUpdate["ui"],
timestamp: Date.now(), timestamp: Date.now(),
}; };
} }

View File

@@ -1,9 +1,16 @@
import { MessagesAnnotation, Annotation } from "@langchain/langgraph"; 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({ export const GenerativeUIAnnotation = Annotation.Root({
messages: MessagesAnnotation.spec["messages"], messages: MessagesAnnotation.spec["messages"],
ui: Annotation({ default: () => [], reducer: uiMessageReducer }), ui: Annotation<
UIMessage[],
UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]
>({ default: () => [], reducer: uiMessageReducer }),
timestamp: Annotation<number>, timestamp: Annotation<number>,
next: Annotation<"stockbroker" | "tripPlanner" | "generalInput">(), next: Annotation<"stockbroker" | "tripPlanner" | "generalInput">(),
}); });