Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: send agent log date filters as local wall-clock strings (#16575)

chanx9a6d30bfe6e0
diff --git a/web/src/services/agent-service.ts b/web/src/services/agent-service.ts
index fee6709eae..78fbfd82b3 100644
--- a/web/src/services/agent-service.ts
+++ b/web/src/services/agent-service.ts
@@ -6,6 +6,7 @@ import { IAgentWebhookTraceRequest } from '@/interfaces/request/agent';
import api from '@/utils/api';
import { registerNextServer } from '@/utils/register-server';
import request from '@/utils/request';
+import dayjs from 'dayjs';
const {
createAgent,
@@ -167,7 +168,30 @@ export const fetchAgentLogsByCanvasId = (
canvasId: string,
params: IAgentLogsRequest,
) => {
- return request.get(methods.fetchAgentLogs.url(canvasId), { params: params });
+ // Serialize Date values as local wall-clock strings ("YYYY-MM-DD HH:mm:ss").
+ // Axios' default serializer turns a Date into a UTC ISO string, which the
+ // backend then shifts by the server timezone — causing the picked local day
+ // to mismatch the server-local dates shown in the table. Sending a plain
+ // local datetime makes the backend compare it as-is against stored dates.
+ // from_date snaps to the start of the day (00:00:00), to_date to the end
+ // (23:59:59), so the full picked day range is covered.
+ const normalizeDate = (value: string | Date | undefined, isEnd = false) => {
+ if (!(value instanceof Date)) return value;
+ const day = dayjs(value);
+ return (isEnd ? day.endOf('day') : day.startOf('day')).format(
+ 'YYYY-MM-DD HH:mm:ss',
+ );
+ };
+
+ const normalizedParams: IAgentLogsRequest = {
+ ...params,
+ from_date: normalizeDate(params.from_date),
+ to_date: normalizeDate(params.to_date, true),
+ };
+
+ return request.get(methods.fetchAgentLogs.url(canvasId), {
+ params: normalizedParams,
+ });
};
export const fetchAgentLogsById = (canvasId: string, sessionId: string) => {