33 lines
655 B
TypeScript
33 lines
655 B
TypeScript
|
|
import type { InferUITool, UIMessage } from "ai";
|
||
|
|
import { z } from "zod";
|
||
|
|
import type { getWeather } from "./ai/tools/get-weather";
|
||
|
|
|
||
|
|
export const messageMetadataSchema = z.object({
|
||
|
|
createdAt: z.string(),
|
||
|
|
});
|
||
|
|
|
||
|
|
export type MessageMetadata = z.infer<typeof messageMetadataSchema>;
|
||
|
|
|
||
|
|
type weatherTool = InferUITool<typeof getWeather>;
|
||
|
|
|
||
|
|
export type ChatTools = {
|
||
|
|
getWeather: weatherTool;
|
||
|
|
};
|
||
|
|
|
||
|
|
export type CustomUIDataTypes = {
|
||
|
|
appendMessage: string;
|
||
|
|
"chat-title": string;
|
||
|
|
};
|
||
|
|
|
||
|
|
export type ChatMessage = UIMessage<
|
||
|
|
MessageMetadata,
|
||
|
|
CustomUIDataTypes,
|
||
|
|
ChatTools
|
||
|
|
>;
|
||
|
|
|
||
|
|
export type Attachment = {
|
||
|
|
name: string;
|
||
|
|
url: string;
|
||
|
|
contentType: string;
|
||
|
|
};
|