mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-28 14:16:34 +08:00
### What problem does this PR solve? Feat: Remove HMAC from the webhook #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
155 lines
2.9 KiB
TypeScript
155 lines
2.9 KiB
TypeScript
import {
|
|
IAgentLogsRequest,
|
|
IPipeLineListRequest,
|
|
} from '@/interfaces/database/agent';
|
|
import { IAgentWebhookTraceRequest } from '@/interfaces/request/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,
|
|
settingCanvas,
|
|
uploadCanvasFile,
|
|
trace,
|
|
inputForm,
|
|
fetchVersionList,
|
|
fetchVersion,
|
|
fetchCanvas,
|
|
fetchAgentAvatar,
|
|
fetchAgentLogs,
|
|
fetchExternalAgentInputs,
|
|
prompt,
|
|
cancelDataflow,
|
|
cancelCanvas,
|
|
} = 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',
|
|
},
|
|
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',
|
|
},
|
|
fetchPrompt: {
|
|
url: prompt,
|
|
method: 'get',
|
|
},
|
|
cancelDataflow: {
|
|
url: cancelDataflow,
|
|
method: 'put',
|
|
},
|
|
cancelCanvas: {
|
|
url: cancelCanvas,
|
|
method: 'put',
|
|
},
|
|
} 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 const fetchPipeLineList = (params: IPipeLineListRequest) => {
|
|
return request.get(api.listCanvas, { params: params });
|
|
};
|
|
|
|
export const fetchWebhookTrace = (
|
|
id: string,
|
|
params: IAgentWebhookTraceRequest,
|
|
) => {
|
|
return request.get(api.fetchWebhookTrace(id), { params: params });
|
|
};
|
|
|
|
export default agentService;
|