mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-08 01:08:43 +08:00
Fix some bug (#5048)
* fix: chat log time range * fix: repeat system prompt * perf: nanoid random * fix: get files from histories * fix: ts * ts config * perf: search dataset collection
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import {
|
||||
Flex,
|
||||
Box,
|
||||
@@ -46,8 +46,8 @@ const Logs = () => {
|
||||
const appId = useContextSelector(AppContext, (v) => v.appId);
|
||||
|
||||
const [dateRange, setDateRange] = useState<DateRangeType>({
|
||||
from: addDays(new Date(), -7),
|
||||
to: new Date()
|
||||
from: new Date(addDays(new Date(), -6).setHours(0, 0, 0, 0)),
|
||||
to: new Date(new Date().setHours(23, 59, 59, 999))
|
||||
});
|
||||
|
||||
const [detailLogsId, setDetailLogsId] = useState<string>();
|
||||
@@ -69,6 +69,16 @@ const Logs = () => {
|
||||
[t]
|
||||
);
|
||||
|
||||
const params = useMemo(
|
||||
() => ({
|
||||
appId,
|
||||
dateStart: dateRange.from!,
|
||||
dateEnd: dateRange.to!,
|
||||
sources: isSelectAllSource ? undefined : chatSources,
|
||||
logTitle
|
||||
}),
|
||||
[appId, chatSources, dateRange.from, dateRange.to, isSelectAllSource, logTitle]
|
||||
);
|
||||
const {
|
||||
data: logs,
|
||||
isLoading,
|
||||
@@ -78,14 +88,8 @@ const Logs = () => {
|
||||
total
|
||||
} = usePagination(getAppChatLogs, {
|
||||
pageSize: 20,
|
||||
params: {
|
||||
appId,
|
||||
dateStart: dateRange.from || new Date(),
|
||||
dateEnd: addDays(dateRange.to || new Date(), 1),
|
||||
sources: isSelectAllSource ? undefined : chatSources,
|
||||
logTitle
|
||||
},
|
||||
refreshDeps: [chatSources, logTitle]
|
||||
params,
|
||||
refreshDeps: [params]
|
||||
});
|
||||
|
||||
const { runAsync: exportLogs } = useRequest2(
|
||||
@@ -116,7 +120,7 @@ const Logs = () => {
|
||||
refreshDeps: [chatSources, logTitle]
|
||||
}
|
||||
);
|
||||
|
||||
console.log(dateRange, 111);
|
||||
return (
|
||||
<Flex
|
||||
flexDirection={'column'}
|
||||
@@ -153,8 +157,9 @@ const Logs = () => {
|
||||
<DateRangePicker
|
||||
defaultDate={dateRange}
|
||||
position="bottom"
|
||||
onChange={setDateRange}
|
||||
onSuccess={() => getData(1)}
|
||||
onSuccess={(date) => {
|
||||
setDateRange(date);
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} gap={2}>
|
||||
|
||||
Reference in New Issue
Block a user