浏览代码

feat: Catch errors in getting mindmap #2247 (#2368)

### What problem does this PR solve?

feat: Catch errors in getting mindmap #2247

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
tags/v0.11.0
balibabu 1年前
父节点
当前提交
8e3228d461
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 11 次插入4 次删除
  1. 11
    4
      web/src/hooks/chat-hooks.ts

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

@@ -16,7 +16,7 @@ import { buildMessageListWithUuid, isConversationIdExist } from '@/utils/chat';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { message } from 'antd';
import dayjs, { Dayjs } from 'dayjs';
import { set } from 'lodash';
import { has, set } from 'lodash';
import { useCallback, useMemo, useState } from 'react';
import { useSearchParams } from 'umi';

@@ -492,9 +492,16 @@ export const useFetchMindMap = () => {
mutationKey: ['fetchMindMap'],
gcTime: 0,
mutationFn: async (params: IAskRequestBody) => {
const { data } = await chatService.getMindMap(params);

return data?.data ?? [];
try {
const ret = await chatService.getMindMap(params);
return ret?.data?.data ?? [];
} catch (error) {
if (has(error, 'message')) {
message.error(error.message);
}

return [];
}
},
});


正在加载...
取消
保存