Skip to content

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

fix(web): agent log refetch and slider percentage rounding (#16344)

chanxd44359826dc6
diff --git a/web/src/components/copy-to-clipboard.tsx b/web/src/components/copy-to-clipboard.tsx
index deb97ee14d..62c7363885 100644
--- a/web/src/components/copy-to-clipboard.tsx
+++ b/web/src/components/copy-to-clipboard.tsx
@@ -25,7 +25,6 @@ const CopyToClipboard = ({
const icon = copied ? <LucideCheck /> : <LucideCopy />;
const trigger = avoidButtonWrapper ? (
<Button
- asChild
variant="transparent"
size="icon-sm"
{...buttonProps}
diff --git a/web/src/components/slider-input-form-field.tsx b/web/src/components/slider-input-form-field.tsx
index c7834a1544..11b4fc5594 100644
--- a/web/src/components/slider-input-form-field.tsx
+++ b/web/src/components/slider-input-form-field.tsx
@@ -92,9 +92,11 @@ export const SliderInputFormField = forwardRef<
<FormControl>
<SingleFormSlider
{...field}
- value={percentage ? field.value * 100 : field.value}
+ value={
+ percentage ? Math.round(field.value * 100) : field.value
+ }
onChange={(value) =>
- field.onChange(percentage ? value / 100 : value)
+ field.onChange(percentage ? Math.round(value) / 100 : value)
}
max={displayMax}
min={displayMin}
@@ -114,13 +116,13 @@ export const SliderInputFormField = forwardRef<
step={displayStep}
hideIcons
value={
- percentage ? (field.value * 100).toFixed(0) : field.value
+ percentage ? Math.round(field.value * 100) : field.value
}
onChange={(val) => {
const value = Number(val || 0);
- if (!isNaN(value)) {
+ if (value >= 0) {
field.onChange(
- percentage ? (value / 100).toFixed(0) : value,
+ percentage ? Math.round(value) / 100 : value,
);
}
}}
diff --git a/web/src/hooks/use-agent-request.ts b/web/src/hooks/use-agent-request.ts
index c219302841..715613f17e 100644
--- a/web/src/hooks/use-agent-request.ts
+++ b/web/src/hooks/use-agent-request.ts
@@ -685,7 +685,11 @@ export const useFetchVersion = (
export const useFetchAgentLog = (searchParams: IAgentLogsRequest) => {
const { id } = useParams();
- const { data, isFetching: loading } = useQuery<IAgentLogsResponse>({
+ const {
+ data,
+ isFetching: loading,
+ refetch,
+ } = useQuery<IAgentLogsResponse>({
queryKey: [AgentApiAction.FetchAgentLog, id, searchParams],
initialData: {} as IAgentLogsResponse,
gcTime: 0,
@@ -698,7 +702,7 @@ export const useFetchAgentLog = (searchParams: IAgentLogsRequest) => {
},
});
- return { data, loading };
+ return { data, loading, refetch };
};
export const useFetchSessionsByCanvasId = () => {
diff --git a/web/src/pages/agents/agent-log-page.tsx b/web/src/pages/agents/agent-log-page.tsx
index 74754202c2..a4dfd21bc5 100644
--- a/web/src/pages/agents/agent-log-page.tsx
+++ b/web/src/pages/agents/agent-log-page.tsx
@@ -126,7 +126,7 @@ const AgentLogPage: React.FC = () => {
},
];
- const { data: logData, loading } = useFetchAgentLog(searchParams);
+ const { data: logData, loading, refetch } = useFetchAgentLog(searchParams);
const { sessions: data, total } = logData || {};
const { handleExport, loading: exportLoading } = useExportAgentLogToCSV();
const [currentDate, setCurrentDate] = useState<DateRange>({
@@ -191,8 +191,18 @@ const AgentLogPage: React.FC = () => {
};
const handleClickSearch = () => {
- setPagination((pre) => ({ ...pre, current: 1 }));
- handleSearch({ page: 1, keywords });
+ const sameParams =
+ pagination.current === 1 &&
+ searchParams.keywords === keywords &&
+ searchParams.from_date === currentDate.from &&
+ searchParams.to_date === currentDate.to;
+
+ if (sameParams) {
+ refetch();
+ } else {
+ setPagination((pre) => ({ ...pre, current: 1 }));
+ handleSearch({ page: 1, keywords });
+ }
};
useEffect(() => {
handleSearch();