feat(asl): Add DeepSearch smart literature retrieval MVP

Features:
- Integrate unifuncs DeepSearch API (OpenAI compatible protocol)
- SSE real-time streaming for AI thinking process display
- Natural language input, auto-generate PubMed search strategy
- Extract and display PubMed literature links
- Database storage for task records (asl_research_tasks)

Backend:
- researchService.ts - Core business logic with SSE streaming
- researchController.ts - SSE stream endpoint
- researchWorker.ts - Async task worker (backup mode)
- schema.prisma - AslResearchTask model

Frontend:
- ResearchSearch.tsx - Search page with unified content stream
- ResearchSearch.css - Styling (unifuncs-inspired simple design)
- ASLLayout.tsx - Enable menu item
- api/index.ts - Add research API functions

API Endpoints:
- POST /api/v1/asl/research/stream - SSE streaming search
- POST /api/v1/asl/research/tasks - Async task creation
- GET /api/v1/asl/research/tasks/:taskId/status - Task status

Documentation:
- Development record for DeepSearch integration
- Update ASL module status (v1.5)
- Update system status (v3.7)

Known limitations:
- SSE mode, task interrupts when leaving page
- Cost ~0.3 RMB per search (unifuncs API)
This commit is contained in:
2026-01-18 19:15:55 +08:00
parent 57fdc6ef00
commit 1ece9a4ae8
20 changed files with 2052 additions and 16 deletions

View File

@@ -436,6 +436,48 @@ export async function exportFulltextResults(
return response.blob();
}
// ==================== 智能文献检索API (DeepSearch) ====================
/**
* 创建智能文献检索任务
*/
export async function createResearchTask(data: {
projectId: string;
query: string;
}): Promise<ApiResponse<{
id: string;
status: string;
}>> {
return request('/research/tasks', {
method: 'POST',
body: JSON.stringify(data),
});
}
/**
* 获取智能文献检索任务状态
*/
export async function getResearchTaskStatus(
taskId: string
): Promise<ApiResponse<{
taskId: string;
status: 'processing' | 'ready' | 'error';
progress: number;
query?: string;
resultCount?: number;
reasoningContent?: string;
literatures?: Array<{
pmid: string;
title: string;
authors: string;
journal: string;
year: number;
}>;
errorMessage?: string;
}>> {
return request(`/research/tasks/${taskId}/status`);
}
// ==================== 统一导出API对象 ====================
/**
@@ -482,4 +524,8 @@ export const aslApi = {
// 健康检查
healthCheck,
// 智能文献检索 (DeepSearch)
createResearchTask,
getResearchTaskStatus,
};