🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat: improve memory tool display and refactor tool render (#11525)
Arvin Xu488175a14374
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.jsonindex cb28d42047d..37ef5f00a54 100644--- a/locales/en-US/plugin.json+++ b/locales/en-US/plugin.json@@ -173,6 +173,10 @@"builtins.lobe-user-memory.apiName.removeIdentityMemory": "Delete identity memory","builtins.lobe-user-memory.apiName.searchUserMemory": "Search memory","builtins.lobe-user-memory.apiName.updateIdentityMemory": "Update identity memory",+ "builtins.lobe-user-memory.inspector.noResults": "No results",+ "builtins.lobe-user-memory.render.contexts": "Contexts",+ "builtins.lobe-user-memory.render.experiences": "Experiences",+ "builtins.lobe-user-memory.render.preferences": "Preferences","builtins.lobe-user-memory.title": "Memory","builtins.lobe-web-browsing.apiName.crawlMultiPages": "Read multiple pages","builtins.lobe-web-browsing.apiName.crawlSinglePage": "Read page content",diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.jsonindex ed56a6937b0..32fa41cffa3 100644--- a/locales/zh-CN/plugin.json+++ b/locales/zh-CN/plugin.json@@ -173,6 +173,10 @@"builtins.lobe-user-memory.apiName.removeIdentityMemory": "删除身份记忆","builtins.lobe-user-memory.apiName.searchUserMemory": "搜索记忆","builtins.lobe-user-memory.apiName.updateIdentityMemory": "更新身份记忆",+ "builtins.lobe-user-memory.inspector.noResults": "无结果",+ "builtins.lobe-user-memory.render.contexts": "情境记忆",+ "builtins.lobe-user-memory.render.experiences": "经验记忆",+ "builtins.lobe-user-memory.render.preferences": "偏好记忆","builtins.lobe-user-memory.title": "记忆","builtins.lobe-web-browsing.apiName.crawlMultiPages": "读取多个页面内容","builtins.lobe-web-browsing.apiName.crawlSinglePage": "读取页面内容",diff --git a/packages/builtin-tool-memory/package.json b/packages/builtin-tool-memory/package.jsonindex 0bfe9089e1f..dbb0149a312 100644--- a/packages/builtin-tool-memory/package.json+++ b/packages/builtin-tool-memory/package.json@@ -4,6 +4,7 @@"private": true,"exports": {".": "./src/index.ts",+ "./client": "./src/client/index.ts","./executor": "./src/executor/index.ts"},"main": "./src/index.ts",@@ -13,5 +14,12 @@},"devDependencies": {"@lobechat/types": "workspace:*"+ },+ "peerDependencies": {+ "@lobehub/ui": "^4",+ "antd-style": "*",+ "lucide-react": "*",+ "react": "*",+ "react-i18next": "*"}}diff --git a/packages/builtin-tool-memory/src/client/Inspector/AddContextMemory/index.tsx b/packages/builtin-tool-memory/src/client/Inspector/AddContextMemory/index.tsxnew file mode 100644index 00000000000..4541b691c3c--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Inspector/AddContextMemory/index.tsx@@ -0,0 +1,60 @@+'use client';++import type { BuiltinInspectorProps } from '@lobechat/types';+import { createStaticStyles, cssVar, cx } from 'antd-style';+import { Check } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';++import type { AddContextMemoryParams, AddContextMemoryState } from '../../../types';++const styles = createStaticStyles(({ css }) => ({+ statusIcon: css`+ margin-block-end: -2px;+ margin-inline-start: 4px;+ `,+}));++export const AddContextMemoryInspector = memo<+ BuiltinInspectorProps<AddContextMemoryParams, AddContextMemoryState>+>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {+ const { t } = useTranslation('plugin');++ const title = args?.title || partialArgs?.title;++ // Initial streaming state+ if (isArgumentsStreaming && !title) {+ return (+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>+ <span>{t('builtins.lobe-user-memory.apiName.addContextMemory')}</span>+ </div>+ );+ }++ const isSuccess = pluginState?.memoryId;++ return (+ <div+ className={cx(+ inspectorTextStyles.root,+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,+ )}+ >+ <span>{t('builtins.lobe-user-memory.apiName.addContextMemory')}</span>+ {title && (+ <>+ : <span className={highlightTextStyles.primary}>{title}</span>+ </>+ )}+ {!isLoading && isSuccess && (+ <Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />+ )}+ </div>+ );+});++AddContextMemoryInspector.displayName = 'AddContextMemoryInspector';++export default AddContextMemoryInspector;diff --git a/packages/builtin-tool-memory/src/client/Inspector/AddExperienceMemory/index.tsx b/packages/builtin-tool-memory/src/client/Inspector/AddExperienceMemory/index.tsxnew file mode 100644index 00000000000..300c07fbefe--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Inspector/AddExperienceMemory/index.tsx@@ -0,0 +1,60 @@+'use client';++import type { BuiltinInspectorProps } from '@lobechat/types';+import { createStaticStyles, cssVar, cx } from 'antd-style';+import { Check } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';++import type { AddExperienceMemoryParams, AddExperienceMemoryState } from '../../../types';++const styles = createStaticStyles(({ css }) => ({+ statusIcon: css`+ margin-block-end: -2px;+ margin-inline-start: 4px;+ `,+}));++export const AddExperienceMemoryInspector = memo<+ BuiltinInspectorProps<AddExperienceMemoryParams, AddExperienceMemoryState>+>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {+ const { t } = useTranslation('plugin');++ const title = args?.title || partialArgs?.title;++ // Initial streaming state+ if (isArgumentsStreaming && !title) {+ return (+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>+ <span>{t('builtins.lobe-user-memory.apiName.addExperienceMemory')}</span>+ </div>+ );+ }++ const isSuccess = pluginState?.memoryId;++ return (+ <div+ className={cx(+ inspectorTextStyles.root,+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,+ )}+ >+ <span>{t('builtins.lobe-user-memory.apiName.addExperienceMemory')}</span>+ {title && (+ <>+ : <span className={highlightTextStyles.primary}>{title}</span>+ </>+ )}+ {!isLoading && isSuccess && (+ <Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />+ )}+ </div>+ );+});++AddExperienceMemoryInspector.displayName = 'AddExperienceMemoryInspector';++export default AddExperienceMemoryInspector;diff --git a/packages/builtin-tool-memory/src/client/Inspector/AddIdentityMemory/index.tsx b/packages/builtin-tool-memory/src/client/Inspector/AddIdentityMemory/index.tsxnew file mode 100644index 00000000000..ef510f1134f--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Inspector/AddIdentityMemory/index.tsx@@ -0,0 +1,60 @@+'use client';++import type { BuiltinInspectorProps } from '@lobechat/types';+import { createStaticStyles, cssVar, cx } from 'antd-style';+import { Check } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';++import type { AddIdentityMemoryParams, AddIdentityMemoryState } from '../../../types';++const styles = createStaticStyles(({ css }) => ({+ statusIcon: css`+ margin-block-end: -2px;+ margin-inline-start: 4px;+ `,+}));++export const AddIdentityMemoryInspector = memo<+ BuiltinInspectorProps<AddIdentityMemoryParams, AddIdentityMemoryState>+>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {+ const { t } = useTranslation('plugin');++ const title = args?.title || partialArgs?.title;++ // Initial streaming state+ if (isArgumentsStreaming && !title) {+ return (+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>+ <span>{t('builtins.lobe-user-memory.apiName.addIdentityMemory')}</span>+ </div>+ );+ }++ const isSuccess = pluginState?.memoryId;++ return (+ <div+ className={cx(+ inspectorTextStyles.root,+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,+ )}+ >+ <span>{t('builtins.lobe-user-memory.apiName.addIdentityMemory')}</span>+ {title && (+ <>+ : <span className={highlightTextStyles.primary}>{title}</span>+ </>+ )}+ {!isLoading && isSuccess && (+ <Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />+ )}+ </div>+ );+});++AddIdentityMemoryInspector.displayName = 'AddIdentityMemoryInspector';++export default AddIdentityMemoryInspector;diff --git a/packages/builtin-tool-memory/src/client/Inspector/AddPreferenceMemory/index.tsx b/packages/builtin-tool-memory/src/client/Inspector/AddPreferenceMemory/index.tsxnew file mode 100644index 00000000000..60b92ce38f8--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Inspector/AddPreferenceMemory/index.tsx@@ -0,0 +1,60 @@+'use client';++import type { BuiltinInspectorProps } from '@lobechat/types';+import { createStaticStyles, cssVar, cx } from 'antd-style';+import { Check } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';++import type { AddPreferenceMemoryParams, AddPreferenceMemoryState } from '../../../types';++const styles = createStaticStyles(({ css }) => ({+ statusIcon: css`+ margin-block-end: -2px;+ margin-inline-start: 4px;+ `,+}));++export const AddPreferenceMemoryInspector = memo<+ BuiltinInspectorProps<AddPreferenceMemoryParams, AddPreferenceMemoryState>+>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {+ const { t } = useTranslation('plugin');++ const title = args?.title || partialArgs?.title;++ // Initial streaming state+ if (isArgumentsStreaming && !title) {+ return (+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>+ <span>{t('builtins.lobe-user-memory.apiName.addPreferenceMemory')}</span>+ </div>+ );+ }++ const isSuccess = pluginState?.memoryId;++ return (+ <div+ className={cx(+ inspectorTextStyles.root,+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,+ )}+ >+ <span>{t('builtins.lobe-user-memory.apiName.addPreferenceMemory')}</span>+ {title && (+ <>+ : <span className={highlightTextStyles.primary}>{title}</span>+ </>+ )}+ {!isLoading && isSuccess && (+ <Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />+ )}+ </div>+ );+});++AddPreferenceMemoryInspector.displayName = 'AddPreferenceMemoryInspector';++export default AddPreferenceMemoryInspector;diff --git a/packages/builtin-tool-memory/src/client/Inspector/RemoveIdentityMemory/index.tsx b/packages/builtin-tool-memory/src/client/Inspector/RemoveIdentityMemory/index.tsxnew file mode 100644index 00000000000..a0d5ab8ecae--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Inspector/RemoveIdentityMemory/index.tsx@@ -0,0 +1,60 @@+'use client';++import type { BuiltinInspectorProps } from '@lobechat/types';+import { createStaticStyles, cssVar, cx } from 'antd-style';+import { Check } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';++import type { RemoveIdentityMemoryParams, RemoveIdentityMemoryState } from '../../../types';++const styles = createStaticStyles(({ css }) => ({+ statusIcon: css`+ margin-block-end: -2px;+ margin-inline-start: 4px;+ `,+}));++export const RemoveIdentityMemoryInspector = memo<+ BuiltinInspectorProps<RemoveIdentityMemoryParams, RemoveIdentityMemoryState>+>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {+ const { t } = useTranslation('plugin');++ const id = args?.id || partialArgs?.id;++ // Initial streaming state+ if (isArgumentsStreaming && !id) {+ return (+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>+ <span>{t('builtins.lobe-user-memory.apiName.removeIdentityMemory')}</span>+ </div>+ );+ }++ const isSuccess = pluginState?.identityId;++ return (+ <div+ className={cx(+ inspectorTextStyles.root,+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,+ )}+ >+ <span>{t('builtins.lobe-user-memory.apiName.removeIdentityMemory')}</span>+ {id && (+ <>+ : <span className={highlightTextStyles.warning}>{id}</span>+ </>+ )}+ {!isLoading && isSuccess && (+ <Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />+ )}+ </div>+ );+});++RemoveIdentityMemoryInspector.displayName = 'RemoveIdentityMemoryInspector';++export default RemoveIdentityMemoryInspector;diff --git a/packages/builtin-tool-memory/src/client/Inspector/SearchUserMemory/index.tsx b/packages/builtin-tool-memory/src/client/Inspector/SearchUserMemory/index.tsxnew file mode 100644index 00000000000..0b410a2e65a--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Inspector/SearchUserMemory/index.tsx@@ -0,0 +1,67 @@+'use client';++import type { BuiltinInspectorProps } from '@lobechat/types';+import { Text } from '@lobehub/ui';+import { cssVar, cx } from 'antd-style';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';++import type { SearchMemoryParams, SearchUserMemoryState } from '../../../types';++export const SearchUserMemoryInspector = memo<+ BuiltinInspectorProps<SearchMemoryParams, SearchUserMemoryState>+>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {+ const { t } = useTranslation('plugin');++ const query = args?.query || partialArgs?.query;++ // Initial streaming state+ if (isArgumentsStreaming && !query) {+ return (+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>+ <span>{t('builtins.lobe-user-memory.apiName.searchUserMemory')}</span>+ </div>+ );+ }++ // pluginState is SearchMemoryResult directly (contexts, experiences, preferences)+ const resultCount = pluginState+ ? (pluginState.contexts?.length ?? 0) ++ (pluginState.experiences?.length ?? 0) ++ (pluginState.preferences?.length ?? 0)+ : 0;+ const hasResults = resultCount > 0;++ return (+ <div+ className={cx(+ inspectorTextStyles.root,+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,+ )}+ >+ <span>{t('builtins.lobe-user-memory.apiName.searchUserMemory')}: </span>+ {query && <span className={highlightTextStyles.primary}>{query}</span>}+ {!isLoading &&+ !isArgumentsStreaming &&+ pluginState &&+ (hasResults ? (+ <span style={{ marginInlineStart: 4 }}>({resultCount})</span>+ ) : (+ <Text+ as={'span'}+ color={cssVar.colorTextDescription}+ fontSize={12}+ style={{ marginInlineStart: 4 }}+ >+ ({t('builtins.lobe-user-memory.inspector.noResults')})+ </Text>+ ))}+ </div>+ );+});++SearchUserMemoryInspector.displayName = 'SearchUserMemoryInspector';++export default SearchUserMemoryInspector;diff --git a/packages/builtin-tool-memory/src/client/Inspector/UpdateIdentityMemory/index.tsx b/packages/builtin-tool-memory/src/client/Inspector/UpdateIdentityMemory/index.tsxnew file mode 100644index 00000000000..2ebb9b6e504--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Inspector/UpdateIdentityMemory/index.tsx@@ -0,0 +1,60 @@+'use client';++import type { BuiltinInspectorProps } from '@lobechat/types';+import { createStaticStyles, cssVar, cx } from 'antd-style';+import { Check } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';++import type { UpdateIdentityMemoryParams, UpdateIdentityMemoryState } from '../../../types';++const styles = createStaticStyles(({ css }) => ({+ statusIcon: css`+ margin-block-end: -2px;+ margin-inline-start: 4px;+ `,+}));++export const UpdateIdentityMemoryInspector = memo<+ BuiltinInspectorProps<UpdateIdentityMemoryParams, UpdateIdentityMemoryState>+>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {+ const { t } = useTranslation('plugin');++ const id = args?.id || partialArgs?.id;++ // Initial streaming state+ if (isArgumentsStreaming && !id) {+ return (+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>+ <span>{t('builtins.lobe-user-memory.apiName.updateIdentityMemory')}</span>+ </div>+ );+ }++ const isSuccess = pluginState?.identityId;++ return (+ <div+ className={cx(+ inspectorTextStyles.root,+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,+ )}+ >+ <span>{t('builtins.lobe-user-memory.apiName.updateIdentityMemory')}</span>+ {id && (+ <>+ : <span className={highlightTextStyles.warning}>{id}</span>+ </>+ )}+ {!isLoading && isSuccess && (+ <Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />+ )}+ </div>+ );+});++UpdateIdentityMemoryInspector.displayName = 'UpdateIdentityMemoryInspector';++export default UpdateIdentityMemoryInspector;diff --git a/packages/builtin-tool-memory/src/client/Inspector/index.ts b/packages/builtin-tool-memory/src/client/Inspector/index.tsnew file mode 100644index 00000000000..14e4baf7277--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Inspector/index.ts@@ -0,0 +1,35 @@+import { type BuiltinInspector } from '@lobechat/types';++import { MemoryApiName } from '../../types';+import { AddContextMemoryInspector } from './AddContextMemory';+import { AddExperienceMemoryInspector } from './AddExperienceMemory';+import { AddIdentityMemoryInspector } from './AddIdentityMemory';+import { AddPreferenceMemoryInspector } from './AddPreferenceMemory';+import { RemoveIdentityMemoryInspector } from './RemoveIdentityMemory';+import { SearchUserMemoryInspector } from './SearchUserMemory';+import { UpdateIdentityMemoryInspector } from './UpdateIdentityMemory';++/**+ * Memory Inspector Components Registry+ *+ * Inspector components customize the title/header area+ * of tool calls in the conversation UI.+ */+export const MemoryInspectors: Record<string, BuiltinInspector> = {+ [MemoryApiName.addContextMemory]: AddContextMemoryInspector as BuiltinInspector,+ [MemoryApiName.addExperienceMemory]: AddExperienceMemoryInspector as BuiltinInspector,+ [MemoryApiName.addIdentityMemory]: AddIdentityMemoryInspector as BuiltinInspector,+ [MemoryApiName.addPreferenceMemory]: AddPreferenceMemoryInspector as BuiltinInspector,+ [MemoryApiName.removeIdentityMemory]: RemoveIdentityMemoryInspector as BuiltinInspector,+ [MemoryApiName.searchUserMemory]: SearchUserMemoryInspector as BuiltinInspector,+ [MemoryApiName.updateIdentityMemory]: UpdateIdentityMemoryInspector as BuiltinInspector,+};++// Re-export individual inspectors+export { AddContextMemoryInspector } from './AddContextMemory';+export { AddExperienceMemoryInspector } from './AddExperienceMemory';+export { AddIdentityMemoryInspector } from './AddIdentityMemory';+export { AddPreferenceMemoryInspector } from './AddPreferenceMemory';+export { RemoveIdentityMemoryInspector } from './RemoveIdentityMemory';+export { SearchUserMemoryInspector } from './SearchUserMemory';+export { UpdateIdentityMemoryInspector } from './UpdateIdentityMemory';diff --git a/packages/builtin-tool-memory/src/client/Intervention/AddExperienceMemory/index.tsx b/packages/builtin-tool-memory/src/client/Intervention/AddExperienceMemory/index.tsxnew file mode 100644index 00000000000..e43515e7930--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Intervention/AddExperienceMemory/index.tsx@@ -0,0 +1,17 @@+'use client';++import type { BuiltinInterventionProps } from '@lobechat/types';+import { memo } from 'react';++import type { AddExperienceMemoryParams } from '../../../types';+import { ExperienceMemoryCard } from '../../components';++const AddExperienceMemoryIntervention = memo<BuiltinInterventionProps<AddExperienceMemoryParams>>(+ ({ args }) => {+ return <ExperienceMemoryCard data={args} />;+ },+);++AddExperienceMemoryIntervention.displayName = 'AddExperienceMemoryIntervention';++export default AddExperienceMemoryIntervention;diff --git a/packages/builtin-tool-memory/src/client/Intervention/index.ts b/packages/builtin-tool-memory/src/client/Intervention/index.tsnew file mode 100644index 00000000000..3d1fef6b92c--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Intervention/index.ts@@ -0,0 +1,13 @@+import type { BuiltinIntervention } from '@lobechat/types';++import { MemoryApiName } from '../../types';+import AddExperienceMemoryIntervention from './AddExperienceMemory';++/**+ * Memory Intervention Components Registry+ *+ * Intervention components display when human approval is required before tool execution.+ */+export const MemoryInterventions: Record<string, BuiltinIntervention> = {+ [MemoryApiName.addExperienceMemory]: AddExperienceMemoryIntervention as BuiltinIntervention,+};diff --git a/packages/builtin-tool-memory/src/client/Render/AddExperienceMemory/index.tsx b/packages/builtin-tool-memory/src/client/Render/AddExperienceMemory/index.tsxnew file mode 100644index 00000000000..ed0d0f76e9c--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Render/AddExperienceMemory/index.tsx@@ -0,0 +1,17 @@+'use client';++import type { BuiltinRenderProps } from '@lobechat/types';+import { memo } from 'react';++import type { AddExperienceMemoryParams, AddExperienceMemoryState } from '../../../types';+import { ExperienceMemoryCard } from '../../components';++const AddExperienceMemoryRender = memo<+ BuiltinRenderProps<AddExperienceMemoryParams, AddExperienceMemoryState>+>(({ args }) => {+ return <ExperienceMemoryCard data={args} />;+});++AddExperienceMemoryRender.displayName = 'AddExperienceMemoryRender';++export default AddExperienceMemoryRender;diff --git a/packages/builtin-tool-memory/src/client/Render/SearchUserMemory/index.tsx b/packages/builtin-tool-memory/src/client/Render/SearchUserMemory/index.tsxnew file mode 100644index 00000000000..8395c8dc244--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Render/SearchUserMemory/index.tsx@@ -0,0 +1,217 @@+'use client';++import type { BuiltinRenderProps } from '@lobechat/types';+import { Accordion, AccordionItem, Flexbox, Tag, Text } from '@lobehub/ui';+import { createStaticStyles } from 'antd-style';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { highlightTextStyles } from '@/styles';++import type { SearchMemoryParams, SearchUserMemoryState } from '../../../types';++const styles = createStaticStyles(({ css, cssVar }) => ({+ container: css`+ overflow: hidden;++ width: 100%;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: 12px;++ background: ${cssVar.colorBgContainer};+ `,+ empty: css`+ padding: 24px;+ color: ${cssVar.colorTextTertiary};+ text-align: center;+ `,+ item: css`+ padding-block: 10px;+ padding-inline: 12px;+ border-block-end: 1px dashed ${cssVar.colorBorderSecondary};++ &:last-child {+ border-block-end: none;+ }+ `,+ itemContent: css`+ font-size: 13px;+ line-height: 1.5;+ color: ${cssVar.colorTextSecondary};+ `,+ itemTitle: css`+ font-size: 14px;+ font-weight: 500;+ color: ${cssVar.colorText};+ `,+ sectionHeader: css`+ font-size: 12px;+ font-weight: 500;+ `,+ tags: css`+ padding-block-start: 6px;+ `,+}));++interface MemoryItemProps {+ content?: string | null;+ subContent?: string | null;+ tags?: string[] | null;+ title?: string | null;+}++const MemoryItem = memo<MemoryItemProps>(({ title, content, subContent, tags }) => {+ return (+ <Flexbox className={styles.item} gap={4}>+ {title && <div className={styles.itemTitle}>{title}</div>}+ {content && <div className={styles.itemContent}>{content}</div>}+ {subContent && (+ <Text className={styles.itemContent} style={{ fontStyle: 'italic' }} type={'secondary'}>+ {subContent}+ </Text>+ )}+ {tags && tags.length > 0 && (+ <Flexbox className={styles.tags} gap={4} horizontal wrap={'wrap'}>+ {tags.map((tag, index) => (+ <Tag key={index} size={'small'}>+ {tag}+ </Tag>+ ))}+ </Flexbox>+ )}+ </Flexbox>+ );+});++MemoryItem.displayName = 'MemoryItem';++const SearchUserMemoryRender = memo<BuiltinRenderProps<SearchMemoryParams, SearchUserMemoryState>>(+ ({ pluginState }) => {+ const { t } = useTranslation('plugin');++ const contexts = pluginState?.contexts || [];+ const experiences = pluginState?.experiences || [];+ const preferences = pluginState?.preferences || [];++ const totalCount = contexts.length + experiences.length + preferences.length;++ if (totalCount === 0) {+ return (+ <div className={styles.container}>+ <div className={styles.empty}>{t('builtins.lobe-user-memory.inspector.noResults')}</div>+ </div>+ );+ }++ const defaultActiveKeys = [+ ...(contexts.length > 0 ? ['contexts'] : []),+ ...(experiences.length > 0 ? ['experiences'] : []),+ ...(preferences.length > 0 ? ['preferences'] : []),+ ];++ return (+ <Flexbox className={styles.container}>+ <Accordion defaultExpandedKeys={defaultActiveKeys} gap={0}>+ {/* Contexts */}+ {contexts.length > 0 && (+ <AccordionItem+ itemKey="contexts"+ paddingBlock={8}+ paddingInline={12}+ title={+ <Text className={styles.sectionHeader}>+ <span className={highlightTextStyles.info}>+ {t('builtins.lobe-user-memory.render.contexts' as any)}+ </span>+ <Text as={'span'} type={'secondary'}>+ {' '}+ ({contexts.length})+ </Text>+ </Text>+ }+ >+ <Flexbox>+ {contexts.map((item) => (+ <MemoryItem+ content={item.description}+ key={item.id}+ subContent={item.currentStatus}+ tags={item.tags}+ title={item.title}+ />+ ))}+ </Flexbox>+ </AccordionItem>+ )}++ {/* Experiences */}+ {experiences.length > 0 && (+ <AccordionItem+ itemKey="experiences"+ paddingBlock={8}+ paddingInline={12}+ title={+ <Text className={styles.sectionHeader}>+ <span className={highlightTextStyles.gold}>+ {t('builtins.lobe-user-memory.render.experiences' as any)}+ </span>+ <Text as={'span'} type={'secondary'}>+ {' '}+ ({experiences.length})+ </Text>+ </Text>+ }+ >+ <Flexbox>+ {experiences.map((item) => (+ <MemoryItem+ content={item.situation}+ key={item.id}+ subContent={item.keyLearning}+ tags={item.tags}+ title={item.action}+ />+ ))}+ </Flexbox>+ </AccordionItem>+ )}++ {/* Preferences */}+ {preferences.length > 0 && (+ <AccordionItem+ itemKey="preferences"+ paddingBlock={8}+ paddingInline={12}+ title={+ <Text className={styles.sectionHeader}>+ <span className={highlightTextStyles.warning}>+ {t('builtins.lobe-user-memory.render.preferences' as any)}+ </span>+ <Text as={'span'} type={'secondary'}>+ {' '}+ ({preferences.length})+ </Text>+ </Text>+ }+ >+ <Flexbox>+ {preferences.map((item) => (+ <MemoryItem+ content={item.conclusionDirectives}+ key={item.id}+ subContent={item.suggestions}+ tags={item.tags}+ />+ ))}+ </Flexbox>+ </AccordionItem>+ )}+ </Accordion>+ </Flexbox>+ );+ },+);++SearchUserMemoryRender.displayName = 'SearchUserMemoryRender';++export default SearchUserMemoryRender;diff --git a/packages/builtin-tool-memory/src/client/Render/index.ts b/packages/builtin-tool-memory/src/client/Render/index.tsnew file mode 100644index 00000000000..5f9953445a5--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Render/index.ts@@ -0,0 +1,15 @@+import type { BuiltinRender } from '@lobechat/types';++import { MemoryApiName } from '../../types';+import AddExperienceMemoryRender from './AddExperienceMemory';+import SearchUserMemoryRender from './SearchUserMemory';++/**+ * Memory Render Components Registry+ *+ * Render components display the final result of tool execution.+ */+export const MemoryRenders: Record<string, BuiltinRender> = {+ [MemoryApiName.addExperienceMemory]: AddExperienceMemoryRender as BuiltinRender,+ [MemoryApiName.searchUserMemory]: SearchUserMemoryRender as BuiltinRender,+};diff --git a/packages/builtin-tool-memory/src/client/Streaming/AddExperienceMemory/index.tsx b/packages/builtin-tool-memory/src/client/Streaming/AddExperienceMemory/index.tsxnew file mode 100644index 00000000000..db0ff44f1ca--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Streaming/AddExperienceMemory/index.tsx@@ -0,0 +1,17 @@+'use client';++import type { BuiltinStreamingProps } from '@lobechat/types';+import { memo } from 'react';++import type { AddExperienceMemoryParams } from '../../../types';+import { ExperienceMemoryCard } from '../../components';++export const AddExperienceMemoryStreaming = memo<BuiltinStreamingProps<AddExperienceMemoryParams>>(+ ({ args }) => {+ return <ExperienceMemoryCard data={args} loading />;+ },+);++AddExperienceMemoryStreaming.displayName = 'AddExperienceMemoryStreaming';++export default AddExperienceMemoryStreaming;diff --git a/packages/builtin-tool-memory/src/client/Streaming/index.ts b/packages/builtin-tool-memory/src/client/Streaming/index.tsnew file mode 100644index 00000000000..8ba7658eb26--- /dev/null+++ b/packages/builtin-tool-memory/src/client/Streaming/index.ts@@ -0,0 +1,18 @@+import { type BuiltinStreaming } from '@lobechat/types';++import { MemoryApiName } from '../../types';+import { AddExperienceMemoryStreaming } from './AddExperienceMemory';++/**+ * Memory Streaming Components Registry+ *+ * Streaming components are used to render tool calls while arguments+ * are still being generated, allowing real-time feedback to users.+ */+export const MemoryStreamings: Record<string, BuiltinStreaming> = {+ [MemoryApiName.addExperienceMemory]: AddExperienceMemoryStreaming as BuiltinStreaming,+};++++export {AddExperienceMemoryStreaming} from './AddExperienceMemory';\ No newline at end of filediff --git a/packages/builtin-tool-memory/src/client/components/ExperienceMemoryCard.tsx b/packages/builtin-tool-memory/src/client/components/ExperienceMemoryCard.tsxnew file mode 100644index 00000000000..1f9a0deddc0--- /dev/null+++ b/packages/builtin-tool-memory/src/client/components/ExperienceMemoryCard.tsx@@ -0,0 +1,231 @@+'use client';++import { Accordion, AccordionItem, Avatar, Flexbox, Tag, Text } from '@lobehub/ui';+import { Steps } from 'antd';+import { createStaticStyles, cssVar } from 'antd-style';+import { memo } from 'react';++import BubblesLoading from '@/components/BubblesLoading';+import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';+import StreamingMarkdown from '@/components/StreamingMarkdown';+import { highlightTextStyles } from '@/styles';++import type { AddExperienceMemoryParams } from '../../types';++const styles = createStaticStyles(({ css, cssVar }) => ({+ container: css`+ overflow: hidden;++ width: 100%;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: 16px;++ background: ${cssVar.colorBgContainer};+ `,+ content: css`+ padding-block: 12px;+ padding-inline: 16px;+ `,+ detail: css`+ font-size: 13px;+ line-height: 1.6;+ color: ${cssVar.colorTextSecondary};+ `,+ header: css`+ padding-block: 10px;+ padding-inline: 12px;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};+ `,+ keyLearning: css`+ font-size: 14px;+ line-height: 1.6;+ color: ${cssVar.colorText};+ `,+ section: css`+ padding: 4px;+ border-block-start: 1px solid ${cssVar.colorBorderSecondary};+ `,+ stepContent: css`+ font-size: 13px;+ line-height: 1.6;+ color: ${cssVar.colorTextSecondary};+ white-space: pre-wrap;+ `,+ stepsContainer: css`+ .ant-steps-item-content {+ min-height: auto;+ }++ .ant-steps-item-description {+ padding-block-end: 12px !important;+ }+ `,+ summary: css`+ font-size: 14px;+ font-weight: 500;+ color: ${cssVar.colorTextSecondary};+ `,+ tags: css`+ padding-block-start: 8px;+ border-block-start: 1px dashed ${cssVar.colorBorderSecondary};+ `,+ title: css`+ overflow: hidden;+ display: -webkit-box;+ -webkit-box-orient: vertical;+ -webkit-line-clamp: 1;++ font-weight: 500;+ color: ${cssVar.colorText};+ `,+}));++export interface ExperienceMemoryCardProps {+ data?: AddExperienceMemoryParams;+ loading?: boolean;+}++export const ExperienceMemoryCard = memo<ExperienceMemoryCardProps>(({ data, loading }) => {+ const { summary, details, tags, title, withExperience } = data || {};+ const { situation, reasoning, action, possibleOutcome, keyLearning } = withExperience || {};++ const hasStarContent = situation || reasoning || action || possibleOutcome;++ if (!summary && !details && !tags?.length && !title && !hasStarContent && !keyLearning)+ return null;++ const starItems = [+ { avatar: 'S', content: situation, title: 'Situation' },+ { avatar: 'T', content: reasoning, title: 'Task' },+ { avatar: 'A', content: action, title: 'Action' },+ { avatar: 'R', content: possibleOutcome, title: 'Result' },+ ].filter((item) => item.content);++ return (+ <Flexbox className={styles.container}>+ {/* Header */}+ <Flexbox align={'center'} className={styles.header} gap={8} horizontal>+ <Flexbox flex={1}>+ <div className={styles.title}>{title || 'Experience Memory'}</div>+ </Flexbox>+ {loading && <NeuralNetworkLoading size={20} />}+ </Flexbox>++ {/* When has STAR content: collapse summary */}+ {hasStarContent ? (+ <>+ {/* Collapsed Summary */}+ {(summary || tags?.length) && (+ <Accordion gap={0}>+ <AccordionItem+ itemKey="summary"+ paddingBlock={8}+ paddingInline={8}+ styles={{+ base: { marginBlock: 4, marginInline: 4 },+ }}+ title={+ <Text fontSize={12} type={'secondary'} weight={500}>+ Summary+ </Text>+ }+ >+ <Flexbox gap={8} paddingBlock={'8px 12px'} paddingInline={8}>+ {summary && <div className={styles.summary}>{summary}</div>}+ {details && <div className={styles.detail}>{details}</div>}+ {tags && tags.length > 0 && (+ <Flexbox className={styles.tags} gap={8} horizontal wrap={'wrap'}>+ {tags.map((tag, index) => (+ <Tag key={index}>{tag}</Tag>+ ))}+ </Flexbox>+ )}+ </Flexbox>+ </AccordionItem>+ </Accordion>+ )}++ {/* STAR Steps */}+ <Accordion className={styles.section} defaultExpandedKeys={['star']} gap={0}>+ <AccordionItem+ itemKey="star"+ paddingBlock={8}+ paddingInline={8}+ title={+ <Text fontSize={12} type={'secondary'} weight={500}>+ STAR+ </Text>+ }+ >+ <Flexbox paddingBlock={'8px 12px'} paddingInline={8}>+ <Steps+ className={styles.stepsContainer}+ current={null as any}+ direction="vertical"+ items={starItems.map((item) => ({+ description: <div className={styles.stepContent}>{item.content}</div>,+ icon: (+ <Avatar+ avatar={item.avatar}+ shadow+ shape={'square'}+ size={20}+ style={{+ border: `1px solid ${cssVar.colorBorderSecondary}`,+ fontSize: 11,+ }}+ />+ ),+ title: (+ <Text as={'span'} fontSize={12} type={'secondary'} weight={500}>+ {item.title}+ </Text>+ ),+ }))}+ size="small"+ />+ </Flexbox>+ </AccordionItem>+ </Accordion>++ {/* Key Learning */}+ {keyLearning && (+ <Flexbox+ className={styles.section}+ gap={8}+ style={{ paddingBlock: 16, paddingInline: 12 }}+ >+ <Text fontSize={12} weight={500}>+ <span className={highlightTextStyles.gold}>Key Learning</span>+ </Text>+ <div className={styles.keyLearning}>{keyLearning}</div>+ </Flexbox>+ )}+ </>+ ) : (+ /* When no STAR content: show summary and details */+ <Flexbox className={styles.content} gap={8}>+ {!summary && loading ? (+ <BubblesLoading />+ ) : (+ <>+ {summary && <div className={styles.summary}>{summary}</div>}+ {details && <StreamingMarkdown>{details}</StreamingMarkdown>}+ {tags && tags.length > 0 && (+ <Flexbox className={styles.tags} gap={8} horizontal wrap={'wrap'}>+ {tags.map((tag, index) => (+ <Tag key={index}>{tag}</Tag>+ ))}+ </Flexbox>+ )}+ </>+ )}+ </Flexbox>+ )}+ </Flexbox>+ );+});++ExperienceMemoryCard.displayName = 'ExperienceMemoryCard';++export default ExperienceMemoryCard;diff --git a/packages/builtin-tool-memory/src/client/components/index.ts b/packages/builtin-tool-memory/src/client/components/index.tsnew file mode 100644index 00000000000..c315115d546--- /dev/null+++ b/packages/builtin-tool-memory/src/client/components/index.ts@@ -0,0 +1 @@+export { ExperienceMemoryCard, type ExperienceMemoryCardProps } from './ExperienceMemoryCard';diff --git a/packages/builtin-tool-memory/src/client/index.ts b/packages/builtin-tool-memory/src/client/index.tsnew file mode 100644index 00000000000..70303211626--- /dev/null+++ b/packages/builtin-tool-memory/src/client/index.ts@@ -0,0 +1,27 @@+// Inspector components (customized tool call headers)+export { MemoryInspectors } from './Inspector';+export {+ AddContextMemoryInspector,+ AddExperienceMemoryInspector,+ AddIdentityMemoryInspector,+ AddPreferenceMemoryInspector,+ RemoveIdentityMemoryInspector,+ SearchUserMemoryInspector,+ UpdateIdentityMemoryInspector,+} from './Inspector';++// Intervention components (human approval UI before tool execution)+export { MemoryInterventions } from './Intervention';++// Render components (final result display after tool execution)+export { MemoryRenders } from './Render';++// Streaming components (real-time feedback during tool execution)+export { AddExperienceMemoryStreaming, MemoryStreamings } from './Streaming';++// Shared components+export { ExperienceMemoryCard, type ExperienceMemoryCardProps } from './components';++// Re-export types and manifest for convenience+export { MemoryManifest } from '../manifest';+export * from '../types';diff --git a/packages/builtin-tool-memory/src/executor/index.ts b/packages/builtin-tool-memory/src/executor/index.tsindex 27ff2270f3d..4bdcdb1edad 100644--- a/packages/builtin-tool-memory/src/executor/index.ts+++ b/packages/builtin-tool-memory/src/executor/index.ts@@ -41,6 +41,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {} catch (error) {const err = error as Error;return {+ content: `searchUserMemory with error detail: ${err.message}`,error: {body: error,message: err.message,@@ -80,6 +81,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {} catch (error) {const err = error as Error;return {+ content: `addContextMemory with error detail: ${err.message}`,error: {body: error,message: err.message,@@ -110,13 +112,15 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {}return {- content: `🧠 Experience memory saved: "${params.title}"`,+ content: `Experience memory "${params.title}" saved with memoryId: "${result.memoryId}" and experienceId: "${result.experienceId}"`,state: { experienceId: result.experienceId, memoryId: result.memoryId },success: true,};} catch (error) {const err = error as Error;+return {+ content: `addExperienceMemory with error detail: ${err.message}`,error: {body: error,message: err.message,@@ -154,6 +158,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {} catch (error) {const err = error as Error;return {+ content: `addIdentityMemory with error detail: ${err.message}`,error: {body: error,message: err.message,@@ -191,6 +196,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {} catch (error) {const err = error as Error;return {+ content: `addPreferenceMemory with error detail: ${err.message}`,error: {body: error,message: err.message,@@ -230,6 +236,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {} catch (error) {const err = error as Error;return {+ content: `updateIdentityMemory with error detail: ${err.message}`,error: {body: error,message: err.message,@@ -264,6 +271,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {} catch (error) {const err = error as Error;return {+ content: `removeIdentityMemory with error detail: ${err.message}`,error: {body: error,message: err.message,diff --git a/packages/builtin-tool-memory/src/types.ts b/packages/builtin-tool-memory/src/types.tsindex 229dcb1a98b..ad334ecfb82 100644--- a/packages/builtin-tool-memory/src/types.ts+++ b/packages/builtin-tool-memory/src/types.ts@@ -1,3 +1,14 @@+import type {+ AddIdentityActionSchema,+ ContextMemoryItemSchema,+ ExperienceMemoryItemSchema,+ PreferenceMemoryItemSchema,+ RemoveIdentityActionSchema,+ UpdateIdentityActionSchema,+} from '@lobechat/memory-user-memory/schemas';+import type { SearchMemoryResult } from '@lobechat/types';+import type { z } from 'zod';+export const MemoryApiName = {addContextMemory: 'addContextMemory',addExperienceMemory: 'addExperienceMemory',@@ -12,3 +23,53 @@ export type MemoryApiNameType = (typeof MemoryApiName)[keyof typeof MemoryApiNam/** @deprecated Use MemoryApiName instead */export const UserMemoryApiName = MemoryApiName;++// ==================== Inspector Types ====================++// Search++// SearchUserMemoryState is the same as SearchMemoryResult (executor returns result directly as state)+export type SearchUserMemoryState = SearchMemoryResult;++// Add Context+export type AddContextMemoryParams = z.infer<typeof ContextMemoryItemSchema>;+export interface AddContextMemoryState {+ contextId?: string;+ memoryId?: string;+}++// Add Experience+export type AddExperienceMemoryParams = z.infer<typeof ExperienceMemoryItemSchema>;+export interface AddExperienceMemoryState {+ experienceId?: string;+ memoryId?: string;+}++// Add Identity+export type AddIdentityMemoryParams = z.infer<typeof AddIdentityActionSchema>;+export interface AddIdentityMemoryState {+ identityId?: string;+ memoryId?: string;+}++// Add Preference+export type AddPreferenceMemoryParams = z.infer<typeof PreferenceMemoryItemSchema>;+export interface AddPreferenceMemoryState {+ memoryId?: string;+ preferenceId?: string;+}++// Update Identity+export type UpdateIdentityMemoryParams = z.infer<typeof UpdateIdentityActionSchema>;+export interface UpdateIdentityMemoryState {+ identityId?: string;+}++// Remove Identity+export type RemoveIdentityMemoryParams = z.infer<typeof RemoveIdentityActionSchema>;+export interface RemoveIdentityMemoryState {+ identityId?: string;+ reason?: string;+}++export {type SearchMemoryParams, type SearchMemoryResult} from '@lobechat/types';\ No newline at end of filediff --git a/packages/conversation-flow/src/__tests__/fixtures/outputs/assistantGroup/tools-with-branches.json b/packages/conversation-flow/src/__tests__/fixtures/outputs/assistantGroup/tools-with-branches.jsonindex 79bfd7bcc1e..b94a86c52c9 100644--- a/packages/conversation-flow/src/__tests__/fixtures/outputs/assistantGroup/tools-with-branches.json+++ b/packages/conversation-flow/src/__tests__/fixtures/outputs/assistantGroup/tools-with-branches.json@@ -90,6 +90,10 @@"id": "msg-504","state": {"cached": false+ },+ "error": {+ "type": "NameError",+ "message": "name 'result' is not defined"}},"result_msg_id": "msg-504"diff --git a/packages/conversation-flow/src/transformation/FlatListBuilder.ts b/packages/conversation-flow/src/transformation/FlatListBuilder.tsindex d39284921dc..27e805884df 100644--- a/packages/conversation-flow/src/transformation/FlatListBuilder.ts+++ b/packages/conversation-flow/src/transformation/FlatListBuilder.ts@@ -644,6 +644,7 @@ export class FlatListBuilder {id: toolMsg.id,};if (toolMsg.error) result.error = toolMsg.error;+ if (toolMsg.pluginError) result.error = toolMsg.pluginError;if (toolMsg.pluginState) result.state = toolMsg.pluginState;const toolWithResult: ChatToolPayloadWithResult = {diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/index.tsxindex 6dfdddb1ad5..616e284be52 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/index.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/index.tsx@@ -8,49 +8,43 @@ import Settings from './Settings';interface ActionsProps {assistantMessageId: string;- handleExpand?: (expand?: boolean) => void;+ canToggleCustomToolRender?: boolean;identifier: string;+ setShowCustomToolRender?: (show: boolean) => void;setShowDebug?: (show: boolean) => void;- setShowPluginRender: (show: boolean) => void;- showCustomPluginRender: boolean;+ showCustomToolRender?: boolean;showDebug?: boolean;- showPluginRender: boolean;}const Actions = memo<ActionsProps>(({assistantMessageId,+ canToggleCustomToolRender,identifier,+ setShowCustomToolRender,setShowDebug,- setShowPluginRender,- showCustomPluginRender,+ showCustomToolRender,showDebug,- showPluginRender,- handleExpand,}) => {const { t } = useTranslation('plugin');const deleteAssistantMessage = useConversationStore((s) => s.deleteAssistantMessage);return (<>- {showCustomPluginRender && (+ {canToggleCustomToolRender && (<ActionIcon- icon={showPluginRender ? LogsIcon : LayoutPanelTop}+ icon={showCustomToolRender ? LogsIcon : LayoutPanelTop}onClick={() => {- setShowPluginRender(!showPluginRender);- handleExpand?.(true);+ setShowCustomToolRender?.(!showCustomToolRender);}}size={'small'}- title={showPluginRender ? t('inspector.args') : t('inspector.pluginRender')}+ title={showCustomToolRender ? t('inspector.args') : t('inspector.pluginRender')}/>)}<ActionIconactive={showDebug}icon={showDebug ? LucideBugOff : LucideBug}- onClick={() => {- setShowDebug?.(!showDebug);- handleExpand?.(true);- }}+ onClick={() => setShowDebug?.(!showDebug)}size={'small'}title={t(showDebug ? 'debug.off' : 'debug.on')}/>diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/AbortResponse.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/AbortResponse.tsxsimilarity index 100%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/AbortResponse.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/AbortResponse.tsxdiff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/Arguments/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Arguments/index.tsxsimilarity index 100%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/Arguments/index.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Arguments/index.tsxdiff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/ErrorResponse.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/ErrorResponse.tsxsimilarity index 100%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/ErrorResponse.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/ErrorResponse.tsxdiff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/ApprovalActions.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ApprovalActions.tsxsimilarity index 100%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/ApprovalActions.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ApprovalActions.tsxdiff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/Fallback.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/Fallback.tsxsimilarity index 100%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/Fallback.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/Fallback.tsxdiff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/KeyValueEditor.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/KeyValueEditor.tsxsimilarity index 100%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/KeyValueEditor.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/KeyValueEditor.tsxdiff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/ModeSelector.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ModeSelector.tsxsimilarity index 100%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/ModeSelector.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ModeSelector.tsxdiff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/index.tsxsimilarity index 100%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/index.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/index.tsxdiff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/LoadingPlaceholder/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/LoadingPlaceholder/index.tsxsimilarity index 51%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/LoadingPlaceholder/index.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/LoadingPlaceholder/index.tsxindex 1a3a29df32f..061711c06c6 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/LoadingPlaceholder/index.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/LoadingPlaceholder/index.tsx@@ -2,6 +2,7 @@ import { safeParseJSON } from '@lobechat/utils';import { memo } from 'react';import { getBuiltinPlaceholder } from '@/tools/placeholders';+import { getBuiltinStreaming } from '@/tools/streamings';import Arguments from '../Arguments';@@ -9,16 +10,25 @@ interface LoadingPlaceholderProps {apiName: string;identifier: string;loading?: boolean;+ messageId: string;requestArgs?: string;+ toolCallId: string;}const LoadingPlaceholder = memo<LoadingPlaceholderProps>(- ({ identifier, requestArgs, apiName, loading }) => {- const Render = getBuiltinPlaceholder(identifier, apiName);+ ({ identifier, requestArgs, apiName, loading, toolCallId, messageId }) => {+ const Render =+ getBuiltinPlaceholder(identifier, apiName) || getBuiltinStreaming(identifier, apiName);if (Render) {return (- <Render apiName={apiName} args={safeParseJSON(requestArgs) || {}} identifier={identifier} />+ <Render+ apiName={apiName}+ args={safeParseJSON(requestArgs) || {}}+ identifier={identifier}+ messageId={messageId}+ toolCallId={toolCallId}+ />);}diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/PluginSettings.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/PluginSettings.tsxsimilarity index 100%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/PluginSettings.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/PluginSettings.tsxdiff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/RejectedResponse.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/RejectedResponse.tsxsimilarity index 100%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/RejectedResponse.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/RejectedResponse.tsxdiff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/CustomRender.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/CustomRender.tsxnew file mode 100644index 00000000000..890896a4fdc--- /dev/null+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/CustomRender.tsx@@ -0,0 +1,43 @@+import { type ChatPluginPayload } from '@/types/index';+import { Flexbox } from '@lobehub/ui';+import { memo } from 'react';++import PluginRender from '@/features/PluginsUI/Render';++interface CustomRenderProps {+ content: string;+ /**+ * The real message ID (tool message ID)+ */+ messageId?: string;+ plugin?: ChatPluginPayload;+ pluginState?: any;+ /**+ * The tool call ID from the assistant message+ */+ toolCallId: string;+}++const CustomRender = memo<CustomRenderProps>(+ ({ toolCallId, messageId, content, pluginState, plugin }) => {+ return (+ <Flexbox gap={12} id={toolCallId} width={'100%'}>+ <PluginRender+ arguments={plugin?.arguments}+ content={content}+ identifier={plugin?.identifier}+ loading={false}+ messageId={messageId}+ payload={plugin}+ pluginState={pluginState}+ toolCallId={toolCallId}+ type={plugin?.type}+ />+ </Flexbox>+ );+ },+);++CustomRender.displayName = 'GroupCustomRender';++export default CustomRender;diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/FallbacktArgumentRender.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/FallbacktArgumentRender.tsxnew file mode 100644index 00000000000..131fbdc15da--- /dev/null+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/FallbacktArgumentRender.tsx@@ -0,0 +1,59 @@+import { Block, Flexbox, Highlighter, Text } from '@lobehub/ui';+import { Divider } from 'antd';+import { memo, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++import Arguments from '../Arguments';++interface FallbackArgumentRenderProps {+ content: string;+ requestArgs?: string;+ toolCallId: string;+}++export const FallbackArgumentRender = memo<FallbackArgumentRenderProps>(+ ({ toolCallId, content, requestArgs }) => {+ const { t } = useTranslation('plugin');++ // Parse and display result content+ const { data, language } = useMemo(() => {+ try {+ const parsed = JSON.parse(content || '');+ // If parsed result is a string, return it directly+ if (typeof parsed === 'string') {+ return { data: parsed, language: 'plaintext' };+ }+ return { data: JSON.stringify(parsed, null, 2), language: 'json' };+ } catch {+ return { data: content || '', language: 'plaintext' };+ }+ }, [content]);++ // Default render: show arguments and result+ return (+ <Block id={toolCallId} variant={'outlined'} width={'100%'}>+ <Arguments arguments={requestArgs} />+ {content && (+ <>+ <Divider style={{ marginBlock: 0 }} />+ <Flexbox paddingBlock={'8px 0'} paddingInline={16}>+ <Text>{t('debug.response')}</Text>+ </Flexbox>+ <Highlighter+ language={language}+ style={{+ background: 'transparent',+ borderRadius: 0,+ maxHeight: 300,+ overflow: 'auto',+ }}+ variant={'filled'}+ >+ {data}+ </Highlighter>+ </>+ )}+ </Block>+ );+ },+);diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/index.tsxnew file mode 100644index 00000000000..efda18aa016--- /dev/null+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/index.tsx@@ -0,0 +1,46 @@+import { type ChatPluginPayload } from '@lobechat/types';+import { memo } from 'react';++import { getBuiltinRender } from '@/tools/renders';++import CustomRender from './CustomRender';+import { FallbackArgumentRender } from './FallbacktArgumentRender';++interface ToolRenderProps {+ content: string;+ messageId?: string;+ plugin?: ChatPluginPayload;+ pluginState?: any;+ showCustomToolRender?: boolean;+ toolCallId: string;+}++const ToolRender = memo<ToolRenderProps>(+ ({ showCustomToolRender, content, messageId, plugin, pluginState, toolCallId }) => {+ const hasCustomRender = !!getBuiltinRender(plugin?.identifier, plugin?.apiName);++ if (hasCustomRender && showCustomToolRender) {+ return (+ <CustomRender+ content={content}+ messageId={messageId}+ plugin={plugin}+ pluginState={pluginState}+ toolCallId={toolCallId}+ />+ );+ }++ return (+ <FallbackArgumentRender+ content={content}+ requestArgs={plugin?.arguments}+ toolCallId={toolCallId}+ />+ );+ },+);++ToolRender.displayName = 'ToolResultRender';++export default ToolRender;diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/index.tsxsimilarity index 85%rename from src/features/Conversation/Messages/AssistantGroup/Tool/Render/index.tsxrename to src/features/Conversation/Messages/AssistantGroup/Tool/Detail/index.tsxindex afc43adc6a4..796e57d5527 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/index.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/index.tsx@@ -6,12 +6,12 @@ import { Suspense, memo } from 'react';import { getBuiltinStreaming } from '@/tools/streamings';import AbortResponse from './AbortResponse';-import CustomRender from './CustomRender';import ErrorResponse from './ErrorResponse';import Intervention from './Intervention';import ModeSelector from './Intervention/ModeSelector';import LoadingPlaceholder from './LoadingPlaceholder';import RejectedResponse from './RejectedResponse';+import ToolRender from './Render';interface RenderProps {apiName: string;@@ -26,8 +26,7 @@ interface RenderProps {*/messageId: string;result?: ChatToolResult;- setShowPluginRender: (show: boolean) => void;- showPluginRender: boolean;+ showCustomToolRender?: boolean;toolCallId: string;toolMessageId?: string;type?: string;@@ -45,8 +44,6 @@ const Render = memo<RenderProps>(messageId,arguments: requestArgs,disableEditing,- showPluginRender,- setShowPluginRender,identifier,apiName,result,@@ -55,6 +52,7 @@ const Render = memo<RenderProps>(toolMessageId,isArgumentsStreaming,isToolCalling,+ showCustomToolRender,}) => {if (toolMessageId && intervention?.status === 'pending' && !disableEditing) {return (@@ -124,7 +122,9 @@ const Render = memo<RenderProps>(apiName={apiName}identifier={identifier}loading+ messageId={messageId}requestArgs={requestArgs}+ toolCallId={toolCallId}/>);@@ -133,23 +133,17 @@ const Render = memo<RenderProps>(return (<Suspense fallback={placeholder}><Flexbox gap={8}>- <CustomRender+ <ToolRendercontent={result.content || ''}messageId={toolMessageId}- plugin={- type- ? ({- apiName,- arguments: requestArgs || '',- identifier,- type,- } as any)- : undefined- }+ plugin={{+ apiName,+ arguments: requestArgs || '',+ identifier,+ type: type as any,+ }}pluginState={result.state}- requestArgs={requestArgs}- setShowPluginRender={setShowPluginRender}- showPluginRender={showPluginRender}+ showCustomToolRender={showCustomToolRender}toolCallId={toolCallId}/>{!disableEditing && (diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/CustomRender.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Render/CustomRender.tsxdeleted file mode 100644index 92664701b75..00000000000--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Render/CustomRender.tsx+++ /dev/null@@ -1,113 +0,0 @@-import { type ChatPluginPayload } from '@lobechat/types';-import { Block, Flexbox, Highlighter } from '@lobehub/ui';-import { Divider } from 'antd';-import { memo, useEffect, useMemo } from 'react';--import PluginRender from '@/features/PluginsUI/Render';--import Arguments from './Arguments';--interface CustomRenderProps {- content: string;- /**- * The real message ID (tool message ID)- */- messageId?: string;- plugin?: ChatPluginPayload;- pluginState?: any;- requestArgs?: string;- setShowPluginRender: (value: boolean) => void;- showPluginRender: boolean;- /**- * The tool call ID from the assistant message- */- toolCallId: string;-}--/**- * Custom Render for Group Messages- *- * Group messages are already completed, so:- * - No loading state needed- * - No edit/re-run functionality- * - Results are directly available in content prop- */-const CustomRender = memo<CustomRenderProps>(- ({- toolCallId,- messageId,- content,- pluginState,- plugin,- requestArgs,- showPluginRender,- setShowPluginRender,- }) => {- // Determine if plugin UI should be shown based on plugin type- useEffect(() => {- if (!plugin?.type) return;- setShowPluginRender(plugin.type !== 'default');- }, [plugin?.type, setShowPluginRender]);-- // Parse and display result content- const { data, language } = useMemo(() => {- try {- const parsed = JSON.parse(content || '');- // If parsed result is a string, return it directly- if (typeof parsed === 'string') {- return { data: parsed, language: 'plaintext' };- }- return { data: JSON.stringify(parsed, null, 2), language: 'json' };- } catch {- return { data: content || '', language: 'plaintext' };- }- }, [content]);-- // Show plugin custom UI if applicable- if (showPluginRender) {- return (- <Flexbox gap={12} id={toolCallId} width={'100%'}>- <PluginRender- arguments={plugin?.arguments}- content={content}- identifier={plugin?.identifier}- loading={false}- messageId={messageId}- payload={plugin}- pluginState={pluginState}- toolCallId={toolCallId}- type={plugin?.type}- />- </Flexbox>- );- }-- // Default render: show arguments and result- return (- <Block id={toolCallId} variant={'outlined'} width={'100%'}>- <Arguments arguments={requestArgs} />- {content && (- <>- <Divider dashed style={{ marginBlock: 0 }} />- <Highlighter- language={language}- style={{- background: 'transparent',- borderRadius: 0,- maxHeight: 300,- overflow: 'auto',- }}- variant={'filled'}- >- {data}- </Highlighter>- </>- )}- </Block>- );- },-);--CustomRender.displayName = 'GroupCustomRender';--export default CustomRender;diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsxindex f744e693da0..413e5616f07 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx@@ -21,7 +21,7 @@ const Debug = dynamic(() => import('./Debug'), {ssr: false,});-const Render = dynamic(() => import('./Render'), {+const Detail = dynamic(() => import('./Detail'), {loading: () => <Skeleton.Block active height={120} width={'100%'} />,ssr: false,});@@ -57,7 +57,9 @@ const Tool = memo<GroupToolProps>(toolSelectors.getRenderDisplayControl(identifier, apiName),);const [showDebug, setShowDebug] = useState(false);- const [showPluginRender, setShowPluginRender] = useState(false);+ const [showToolRender, setShowToolRender] = useState(false);+ // Controls switching between custom render and fallback ArgumentRender+ const [showCustomToolRender, setShowCustomToolRender] = useState(true);const isPending = intervention?.status === 'pending';const isReject = intervention?.status === 'rejected';@@ -65,8 +67,6 @@ const Tool = memo<GroupToolProps>(const needExpand = renderDisplayControl !== 'collapsed' || isPending;const isAlwaysExpand = renderDisplayControl === 'alwaysExpand';- const showCustomPluginRender = !isPending && !isReject && !isAbort;-let isArgumentsStreaming = false;try {JSON.parse(requestArgs || '{}');@@ -88,14 +88,16 @@ const Tool = memo<GroupToolProps>(const isToolCalling = isToolCallingFromOperation || isToolCallingFallback;const hasCustomRender = !!getBuiltinRender(identifier, apiName);+ // Only allow toggle when has custom render and not in pending/reject/abort state+ const canToggleCustomToolRender = hasCustomRender && !isPending && !isReject && !isAbort;- // Handle expand state changes with showPluginRender+ // Handle expand state changesconst handleExpand = (expand?: boolean) => {// Block collapse action when alwaysExpand is setif (isAlwaysExpand && expand === false) {return;}- setShowPluginRender(!!expand);+ setShowToolRender(!!expand);};useEffect(() => {@@ -104,27 +106,26 @@ const Tool = memo<GroupToolProps>(}}, [needExpand]);- const isToolRenderExpand = forceShowStreamingRender || showPluginRender;+ const isToolDetailExpand = forceShowStreamingRender || showToolRender || showDebug;+return (<AccordionItemaction={!disableEditing && (<ActionsassistantMessageId={assistantMessageId}- handleExpand={handleExpand}+ canToggleCustomToolRender={canToggleCustomToolRender}identifier={identifier}+ setShowCustomToolRender={setShowCustomToolRender}setShowDebug={setShowDebug}- setShowPluginRender={setShowPluginRender}- showCustomPluginRender={showCustomPluginRender}+ showCustomToolRender={showCustomToolRender}showDebug={showDebug}- showPluginRender={showPluginRender}/>)}- allowExpand={hasCustomRender}- expand={isToolRenderExpand}+ expand={isToolDetailExpand}itemKey={id}- onExpandChange={setShowPluginRender}+ onExpandChange={handleExpand}paddingBlock={4}paddingInline={4}title={@@ -151,7 +152,7 @@ const Tool = memo<GroupToolProps>(/>)}<ToolErrorBoundary apiName={apiName} identifier={identifier}>- <Render+ <DetailapiName={apiName}arguments={requestArgs}disableEditing={disableEditing}@@ -161,8 +162,7 @@ const Tool = memo<GroupToolProps>(isToolCalling={isToolCalling}messageId={assistantMessageId}result={result}- setShowPluginRender={setShowPluginRender}- showPluginRender={showPluginRender}+ showCustomToolRender={showCustomToolRender}toolCallId={id}toolMessageId={toolMessageId}type={type}diff --git a/src/features/Conversation/Messages/Tool/Tool/Render.tsx b/src/features/Conversation/Messages/Tool/Tool/Render.tsxdeleted file mode 100644index 496da78d1aa..00000000000--- a/src/features/Conversation/Messages/Tool/Tool/Render.tsx+++ /dev/null@@ -1,47 +0,0 @@-import { Suspense, memo } from 'react';--import { dataSelectors, messageStateSelectors, useConversationStore } from '../../../store';-import CustomRender from '../../AssistantGroup/Tool/Render/CustomRender';-import ErrorResponse from '../../AssistantGroup/Tool/Render/ErrorResponse';--interface RenderProps {- messageId: string;- requestArgs?: string;- setShowPluginRender: (show: boolean) => void;- showPluginRender: boolean;- toolCallId: string;- toolIndex: number;-}--const Render = memo<RenderProps>(- ({ toolCallId, toolIndex, messageId, requestArgs, showPluginRender, setShowPluginRender }) => {- const loading = useConversationStore(- messageStateSelectors.isToolCallStreaming(messageId, toolIndex),- );- const toolMessage = useConversationStore(dataSelectors.getDbMessageByToolCallId(toolCallId));-- if (loading || !toolMessage) return null;-- if (!!toolMessage) {- if (toolMessage.error) {- return <ErrorResponse {...toolMessage.error} id={messageId} plugin={toolMessage.plugin} />;- }-- return (- <Suspense>- <CustomRender- {...toolMessage}- requestArgs={requestArgs}- setShowPluginRender={setShowPluginRender}- showPluginRender={showPluginRender}- toolCallId={toolCallId}- />- </Suspense>- );- }- },-);--Render.displayName = 'ToolRender';--export default Render;diff --git a/src/features/Conversation/Messages/Tool/Tool/index.tsx b/src/features/Conversation/Messages/Tool/Tool/index.tsxindex 0c1c6595d7c..e9418edaeba 100644--- a/src/features/Conversation/Messages/Tool/Tool/index.tsx+++ b/src/features/Conversation/Messages/Tool/Tool/index.tsx@@ -3,6 +3,7 @@ import { type CSSProperties, memo, useState } from 'react';import Actions from '@/features/Conversation/Messages/AssistantGroup/Tool/Actions';import dynamic from '@/libs/next/dynamic';+import { getBuiltinRender } from '@/tools/renders';import { dataSelectors, messageStateSelectors, useConversationStore } from '../../../store';import Inspectors from '../../AssistantGroup/Tool/Inspector';@@ -12,7 +13,7 @@ const Debug = dynamic(() => import('../../AssistantGroup/Tool/Debug'), {ssr: false,});-const Render = dynamic(() => import('../../AssistantGroup/Tool/Render'), {+const Detail = dynamic(() => import('../../AssistantGroup/Tool/Detail'), {loading: () => <Skeleton.Block active height={120} width={'100%'} />,ssr: false,});@@ -44,7 +45,7 @@ const Tool = memo<InspectorProps>(type,}) => {const [showDebug, setShowDebug] = useState(false);- const [showPluginRender, setShowPluginRender] = useState(false);+ const [showCustomToolRender, setShowCustomToolRender] = useState(true);const [expand, setExpand] = useState(true);// Fetch tool message from store@@ -68,6 +69,8 @@ const Tool = memo<InspectorProps>(// Don't render if still loading and no message yetif (loading && !toolMessage) return null;+ const hasCustomRender = !!getBuiltinRender(identifier, apiName);+return (<AccordionexpandedKeys={expand ? ['tool'] : []}@@ -79,13 +82,12 @@ const Tool = memo<InspectorProps>(!disableEditing && (<ActionsassistantMessageId={messageId}- handleExpand={(expand) => setExpand(!!expand)}+ canToggleCustomToolRender={hasCustomRender}identifier={identifier}+ setShowCustomToolRender={setShowCustomToolRender}setShowDebug={setShowDebug}- setShowPluginRender={setShowPluginRender}- showCustomPluginRender={false}+ showCustomToolRender={showCustomToolRender}showDebug={showDebug}- showPluginRender={showPluginRender}/>)}@@ -105,15 +107,14 @@ const Tool = memo<InspectorProps>(type={type}/>)}- <Render+ <DetailapiName={apiName}arguments={requestArgs}disableEditing={disableEditing}identifier={identifier}messageId={messageId}result={result}- setShowPluginRender={setShowPluginRender}- showPluginRender={showPluginRender}+ showCustomToolRender={showCustomToolRender}toolCallId={toolCallId}type={type}/>diff --git a/src/features/PluginsUI/Render/MCPType/index.tsx b/src/features/PluginsUI/Render/MCPType/index.tsxindex 59697f2b280..164e070ca1a 100644--- a/src/features/PluginsUI/Render/MCPType/index.tsx+++ b/src/features/PluginsUI/Render/MCPType/index.tsx@@ -1,7 +1,7 @@import { Flexbox, Image, Markdown } from '@lobehub/ui';import { memo } from 'react';-import Arguments from '@/features/Conversation/Messages/AssistantGroup/Tool/Render/Arguments';+import Arguments from '@/features/Conversation/Messages/AssistantGroup/Tool/Detail/Arguments';import { type ToolCallResult } from '@/libs/mcp';export interface MCPTypeProps {diff --git a/src/locales/default/plugin.ts b/src/locales/default/plugin.tsindex 4eb61abb823..36c81604090 100644--- a/src/locales/default/plugin.ts+++ b/src/locales/default/plugin.ts@@ -174,6 +174,7 @@ export default {'builtins.lobe-user-memory.apiName.removeIdentityMemory': 'Delete identity memory','builtins.lobe-user-memory.apiName.searchUserMemory': 'Search memory','builtins.lobe-user-memory.apiName.updateIdentityMemory': 'Update identity memory',+ 'builtins.lobe-user-memory.inspector.noResults': 'No results','builtins.lobe-user-memory.title': 'Memory','builtins.lobe-web-browsing.apiName.crawlMultiPages': 'Read multiple pages','builtins.lobe-web-browsing.apiName.crawlSinglePage': 'Read page content',diff --git a/src/tools/inspectors.ts b/src/tools/inspectors.tsindex 126bfaf4913..b4947fcf6d3 100644--- a/src/tools/inspectors.ts+++ b/src/tools/inspectors.ts@@ -23,6 +23,7 @@ import {LocalSystemInspectors,LocalSystemManifest,} from '@lobechat/builtin-tool-local-system/client';+import { MemoryInspectors, MemoryManifest } from '@lobechat/builtin-tool-memory/client';import { NotebookInspectors, NotebookManifest } from '@lobechat/builtin-tool-notebook/client';import { PageAgentInspectors, PageAgentManifest } from '@lobechat/builtin-tool-page-agent/client';import {@@ -52,6 +53,7 @@ const BuiltinToolInspectors: Record<string, Record<string, BuiltinInspector>> =[GTDManifest.identifier]: GTDInspectors as Record<string, BuiltinInspector>,[KnowledgeBaseManifest.identifier]: KnowledgeBaseInspectors as Record<string, BuiltinInspector>,[LocalSystemManifest.identifier]: LocalSystemInspectors as Record<string, BuiltinInspector>,+ [MemoryManifest.identifier]: MemoryInspectors as Record<string, BuiltinInspector>,[NotebookManifest.identifier]: NotebookInspectors as Record<string, BuiltinInspector>,[PageAgentManifest.identifier]: PageAgentInspectors as Record<string, BuiltinInspector>,[WebBrowsingManifest.identifier]: WebBrowsingInspectors as Record<string, BuiltinInspector>,diff --git a/src/tools/interventions.ts b/src/tools/interventions.tsindex 16160a72347..959b2651687 100644--- a/src/tools/interventions.ts+++ b/src/tools/interventions.ts@@ -13,6 +13,7 @@ import {LocalSystemIdentifier,LocalSystemInterventions,} from '@lobechat/builtin-tool-local-system/client';+import { MemoryInterventions, MemoryManifest } from '@lobechat/builtin-tool-memory/client';import { NotebookManifest } from '@lobechat/builtin-tool-notebook';import { NotebookInterventions } from '@lobechat/builtin-tool-notebook/client';import { type BuiltinIntervention } from '@lobechat/types';@@ -28,6 +29,7 @@ export const BuiltinToolInterventions: Record<string, Record<string, any>> = {[GroupManagementManifest.identifier]: GroupManagementInterventions,[GTDManifest.identifier]: GTDInterventions,[LocalSystemIdentifier]: LocalSystemInterventions,+ [MemoryManifest.identifier]: MemoryInterventions,[NotebookManifest.identifier]: NotebookInterventions,};diff --git a/src/tools/renders.ts b/src/tools/renders.tsindex 4587530375b..782875c94ef 100644--- a/src/tools/renders.ts+++ b/src/tools/renders.ts@@ -15,6 +15,7 @@ import {LocalSystemManifest,LocalSystemRenders,} from '@lobechat/builtin-tool-local-system/client';+import { MemoryManifest, MemoryRenders } from '@lobechat/builtin-tool-memory/client';import { NotebookManifest, NotebookRenders } from '@lobechat/builtin-tool-notebook/client';import {WebBrowsingManifest,@@ -32,9 +33,10 @@ const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {[GroupAgentBuilderManifest.identifier]: GroupAgentBuilderRenders as Record<string, BuiltinRender>,[GroupManagementManifest.identifier]: GroupManagementRenders as Record<string, BuiltinRender>,[GTDManifest.identifier]: GTDRenders as Record<string, BuiltinRender>,- [NotebookManifest.identifier]: NotebookRenders as Record<string, BuiltinRender>,[KnowledgeBaseManifest.identifier]: KnowledgeBaseRenders as Record<string, BuiltinRender>,[LocalSystemManifest.identifier]: LocalSystemRenders as Record<string, BuiltinRender>,+ [MemoryManifest.identifier]: MemoryRenders as Record<string, BuiltinRender>,+ [NotebookManifest.identifier]: NotebookRenders as Record<string, BuiltinRender>,[WebBrowsingManifest.identifier]: WebBrowsingRenders as Record<string, BuiltinRender>,};diff --git a/src/tools/streamings.ts b/src/tools/streamings.tsindex ec0eecc6f56..0a7b7d7ba09 100644--- a/src/tools/streamings.ts+++ b/src/tools/streamings.ts@@ -15,6 +15,7 @@ import {LocalSystemManifest,LocalSystemStreamings,} from '@lobechat/builtin-tool-local-system/client';+import { MemoryManifest, MemoryStreamings } from '@lobechat/builtin-tool-memory/client';import { NotebookManifest, NotebookStreamings } from '@lobechat/builtin-tool-notebook/client';import { type BuiltinStreaming } from '@lobechat/types';@@ -38,6 +39,7 @@ const BuiltinToolStreamings: Record<string, Record<string, BuiltinStreaming>> =>,[GTDManifest.identifier]: GTDStreamings as Record<string, BuiltinStreaming>,[LocalSystemManifest.identifier]: LocalSystemStreamings as Record<string, BuiltinStreaming>,+ [MemoryManifest.identifier]: MemoryStreamings as Record<string, BuiltinStreaming>,[NotebookManifest.identifier]: NotebookStreamings as Record<string, BuiltinStreaming>,};