diff --git a/web/app/components/base/chat/chat-with-history/memory/card.tsx b/web/app/components/base/chat/chat-with-history/memory/card.tsx new file mode 100644 index 0000000000..cda0902c2e --- /dev/null +++ b/web/app/components/base/chat/chat-with-history/memory/card.tsx @@ -0,0 +1,42 @@ +import React from 'react' +import { useTranslation } from 'react-i18next' +import { Memory } from '@/app/components/base/icons/src/vender/line/others' +import Badge from '@/app/components/base/badge' +import Indicator from '@/app/components/header/indicator' +import type { MemoryItem } from './type' +import cn from '@/utils/classnames' + +type Props = { + memory: MemoryItem +} + +const MemoryCard: React.FC = ({ memory }) => { + const { t } = useTranslation() + + return ( +
+
+
+ +
{memory.name}
+ +
+
+
{memory.content}
+ {memory.status === 'latest' && ( +
+
{t('share.chat.memory.latestVersion')}
+ +
+ )} + {memory.status === 'needUpdate' && ( +
+
{t('share.chat.memory.notLatestVersion', { num: memory.mergeCount })}
+ +
+ )} +
+ ) +} + +export default MemoryCard diff --git a/web/app/components/base/chat/chat-with-history/memory/index.tsx b/web/app/components/base/chat/chat-with-history/memory/index.tsx index c3cc99bd4a..5fe4deba7c 100644 --- a/web/app/components/base/chat/chat-with-history/memory/index.tsx +++ b/web/app/components/base/chat/chat-with-history/memory/index.tsx @@ -9,8 +9,11 @@ import Button from '@/app/components/base/button' import { useChatWithHistoryContext, } from '../context' +import MemoryCard from './card' import cn from '@/utils/classnames' +import { mockMemoryList } from './mock' + type Props = { showChatMemory?: boolean } @@ -32,8 +35,10 @@ const MemoryPanel: React.FC = ({ showChatMemory }) => { - {/* Memory content goes here */}
+ {mockMemoryList.map(memory => ( + + ))}