mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08: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:
@ -23,8 +23,13 @@ export const useShowFormDrawer = () => {
|
|||||||
|
|
||||||
const handleShow = useCallback(
|
const handleShow = useCallback(
|
||||||
(e: React.MouseEvent<Element>, nodeId: string) => {
|
(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);
|
setClickedNodeId(nodeId);
|
||||||
setClickedToolId(get(e.target, 'dataset.tool'));
|
setClickedToolId(tool);
|
||||||
showFormDrawer();
|
showFormDrawer();
|
||||||
},
|
},
|
||||||
[setClickedNodeId, setClickedToolId, showFormDrawer],
|
[setClickedNodeId, setClickedToolId, showFormDrawer],
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { useSetModalState } from '@/hooks/common-hooks';
|
import { useSetModalState } from '@/hooks/common-hooks';
|
||||||
import { useSetDialog } from '@/hooks/use-chat-request';
|
import { useSetDialog } from '@/hooks/use-chat-request';
|
||||||
import { IDialog } from '@/interfaces/database/chat';
|
import { IDialog } from '@/interfaces/database/chat';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty, omit } from 'lodash';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
@ -44,7 +44,9 @@ export const useRenameChat = () => {
|
|||||||
const onChatRenameOk = useCallback(
|
const onChatRenameOk = useCallback(
|
||||||
async (name: string) => {
|
async (name: string) => {
|
||||||
const nextChat = {
|
const nextChat = {
|
||||||
...(isEmpty(chat) ? InitialData : chat),
|
...(isEmpty(chat)
|
||||||
|
? InitialData
|
||||||
|
: { ...omit(chat, 'nickname', 'tenant_avatar'), dialog_id: chat.id }),
|
||||||
name,
|
name,
|
||||||
};
|
};
|
||||||
const ret = await setDialog(nextChat);
|
const ret = await setDialog(nextChat);
|
||||||
|
|||||||
Reference in New Issue
Block a user