Files
supabase/packages/ui-patterns/CommandMenu/prepackaged/ai/utils.ts
Charis e3e8cd943c feat: replace docs command menu with v2 (#28048)
Replace docs command menu with Command Menu V2 from ui-patterns/CommandMenu.

This introduces the prepackaged folder for the shared Command Menu, which contains commands that are shared across the sites (for example, docs search, theme switcher).

Commands that are only applicable to a single site are now defined within that site's own app folder (put them wherever makes sense for your app folder organization, as long as you use the hooks within a global CommandProvider it will work...)

Tested navigating around, using search and AI on laptop and mobile.
2024-07-31 14:20:30 -04:00

45 lines
776 B
TypeScript

enum MessageRole {
User = 'user',
Assistant = 'assistant',
}
enum MessageStatus {
Pending = 'pending',
InProgress = 'in-progress',
Complete = 'complete',
}
interface Message {
role: MessageRole
content: string
status: MessageStatus
idempotencyKey?: number
}
interface NewMessageAction {
type: 'new'
message: Message
}
interface UpdateMessageAction {
type: 'update'
index: number
message: Partial<Message>
}
interface AppendContentAction {
type: 'append-content'
index: number
content: string
idempotencyKey: number
}
interface ResetAction {
type: 'reset'
}
type MessageAction = NewMessageAction | UpdateMessageAction | AppendContentAction | ResetAction
export { MessageRole, MessageStatus }
export type { Message, MessageAction }