-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtypes.ts
More file actions
42 lines (35 loc) · 1.2 KB
/
types.ts
File metadata and controls
42 lines (35 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { Geo } from "@vercel/edge"
import { StreamableValue } from "@ai-sdk/rsc"
import { ReactNode } from "react"
import { allDocuments } from "contentlayer/generated"
// Define the AI state and UI state types
export type ServerMessage = {
role: "user" | "assistant"
content: string
}
export type ChatMessage = {
id: string
role: "user" | "assistant" | "error"
display: ReactNode
}
export type AIState = { id: string; messages: ServerMessage[]; location: Geo }
export type UIState = ChatMessage[]
// Define the actions type
export type AIActions = {
continueConversation: (input: string, location: Geo) => Promise<StreamableValue<any, any>>
}
// Define a generic DocumentType that all your content types conform to
export type DocumentType = (typeof allDocuments)[number]
// Create a map of all document types for easier access
export const documentCollections = {
about: "allAbouts",
award: "allAwards",
certification: "allCertifications",
education: "allEducation",
experience: "allExperiences",
language: "allLanguages",
project: "allProjects",
recommendation: "allRecommendations",
volunteering: "allVolunteerings",
} as const
export type DocumentTag = keyof typeof documentCollections