瀏覽代碼

fix: Error on chat api,<BadRequestKeyError '400: Bad Request'> #1918 (#1923)

### What problem does this PR solve?

fix: Error on chat api,<BadRequestKeyError '400: Bad Request'> #1918

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.10.0
balibabu 1 年之前
父節點
當前提交
b75115264d
沒有連結到貢獻者的電子郵件帳戶。
共有 2 個檔案被更改,包括 5 行新增3 行删除
  1. 4
    2
      web/src/components/api-service/hooks.ts
  2. 1
    1
      web/src/hooks/chat-hooks.ts

+ 4
- 2
web/src/components/api-service/hooks.ts 查看文件

@@ -1,6 +1,5 @@
import {
useCreateNextToken,
useFetchNextStats,
useFetchTokenList,
useRemoveNextToken,
} from '@/hooks/chat-hooks';
@@ -10,6 +9,7 @@ import {
useTranslate,
} from '@/hooks/common-hooks';
import { IStats } from '@/interfaces/database/chat';
import { useQueryClient } from '@tanstack/react-query';
import { message } from 'antd';
import { useCallback } from 'react';

@@ -46,7 +46,9 @@ type ChartStatsType = {
};

export const useSelectChartStatsList = (): ChartStatsType => {
const { data: stats } = useFetchNextStats();
const queryClient = useQueryClient();
const data = queryClient.getQueriesData({ queryKey: ['fetchStats'] });
const stats: IStats = data[0][1] as IStats;

return Object.keys(stats).reduce((pre, cur) => {
const item = stats[cur as keyof IStats];

+ 1
- 1
web/src/hooks/chat-hooks.ts 查看文件

@@ -260,8 +260,8 @@ const getDay = (date?: Dayjs) => date?.format('YYYY-MM-DD');

export const useFetchNextStats = () => {
const [pickerValue, setPickerValue] = useState<RangeValue>([
dayjs(),
dayjs().subtract(7, 'day'),
dayjs(),
]);
const { data, isFetching: loading } = useQuery<IStats>({
queryKey: ['fetchStats', pickerValue],

Loading…
取消
儲存