feat(frontend): Day 6 - frontend basic architecture completed
This commit is contained in:
89
frontend/src/types/index.ts
Normal file
89
frontend/src/types/index.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
// 用户类型
|
||||
export interface User {
|
||||
id: string
|
||||
email: string
|
||||
name?: string
|
||||
avatarUrl?: string
|
||||
role: 'user' | 'admin'
|
||||
}
|
||||
|
||||
// 项目类型
|
||||
export interface Project {
|
||||
id: string
|
||||
userId: string
|
||||
name: string
|
||||
description: string
|
||||
conversationCount: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
// 会话类型
|
||||
export interface Conversation {
|
||||
id: string
|
||||
userId: string
|
||||
projectId?: string
|
||||
agentId: string
|
||||
title: string
|
||||
modelName: string
|
||||
messageCount: number
|
||||
totalTokens: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
// 消息类型
|
||||
export interface Message {
|
||||
id: string
|
||||
conversationId: string
|
||||
role: 'user' | 'assistant'
|
||||
content: string
|
||||
metadata?: {
|
||||
kbReferences?: string[]
|
||||
citations?: any[]
|
||||
modelParams?: any
|
||||
}
|
||||
tokens?: number
|
||||
isPinned: boolean
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
// 知识库类型
|
||||
export interface KnowledgeBase {
|
||||
id: string
|
||||
userId: string
|
||||
name: string
|
||||
description?: string
|
||||
difyDatasetId: string
|
||||
fileCount: number
|
||||
totalSizeBytes: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
// 文档类型
|
||||
export interface Document {
|
||||
id: string
|
||||
kbId: string
|
||||
userId: string
|
||||
filename: string
|
||||
fileType: string
|
||||
fileSizeBytes: number
|
||||
fileUrl: string
|
||||
difyDocumentId: string
|
||||
status: 'uploading' | 'processing' | 'completed' | 'failed'
|
||||
progress: number
|
||||
errorMessage?: string
|
||||
segmentsCount?: number
|
||||
tokensCount?: number
|
||||
uploadedAt: string
|
||||
processedAt?: string
|
||||
}
|
||||
|
||||
// API响应类型
|
||||
export interface ApiResponse<T = any> {
|
||||
success: boolean
|
||||
data: T
|
||||
message?: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user