Files
ragflow/web/src/services/agent-service.ts
balibabu 6a170b2f6e Feat: Make the agent dialog window exposed to the outside world fill in the begin form #3221 (#9124)
### What problem does this PR solve?
Feat: Make the agent dialog window exposed to the outside world fill in
the begin form #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
2025-07-31 09:34:45 +08:00

130 lines
2.4 KiB
TypeScript

import { IAgentLogsRequest } from '@/interfaces/database/agent';
import api from '@/utils/api';
import { registerNextServer } from '@/utils/register-server';
import request from '@/utils/request';
const {
getCanvasSSE,
setCanvas,
listCanvas,
resetCanvas,
removeCanvas,
runCanvas,
listTemplates,
testDbConnect,
getInputElements,
debug,
listCanvasTeam,
settingCanvas,
uploadCanvasFile,
trace,
inputForm,
fetchVersionList,
fetchVersion,
fetchCanvas,
fetchAgentAvatar,
fetchAgentLogs,
fetchExternalAgentInputs,
} = api;
const methods = {
fetchCanvas: {
url: fetchCanvas,
method: 'get',
},
getCanvasSSE: {
url: getCanvasSSE,
method: 'get',
},
setCanvas: {
url: setCanvas,
method: 'post',
},
fetchVersionList: {
url: fetchVersionList,
method: 'get',
},
fetchVersion: {
url: fetchVersion,
method: 'get',
},
listCanvas: {
url: listCanvas,
method: 'get',
},
resetCanvas: {
url: resetCanvas,
method: 'post',
},
removeCanvas: {
url: removeCanvas,
method: 'post',
},
runCanvas: {
url: runCanvas,
method: 'post',
},
listTemplates: {
url: listTemplates,
method: 'get',
},
testDbConnect: {
url: testDbConnect,
method: 'post',
},
getInputElements: {
url: getInputElements,
method: 'get',
},
debugSingle: {
url: debug,
method: 'post',
},
listCanvasTeam: {
url: listCanvasTeam,
method: 'get',
},
settingCanvas: {
url: settingCanvas,
method: 'post',
},
uploadCanvasFile: {
url: uploadCanvasFile,
method: 'post',
},
trace: {
url: trace,
method: 'get',
},
inputForm: {
url: inputForm,
method: 'get',
},
fetchAgentAvatar: {
url: fetchAgentAvatar,
method: 'get',
},
fetchAgentLogs: {
url: fetchAgentLogs,
method: 'get',
},
fetchExternalAgentInputs: {
url: fetchExternalAgentInputs,
method: 'get',
},
} as const;
const agentService = registerNextServer<keyof typeof methods>(methods);
export const fetchTrace = (data: { canvas_id: string; message_id: string }) => {
return request.get(methods.trace.url, { params: data });
};
export const fetchAgentLogsByCanvasId = (
canvasId: string,
params: IAgentLogsRequest,
) => {
return request.get(methods.fetchAgentLogs.url(canvasId), { params: params });
};
export default agentService;