mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-02 09:57:50 +00:00
### What problem does this PR solve? Fix: Fixed an issue where renaming a chat would create a new chat #3221 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
33f3e05b75
commit
e15e39f183
@ -23,8 +23,13 @@ export const useShowFormDrawer = () => {
|
||||
|
||||
const handleShow = useCallback(
|
||||
(e: React.MouseEvent<Element>, nodeId: string) => {
|
||||
const tool = get(e.target, 'dataset.tool');
|
||||
// TODO: Operator type judgment should be used
|
||||
if (nodeId.startsWith(Operator.Tool) && !tool) {
|
||||
return;
|
||||
}
|
||||
setClickedNodeId(nodeId);
|
||||
setClickedToolId(get(e.target, 'dataset.tool'));
|
||||
setClickedToolId(tool);
|
||||
showFormDrawer();
|
||||
},
|
||||
[setClickedNodeId, setClickedToolId, showFormDrawer],
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useSetModalState } from '@/hooks/common-hooks';
|
||||
import { useSetDialog } from '@/hooks/use-chat-request';
|
||||
import { IDialog } from '@/interfaces/database/chat';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { isEmpty, omit } from 'lodash';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@ -44,7 +44,9 @@ export const useRenameChat = () => {
|
||||
const onChatRenameOk = useCallback(
|
||||
async (name: string) => {
|
||||
const nextChat = {
|
||||
...(isEmpty(chat) ? InitialData : chat),
|
||||
...(isEmpty(chat)
|
||||
? InitialData
|
||||
: { ...omit(chat, 'nickname', 'tenant_avatar'), dialog_id: chat.id }),
|
||||
name,
|
||||
};
|
||||
const ret = await setDialog(nextChat);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user