feat(frontend): add batch processing and review features
- Add batch processing API and mode - Add deep read mode for full-text analysis - Add document selector and switcher components - Add review page with editorial and methodology assessment - Add capacity indicator and usage info modal - Add custom hooks for batch tasks and chat modes - Update layouts and routing - Add TypeScript types for chat features
This commit is contained in:
91
frontend/src/types/chat.ts
Normal file
91
frontend/src/types/chat.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Phase 2: 聊天模式相关类型定义
|
||||
*/
|
||||
|
||||
import { Document } from './index'
|
||||
|
||||
/**
|
||||
* 聊天基础模式
|
||||
*/
|
||||
export type ChatBaseMode = 'general' | 'knowledge_base'
|
||||
|
||||
/**
|
||||
* 知识库工作模式
|
||||
*/
|
||||
export type KnowledgeBaseMode = 'full_text' | 'deep_read' | 'batch'
|
||||
|
||||
/**
|
||||
* 聊天页面状态
|
||||
*/
|
||||
export interface ChatPageState {
|
||||
// 基础模式
|
||||
baseMode: ChatBaseMode
|
||||
|
||||
// 知识库配置
|
||||
selectedKbId?: string
|
||||
kbMode?: KnowledgeBaseMode
|
||||
|
||||
// 全文阅读模式状态
|
||||
fullTextState?: FullTextModeState
|
||||
|
||||
// 逐篇精读模式状态
|
||||
deepReadState?: DeepReadModeState
|
||||
}
|
||||
|
||||
/**
|
||||
* 全文阅读模式状态
|
||||
*/
|
||||
export interface FullTextModeState {
|
||||
loadedDocs: Document[]
|
||||
totalFiles: number
|
||||
selectedFiles: number
|
||||
totalTokens: number
|
||||
usedTokens: number
|
||||
availableTokens: number
|
||||
reason: 'all_included' | 'file_limit' | 'token_limit'
|
||||
}
|
||||
|
||||
/**
|
||||
* 逐篇精读模式状态
|
||||
*/
|
||||
export interface DeepReadModeState {
|
||||
selectedDocs: Document[]
|
||||
currentDocId: string
|
||||
currentDoc?: Document
|
||||
currentConversation: ChatMessage[]
|
||||
conversationPerDoc: Map<string, ChatMessage[]>
|
||||
totalTokens: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 聊天消息
|
||||
*/
|
||||
export interface ChatMessage {
|
||||
id: string
|
||||
role: 'user' | 'assistant' | 'system'
|
||||
content: string
|
||||
timestamp: Date
|
||||
metadata?: any
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档选择结果(从API返回)
|
||||
*/
|
||||
export interface DocumentSelectionResult {
|
||||
knowledgeBaseId: string
|
||||
knowledgeBaseName: string
|
||||
limits: {
|
||||
maxFiles: number
|
||||
maxTokens: number
|
||||
}
|
||||
selection: {
|
||||
selectedCount: number
|
||||
selectedTokens: number
|
||||
excludedCount: number
|
||||
availableTokens: number
|
||||
reason: 'all_included' | 'file_limit' | 'token_limit'
|
||||
}
|
||||
selectedDocuments: Document[]
|
||||
excludedDocuments: Document[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user