Merge pull request #299 from JefferyHcool/feature/note-qa-chat-optimize

Feature/note qa chat optimize
This commit is contained in:
Jianwu Huang
2026-03-23 16:00:15 +08:00
committed by GitHub
15 changed files with 1197 additions and 4 deletions

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
export interface ChatMessage {
role: 'user' | 'assistant'
content: string
}
export interface ChatSource {
text: string
source_type: 'markdown' | 'transcript'
section_title?: string
start_time?: number
end_time?: number
}
export interface AskResponse {
answer: string
sources: ChatSource[]
}
export type IndexStatus = 'idle' | 'indexing' | 'indexed' | 'failed'
export interface ChatStatusResponse {
indexed: boolean
status: IndexStatus
}
export const indexTask = async (taskId: string): Promise<void> => {
return await request.post('/chat/index', { task_id: taskId })
}
export const askQuestion = async (data: {
task_id: string
question: string
history: ChatMessage[]
provider_id: string
model_name: string
}): Promise<AskResponse> => {
return await request.post('/chat/ask', data, { timeout: 60000 })
}
export const getChatStatus = async (taskId: string): Promise<ChatStatusResponse> => {
return await request.get(`/chat/status?task_id=${taskId}`)
}