diff --git a/web/app/components/base/chat/chat-with-history/header/index.tsx b/web/app/components/base/chat/chat-with-history/header/index.tsx index 7098b17a1f..6718dd7100 100644 --- a/web/app/components/base/chat/chat-with-history/header/index.tsx +++ b/web/app/components/base/chat/chat-with-history/header/index.tsx @@ -146,7 +146,7 @@ const Header = () => { )} {currentConversationId && ( diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsx index 22668fcc2e..cdd046b9ec 100644 --- a/web/app/components/base/chat/chat-with-history/hooks.tsx +++ b/web/app/components/base/chat/chat-with-history/hooks.tsx @@ -478,7 +478,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => { notify({ type: 'success', message: t('common.api.success') }) }, [isInstalledApp, appId, t, notify]) - const [showChatMemory, setShowChatMemory] = useState(false) + const [showChatMemory, setShowChatMemory] = useState(true) return { isInstalledApp, diff --git a/web/app/components/base/chat/chat-with-history/index.tsx b/web/app/components/base/chat/chat-with-history/index.tsx index c96cde8d60..295a5f2d0e 100644 --- a/web/app/components/base/chat/chat-with-history/index.tsx +++ b/web/app/components/base/chat/chat-with-history/index.tsx @@ -15,13 +15,14 @@ import Sidebar from './sidebar' import Header from './header' import HeaderInMobile from './header-in-mobile' import ChatWrapper from './chat-wrapper' +import MemoryPanel from './memory' import type { InstalledApp } from '@/models/explore' import Loading from '@/app/components/base/loading' import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' import { checkOrSetAccessToken } from '@/app/components/share/utils' import AppUnavailable from '@/app/components/base/app-unavailable' -import cn from '@/utils/classnames' import useDocumentTitle from '@/hooks/use-document-title' +import cn from '@/utils/classnames' type ChatWithHistoryProps = { className?: string @@ -36,6 +37,7 @@ const ChatWithHistory: FC = ({ isMobile, themeBuilder, sidebarCollapseState, + showChatMemory, } = useChatWithHistoryContext() const isSidebarCollapsed = sidebarCollapseState const customConfig = appData?.custom_config @@ -66,7 +68,7 @@ const ChatWithHistory: FC = ({ {isMobile && ( )} -
+
{isSidebarCollapsed && (
= ({
)} -
+
{!isMobile &&
} {appChatListDataLoading && ( @@ -88,6 +94,7 @@ const ChatWithHistory: FC = ({ )}
+
) 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 new file mode 100644 index 0000000000..20573a7f42 --- /dev/null +++ b/web/app/components/base/chat/chat-with-history/memory/index.tsx @@ -0,0 +1,39 @@ +import React from 'react' +import { useTranslation } from 'react-i18next' +import { + RiCloseLine, +} from '@remixicon/react' +import ActionButton from '@/app/components/base/action-button' +import { + useChatWithHistoryContext, +} from '../context' +import cn from '@/utils/classnames' + +type Props = { + showChatMemory?: boolean +} + +const MemoryPanel: React.FC = ({ showChatMemory }) => { + const { t } = useTranslation() + const { + setShowChatMemory, + } = useChatWithHistoryContext() + + return ( +
+
+
{t('share.chat.memory.title')}
+ setShowChatMemory(false)}> + + +
+
+ {/* Memory content goes here */} +
+ ) +} + +export default MemoryPanel diff --git a/web/i18n/en-US/share.ts b/web/i18n/en-US/share.ts index 0470a76712..7b8a5df56d 100644 --- a/web/i18n/en-US/share.ts +++ b/web/i18n/en-US/share.ts @@ -36,7 +36,28 @@ const translation = { temporarySystemIssue: 'Sorry, temporary system issue.', expand: 'Expand', collapse: 'Collapse', - memory: 'Chat Memory', + memory: { + actionButton: 'Chat Memory', + title: 'Memory', + latestVersion: 'Memory updated', + notLatestVersion: '{{num}} messages wait to be merged', + clearAll: 'Clear All Memory', + editTitle: 'Edit Memory', + updateVersion: { + previews: 'Previous Version', + next: 'Next Version', + title: 'Update Version', + update: 'Update', + edited: 'Edited', + }, + operations: { + edit: 'Edit', + reset: 'Reset to default', + clear: 'Clear all update version', + cancel: 'Cancel', + save: 'Save & Apply', + }, + }, }, generation: { tabs: { diff --git a/web/i18n/zh-Hans/share.ts b/web/i18n/zh-Hans/share.ts index b59adb7e31..3720a07f37 100644 --- a/web/i18n/zh-Hans/share.ts +++ b/web/i18n/zh-Hans/share.ts @@ -32,7 +32,28 @@ const translation = { temporarySystemIssue: '抱歉,临时系统问题。', expand: '展开', collapse: '折叠', - memory: '聊天记忆', + memory: { + actionButton: '聊天记忆', + title: '记忆', + latestVersion: '记忆已更新', + notLatestVersion: '{{num}} 条消息等待合并', + clearAll: '清除所有记忆', + editTitle: '编辑记忆', + updateVersion: { + previews: '上一个版本', + next: '下一个版本', + title: '更新版本', + update: '更新', + edited: '已编辑', + }, + operations: { + edit: '编辑', + reset: '重置为默认', + clear: '清除所有更新版本', + cancel: '取消', + save: '保存并应用', + }, + }, }, generation: { tabs: {