RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
feat: Hide the delete button on the agent page #2088 (#2167)
balibabu667632ba0092
diff --git a/web/src/components/message-item/group-button.tsx b/web/src/components/message-item/group-button.tsxindex cea7cfaa21..f99136c5bb 100644--- a/web/src/components/message-item/group-button.tsx+++ b/web/src/components/message-item/group-button.tsx@@ -20,12 +20,14 @@ interface IProps {messageId: string;content: string;prompt?: string;+ showLikeButton: boolean;}export const AssistantGroupButton = ({messageId,content,prompt,+ showLikeButton,}: IProps) => {const { visible, hideModal, showModal, onFeedbackOk, loading } =useSendFeedback(messageId);@@ -51,12 +53,16 @@ export const AssistantGroupButton = ({<SoundOutlined /></Tooltip></Radio.Button>- <Radio.Button value="c" onClick={handleLike}>- <LikeOutlined />- </Radio.Button>- <Radio.Button value="d" onClick={showModal}>- <DislikeOutlined />- </Radio.Button>+ {showLikeButton && (+ <>+ <Radio.Button value="c" onClick={handleLike}>+ <LikeOutlined />+ </Radio.Button>+ <Radio.Button value="d" onClick={showModal}>+ <DislikeOutlined />+ </Radio.Button>+ </>+ )}{prompt && (<Radio.Button value="e" onClick={showPromptModal}><SvgIcon name={`prompt`} width={16}></SvgIcon>@@ -82,7 +88,7 @@ export const AssistantGroupButton = ({);};-interface UserGroupButtonProps extends IRemoveMessageById {+interface UserGroupButtonProps extends Partial<IRemoveMessageById> {messageId: string;content: string;regenerateMessage(): void;@@ -116,11 +122,13 @@ export const UserGroupButton = ({<SyncOutlined spin={sendLoading} /></Tooltip></Radio.Button>- <Radio.Button value="c" onClick={onRemoveMessage} disabled={loading}>- <Tooltip title={t('common.delete')}>- <DeleteOutlined spin={loading} />- </Tooltip>- </Radio.Button>+ {removeMessageById && (+ <Radio.Button value="c" onClick={onRemoveMessage} disabled={loading}>+ <Tooltip title={t('common.delete')}>+ <DeleteOutlined spin={loading} />+ </Tooltip>+ </Radio.Button>+ )}</Radio.Group>);};diff --git a/web/src/components/message-item/hooks.ts b/web/src/components/message-item/hooks.tsindex 7009225701..9e9a70f5cb 100644--- a/web/src/components/message-item/hooks.ts+++ b/web/src/components/message-item/hooks.ts@@ -34,7 +34,7 @@ export const useSendFeedback = (messageId: string) => {export const useRemoveMessage = (messageId: string,- removeMessageById: IRemoveMessageById['removeMessageById'],+ removeMessageById?: IRemoveMessageById['removeMessageById'],) => {const { deleteMessage, loading } = useDeleteMessage();@@ -43,7 +43,7 @@ export const useRemoveMessage = (if (pureId) {const retcode = await deleteMessage(pureId);if (retcode === 0) {- removeMessageById(messageId);+ removeMessageById?.(messageId);}}}, [deleteMessage, messageId, removeMessageById]);diff --git a/web/src/components/message-item/index.tsx b/web/src/components/message-item/index.tsxindex 510dd84b28..b66b7874cb 100644--- a/web/src/components/message-item/index.tsx+++ b/web/src/components/message-item/index.tsx@@ -24,7 +24,7 @@ import styles from './index.less';const { Text } = Typography;-interface IProps extends IRemoveMessageById, IRegenerateMessage {+interface IProps extends Partial<IRemoveMessageById>, IRegenerateMessage {item: IMessage;reference: IReference;loading?: boolean;@@ -33,6 +33,7 @@ interface IProps extends IRemoveMessageById, IRegenerateMessage {avatar?: string;clickDocumentButton?: (documentId: string, chunk: IChunk) => void;index: number;+ showLikeButton?: boolean;}const MessageItem = ({@@ -45,6 +46,7 @@ const MessageItem = ({index,removeMessageById,regenerateMessage,+ showLikeButton = true,}: IProps) => {const isAssistant = item.role === MessageType.Assistant;const isUser = item.role === MessageType.User;@@ -128,6 +130,7 @@ const MessageItem = ({messageId={item.id}content={item.content}prompt={item.prompt}+ showLikeButton={showLikeButton}></AssistantGroupButton>)) : (diff --git a/web/src/pages/flow/chat/box.tsx b/web/src/pages/flow/chat/box.tsxindex a88e3774a2..5a0372f856 100644--- a/web/src/pages/flow/chat/box.tsx+++ b/web/src/pages/flow/chat/box.tsx@@ -58,6 +58,8 @@ const FlowChatBox = () => {)}clickDocumentButton={clickDocumentButton}index={i}+ regenerateMessage={() => {}}+ showLikeButton={false}></MessageItem>);})}