fix(pkb): fix create KB and upload issues - remove simulated upload, fix department mapping, add upload modal

Fixed issues:
- Remove simulateUpload function from DashboardPage Step 3
- Map department to description field when creating KB
- Add upload modal in WorkspacePage knowledge assets tab
- Fix DocumentUpload import path (../../stores to ../stores)

Known issue: Dify API validation error during document upload (file uploaded but DB record failed, needs investigation)

Testing: KB creation works, upload dialog opens correctly
This commit is contained in:
2026-01-13 13:17:20 +08:00
parent d595037316
commit 4088275290
280 changed files with 4344 additions and 150 deletions

View File

@@ -1,7 +1,7 @@
/**
* RVW模块API
*/
import axios from 'axios';
import apiClient from '../../../common/api/axios';
import type { ReviewTask, ReviewReport, ApiResponse, AgentType } from '../types';
const API_BASE = '/api/v2/rvw';
@@ -9,7 +9,7 @@ const API_BASE = '/api/v2/rvw';
// 获取任务列表
export async function getTasks(status?: string): Promise<ReviewTask[]> {
const params = status && status !== 'all' ? { status } : {};
const response = await axios.get<ApiResponse<ReviewTask[]>>(`${API_BASE}/tasks`, { params });
const response = await apiClient.get<ApiResponse<ReviewTask[]>>(`${API_BASE}/tasks`, { params });
return response.data.data || [];
}
@@ -21,7 +21,7 @@ export async function uploadManuscript(file: File, selectedAgents?: AgentType[])
formData.append('selectedAgents', JSON.stringify(selectedAgents));
}
const response = await axios.post<ApiResponse<{ taskId: string }>>(`${API_BASE}/tasks`, formData, {
const response = await apiClient.post<ApiResponse<{ taskId: string }>>(`${API_BASE}/tasks`, formData, {
headers: { 'Content-Type': 'multipart/form-data' },
});
@@ -34,19 +34,19 @@ export async function uploadManuscript(file: File, selectedAgents?: AgentType[])
// 获取任务详情
export async function getTask(taskId: string): Promise<ReviewTask> {
const response = await axios.get<ApiResponse<ReviewTask>>(`${API_BASE}/tasks/${taskId}`);
const response = await apiClient.get<ApiResponse<ReviewTask>>(`${API_BASE}/tasks/${taskId}`);
return response.data.data!;
}
// 获取任务报告
export async function getTaskReport(taskId: string): Promise<ReviewReport> {
const response = await axios.get<ApiResponse<ReviewReport>>(`${API_BASE}/tasks/${taskId}/report`);
const response = await apiClient.get<ApiResponse<ReviewReport>>(`${API_BASE}/tasks/${taskId}/report`);
return response.data.data!;
}
// 运行审查任务返回jobId供轮询
export async function runTask(taskId: string, agents: AgentType[]): Promise<{ taskId: string; jobId: string }> {
const response = await axios.post<ApiResponse<{ taskId: string; jobId: string }>>(`${API_BASE}/tasks/${taskId}/run`, { agents });
const response = await apiClient.post<ApiResponse<{ taskId: string; jobId: string }>>(`${API_BASE}/tasks/${taskId}/run`, { agents });
if (!response.data.success) {
throw new Error(response.data.error || '运行失败');
}
@@ -55,7 +55,7 @@ export async function runTask(taskId: string, agents: AgentType[]): Promise<{ ta
// 批量运行审查任务
export async function batchRunTasks(taskIds: string[], agents: AgentType[]): Promise<void> {
const response = await axios.post<ApiResponse<void>>(`${API_BASE}/tasks/batch/run`, { taskIds, agents });
const response = await apiClient.post<ApiResponse<void>>(`${API_BASE}/tasks/batch/run`, { taskIds, agents });
if (!response.data.success) {
throw new Error(response.data.error || '批量运行失败');
}
@@ -63,7 +63,7 @@ export async function batchRunTasks(taskIds: string[], agents: AgentType[]): Pro
// 删除任务
export async function deleteTask(taskId: string): Promise<void> {
await axios.delete(`${API_BASE}/tasks/${taskId}`);
await apiClient.delete(`${API_BASE}/tasks/${taskId}`);
}
// 轮询任务状态
@@ -129,3 +129,4 @@ export function formatTime(dateStr: string): string {
}

View File

@@ -122,3 +122,6 @@ export default function AgentModal({ visible, taskCount, onClose, onConfirm }: A
}

View File

@@ -42,3 +42,6 @@ export default function BatchToolbar({ selectedCount, onRunBatch, onClearSelecti
}

View File

@@ -65,3 +65,6 @@ export default function FilterChips({ filters, counts, onFilterChange }: FilterC
}

View File

@@ -55,3 +55,6 @@ export default function Header({ onUpload }: HeaderProps) {
}

View File

@@ -109,3 +109,6 @@ export default function ReportDetail({ report, onBack }: ReportDetailProps) {
}

View File

@@ -37,3 +37,6 @@ export default function ScoreRing({ score, size = 'medium', showLabel = true }:
}

View File

@@ -72,3 +72,6 @@ export default function Sidebar({ currentView, onViewChange, onSettingsClick }:
}

View File

@@ -14,3 +14,6 @@ export { default as ReportDetail } from './ReportDetail';
export { default as TaskDetail } from './TaskDetail';

View File

@@ -283,3 +283,6 @@ export default function Dashboard() {
}

View File

@@ -232,3 +232,6 @@
}