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:
@@ -14,10 +14,25 @@ import type {
|
||||
PaginatedResponse,
|
||||
ProjectStatistics
|
||||
} from '../types';
|
||||
import { getAccessToken } from '../../../framework/auth/api';
|
||||
|
||||
// API基础URL
|
||||
const API_BASE_URL = '/api/v1/asl';
|
||||
|
||||
/**
|
||||
* 获取带认证的请求头
|
||||
*/
|
||||
function getAuthHeaders(): HeadersInit {
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
const token = getAccessToken();
|
||||
if (token) {
|
||||
headers['Authorization'] = `Bearer ${token}`;
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
|
||||
// 通用请求函数
|
||||
async function request<T = any>(
|
||||
url: string,
|
||||
@@ -26,7 +41,7 @@ async function request<T = any>(
|
||||
const response = await fetch(`${API_BASE_URL}${url}`, {
|
||||
...options,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...getAuthHeaders(),
|
||||
...options?.headers,
|
||||
},
|
||||
});
|
||||
@@ -239,7 +254,8 @@ export async function exportScreeningResults(
|
||||
).toString();
|
||||
|
||||
const response = await fetch(
|
||||
`${API_BASE_URL}/projects/${projectId}/screening/results/export?${queryString}`
|
||||
`${API_BASE_URL}/projects/${projectId}/screening/results/export?${queryString}`,
|
||||
{ headers: getAuthHeaders() }
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -409,7 +425,8 @@ export async function exportFulltextResults(
|
||||
taskId: string
|
||||
): Promise<Blob> {
|
||||
const response = await fetch(
|
||||
`${API_BASE_URL}/fulltext-screening/tasks/${taskId}/export`
|
||||
`${API_BASE_URL}/fulltext-screening/tasks/${taskId}/export`,
|
||||
{ headers: getAuthHeaders() }
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user