fix(conflicts): Merge branch 'refator' into dev

This commit is contained in:
sophie committed 2026-06-01 19:37:59 +08:00
commit 7f126cfd52
24 files changed
+2314 -4223

No files matched your search

+80
View File
@@ -0,0 +1,80 @@
import { getAuthHeaders } from '../utils/auth';
import { requestJson } from './client';
const auth = () => ({ headers: getAuthHeaders() });
const jsonAuth = () => ({ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() } });
export interface ChatSessionItem {
id: number;
conversation_id: string;
title: string;
created_at: string;
}
export interface LeaveAgentOption {
uid: string;
employeeId: string;
name: string;
jobtitle?: string;
jobtitleName?: string;
departmentid?: string;
subcompanyid1?: string;
departmentName?: string;
subcompanyName?: string;
}
export interface OaEmployeesResponse {
items: LeaveAgentOption[];
total: number;
}
export interface ChatSourceFileResult {
source_download_url?: string;
source_filename?: string;
source_ext?: string;
}
export const listChatSessions = (agentId: number) =>
requestJson<ChatSessionItem[]>(`/api/chat/sessions?agent_id=${agentId}`, auth());
export const deleteAllChatSessions = (agentId: number) =>
requestJson(`/api/chat/sessions?agent_id=${agentId}`, { method: 'DELETE', ...auth() });
export const deleteChatSession = (conversationId: string, agentId: number) =>
requestJson(`/api/chat/sessions/${conversationId}?agent_id=${agentId}`, { method: 'DELETE', ...auth() });
export const listChatMessages = (conversationId: string, agentId: number) =>
requestJson<any[]>(`/api/chat/messages?conversation_id=${conversationId}&agent_id=${agentId}`, auth());
export const saveLocalChatMessage = (payload: Record<string, unknown>) =>
requestJson<{ conversation_id?: string; chat_log_id?: number }>('/api/chat/messages/local', {
method: 'POST',
...jsonAuth(),
body: JSON.stringify(payload),
});
export const resolveChatSourceFile = (params: {
agent_id: number;
dataset_id: string;
remote_document_id: string;
}) => {
const qs = new URLSearchParams({
agent_id: String(params.agent_id),
dataset_id: params.dataset_id,
remote_document_id: params.remote_document_id,
});
return requestJson<ChatSourceFileResult>(`/api/chat/source-file?${qs.toString()}`, auth());
};
export const listOaEmployees = (
agentId: number,
query: { keyword?: string; page?: number; page_size?: number },
) => {
const qs = new URLSearchParams({
agent_id: String(agentId),
keyword: query.keyword || '',
page: String(query.page ?? 1),
page_size: String(query.page_size ?? 20),
});
return requestJson<OaEmployeesResponse>(`/api/chat/oa/employees?${qs.toString()}`, auth());
};