initial commit

This commit is contained in:
2026-10-16 21:39:08 +08:00
commit 1a9220364b
32 changed files with 6380 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
/** UI 主题偏好。与 constants/index.ts 的 AI 配置无关,不要混为一谈。 */
export type ThemeMode = 'dark' | 'light'
export type MessageRole = 'system' | 'user' | 'assistant'
export type MessageStatus = 'pending' | 'streaming' | 'success' | 'error' | 'stopped'
export interface ChatMessage {
id: string
role: MessageRole
content: string
createdAt: number
isLoading?: boolean
error?: boolean
status?: MessageStatus
}
export interface MessageActionPayload {
messageId: string
}
export interface ChatSession {
id: string
title: string
createdAt: number
updatedAt: number
messages: ChatMessage[]
}
export interface AppConfig {
baseUrl: string
apiKey: string
model: string
temperature: number
maxTokens: number
contextRounds: number
systemPrompt: string
stream: boolean
}
export interface ExportedChatSessionsPayload {
exportedAt: number
sessions: ChatSession[]
activeSessionId: string
}
export interface OpenAIMessage {
role: MessageRole
content: string
}
export interface SendMessagePayload {
content: string
}
export interface RequestChatParams {
config: AppConfig
messages: OpenAIMessage[]
signal?: AbortSignal
onMessage: (content: string, done: boolean) => void
}