mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-18 03:45:53 +08:00
### What problem does this PR solve? feat: Hide the delete button on the agent page #2088 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
a82f092dac
commit
667632ba00
@ -20,12 +20,14 @@ interface IProps {
|
|||||||
messageId: string;
|
messageId: string;
|
||||||
content: string;
|
content: string;
|
||||||
prompt?: string;
|
prompt?: string;
|
||||||
|
showLikeButton: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AssistantGroupButton = ({
|
export const AssistantGroupButton = ({
|
||||||
messageId,
|
messageId,
|
||||||
content,
|
content,
|
||||||
prompt,
|
prompt,
|
||||||
|
showLikeButton,
|
||||||
}: IProps) => {
|
}: IProps) => {
|
||||||
const { visible, hideModal, showModal, onFeedbackOk, loading } =
|
const { visible, hideModal, showModal, onFeedbackOk, loading } =
|
||||||
useSendFeedback(messageId);
|
useSendFeedback(messageId);
|
||||||
@ -51,12 +53,16 @@ export const AssistantGroupButton = ({
|
|||||||
<SoundOutlined />
|
<SoundOutlined />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Radio.Button>
|
</Radio.Button>
|
||||||
<Radio.Button value="c" onClick={handleLike}>
|
{showLikeButton && (
|
||||||
<LikeOutlined />
|
<>
|
||||||
</Radio.Button>
|
<Radio.Button value="c" onClick={handleLike}>
|
||||||
<Radio.Button value="d" onClick={showModal}>
|
<LikeOutlined />
|
||||||
<DislikeOutlined />
|
</Radio.Button>
|
||||||
</Radio.Button>
|
<Radio.Button value="d" onClick={showModal}>
|
||||||
|
<DislikeOutlined />
|
||||||
|
</Radio.Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{prompt && (
|
{prompt && (
|
||||||
<Radio.Button value="e" onClick={showPromptModal}>
|
<Radio.Button value="e" onClick={showPromptModal}>
|
||||||
<SvgIcon name={`prompt`} width={16}></SvgIcon>
|
<SvgIcon name={`prompt`} width={16}></SvgIcon>
|
||||||
@ -82,7 +88,7 @@ export const AssistantGroupButton = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface UserGroupButtonProps extends IRemoveMessageById {
|
interface UserGroupButtonProps extends Partial<IRemoveMessageById> {
|
||||||
messageId: string;
|
messageId: string;
|
||||||
content: string;
|
content: string;
|
||||||
regenerateMessage(): void;
|
regenerateMessage(): void;
|
||||||
@ -116,11 +122,13 @@ export const UserGroupButton = ({
|
|||||||
<SyncOutlined spin={sendLoading} />
|
<SyncOutlined spin={sendLoading} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Radio.Button>
|
</Radio.Button>
|
||||||
<Radio.Button value="c" onClick={onRemoveMessage} disabled={loading}>
|
{removeMessageById && (
|
||||||
<Tooltip title={t('common.delete')}>
|
<Radio.Button value="c" onClick={onRemoveMessage} disabled={loading}>
|
||||||
<DeleteOutlined spin={loading} />
|
<Tooltip title={t('common.delete')}>
|
||||||
</Tooltip>
|
<DeleteOutlined spin={loading} />
|
||||||
</Radio.Button>
|
</Tooltip>
|
||||||
|
</Radio.Button>
|
||||||
|
)}
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,7 @@ export const useSendFeedback = (messageId: string) => {
|
|||||||
|
|
||||||
export const useRemoveMessage = (
|
export const useRemoveMessage = (
|
||||||
messageId: string,
|
messageId: string,
|
||||||
removeMessageById: IRemoveMessageById['removeMessageById'],
|
removeMessageById?: IRemoveMessageById['removeMessageById'],
|
||||||
) => {
|
) => {
|
||||||
const { deleteMessage, loading } = useDeleteMessage();
|
const { deleteMessage, loading } = useDeleteMessage();
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ export const useRemoveMessage = (
|
|||||||
if (pureId) {
|
if (pureId) {
|
||||||
const retcode = await deleteMessage(pureId);
|
const retcode = await deleteMessage(pureId);
|
||||||
if (retcode === 0) {
|
if (retcode === 0) {
|
||||||
removeMessageById(messageId);
|
removeMessageById?.(messageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [deleteMessage, messageId, removeMessageById]);
|
}, [deleteMessage, messageId, removeMessageById]);
|
||||||
|
@ -24,7 +24,7 @@ import styles from './index.less';
|
|||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
interface IProps extends IRemoveMessageById, IRegenerateMessage {
|
interface IProps extends Partial<IRemoveMessageById>, IRegenerateMessage {
|
||||||
item: IMessage;
|
item: IMessage;
|
||||||
reference: IReference;
|
reference: IReference;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
@ -33,6 +33,7 @@ interface IProps extends IRemoveMessageById, IRegenerateMessage {
|
|||||||
avatar?: string;
|
avatar?: string;
|
||||||
clickDocumentButton?: (documentId: string, chunk: IChunk) => void;
|
clickDocumentButton?: (documentId: string, chunk: IChunk) => void;
|
||||||
index: number;
|
index: number;
|
||||||
|
showLikeButton?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MessageItem = ({
|
const MessageItem = ({
|
||||||
@ -45,6 +46,7 @@ const MessageItem = ({
|
|||||||
index,
|
index,
|
||||||
removeMessageById,
|
removeMessageById,
|
||||||
regenerateMessage,
|
regenerateMessage,
|
||||||
|
showLikeButton = true,
|
||||||
}: IProps) => {
|
}: IProps) => {
|
||||||
const isAssistant = item.role === MessageType.Assistant;
|
const isAssistant = item.role === MessageType.Assistant;
|
||||||
const isUser = item.role === MessageType.User;
|
const isUser = item.role === MessageType.User;
|
||||||
@ -128,6 +130,7 @@ const MessageItem = ({
|
|||||||
messageId={item.id}
|
messageId={item.id}
|
||||||
content={item.content}
|
content={item.content}
|
||||||
prompt={item.prompt}
|
prompt={item.prompt}
|
||||||
|
showLikeButton={showLikeButton}
|
||||||
></AssistantGroupButton>
|
></AssistantGroupButton>
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
|
@ -58,6 +58,8 @@ const FlowChatBox = () => {
|
|||||||
)}
|
)}
|
||||||
clickDocumentButton={clickDocumentButton}
|
clickDocumentButton={clickDocumentButton}
|
||||||
index={i}
|
index={i}
|
||||||
|
regenerateMessage={() => {}}
|
||||||
|
showLikeButton={false}
|
||||||
></MessageItem>
|
></MessageItem>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user