feat: drop assistant ui, use custom chat ui

This commit is contained in:
bracesproul
2025-03-03 12:31:27 -08:00
parent a75c710990
commit 3f3f50d5c5
20 changed files with 4553 additions and 2477 deletions

View File

@@ -6,7 +6,7 @@ import { stockbrokerGraph } from "./stockbroker";
import { ChatOpenAI } from "@langchain/openai";
async function router(
state: GenerativeUIState
state: GenerativeUIState,
): Promise<Partial<GenerativeUIState>> {
const routerDescription = `The route to take based on the user's input.
- stockbroker: can fetch the price of a ticker, purchase/sell a ticker, or get the user's portfolio
@@ -35,7 +35,7 @@ async function router(
You should analyze the user's input, and choose the appropriate tool to use.`;
const recentHumanMessage = state.messages.findLast(
(m) => m.getType() === "human"
(m) => m.getType() === "human",
);
if (!recentHumanMessage) {
@@ -60,7 +60,7 @@ You should analyze the user's input, and choose the appropriate tool to use.`;
}
function handleRoute(
state: GenerativeUIState
state: GenerativeUIState,
): "stockbroker" | "weather" | "generalInput" {
return state.next;
}