@lobehub/lobehub 2.0.0-next.294 → 2.0.0-next.296
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/apps/desktop/src/main/__mocks__/node-mac-permissions.ts +0 -1
- package/apps/desktop/src/main/__mocks__/setup.ts +0 -1
- package/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts +1 -4
- package/apps/desktop/tsconfig.json +4 -10
- package/changelog/v1.json +18 -0
- package/e2e/scripts/setup.ts +45 -32
- package/locales/en-US/plugin.json +4 -0
- package/locales/zh-CN/plugin.json +4 -0
- package/package.json +1 -1
- package/packages/agent-runtime/src/core/__tests__/runtime.test.ts +5 -5
- package/packages/agent-runtime/src/utils/stepContextComputer.test.ts +5 -5
- package/packages/builtin-tool-gtd/src/client/Inspector/index.ts +0 -4
- package/packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx +1 -1
- package/packages/builtin-tool-gtd/src/client/Render/TodoList/index.tsx +39 -10
- package/packages/builtin-tool-gtd/src/client/Render/index.ts +0 -2
- package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx +26 -12
- package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/actions.ts +5 -5
- package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/store.test.ts +14 -8
- package/packages/builtin-tool-gtd/src/executor/index.test.ts +48 -227
- package/packages/builtin-tool-gtd/src/executor/index.ts +15 -158
- package/packages/builtin-tool-gtd/src/manifest.ts +12 -42
- package/packages/builtin-tool-gtd/src/systemRole.ts +14 -8
- package/packages/builtin-tool-gtd/src/types.ts +47 -41
- package/packages/builtin-tool-memory/package.json +8 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddContextMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddExperienceMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddIdentityMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddPreferenceMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/RemoveIdentityMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/SearchUserMemory/index.tsx +67 -0
- package/packages/builtin-tool-memory/src/client/Inspector/UpdateIdentityMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/index.ts +35 -0
- package/packages/builtin-tool-memory/src/client/Intervention/AddExperienceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Intervention/index.ts +13 -0
- package/packages/builtin-tool-memory/src/client/Render/AddExperienceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Render/SearchUserMemory/index.tsx +217 -0
- package/packages/builtin-tool-memory/src/client/Render/index.ts +15 -0
- package/packages/builtin-tool-memory/src/client/Streaming/AddExperienceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Streaming/index.ts +18 -0
- package/packages/builtin-tool-memory/src/client/components/ExperienceMemoryCard.tsx +231 -0
- package/packages/builtin-tool-memory/src/client/components/index.ts +1 -0
- package/packages/builtin-tool-memory/src/client/index.ts +27 -0
- package/packages/builtin-tool-memory/src/executor/index.ts +9 -1
- package/packages/builtin-tool-memory/src/types.ts +61 -0
- package/packages/context-engine/src/providers/GTDTodoInjector.ts +15 -7
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistantGroup/tools-with-branches.json +4 -0
- package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +1 -0
- package/packages/database/src/models/__tests__/knowledgeBase.test.ts +1 -1
- package/packages/database/src/repositories/knowledge/index.ts +1 -4
- package/packages/prompts/src/prompts/gtd/index.test.ts +32 -16
- package/packages/prompts/src/prompts/gtd/index.ts +9 -5
- package/packages/types/src/discover/assistants.ts +2 -2
- package/packages/types/src/stepContext.ts +4 -1
- package/scripts/migrate-spa-navigation.ts +129 -0
- package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/route.ts +112 -109
- package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-user-topics/route.ts +125 -113
- package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-users/route.ts +74 -65
- package/src/app/[variants]/(auth)/auth-error/page.tsx +1 -1
- package/src/app/[variants]/(auth)/login/[[...login]]/page.tsx +1 -1
- package/src/app/[variants]/(auth)/next-auth/error/AuthErrorPage.tsx +1 -1
- package/src/app/[variants]/(auth)/next-auth/signin/AuthSignInBox.tsx +1 -1
- package/src/app/[variants]/(auth)/oauth/callback/error/page.tsx +1 -1
- package/src/app/[variants]/(auth)/oauth/callback/success/page.tsx +1 -1
- package/src/app/[variants]/(auth)/oauth/consent/[uid]/page.tsx +1 -1
- package/src/app/[variants]/(auth)/reset-password/layout.tsx +1 -1
- package/src/app/[variants]/(auth)/reset-password/page.tsx +2 -2
- package/src/app/[variants]/(auth)/signin/layout.tsx +1 -1
- package/src/app/[variants]/(auth)/signin/useSignIn.ts +1 -1
- package/src/app/[variants]/(auth)/signup/[[...signup]]/BetterAuthSignUpForm.tsx +2 -2
- package/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx +1 -1
- package/src/app/[variants]/(auth)/signup/[[...signup]]/useSignUp.tsx +1 -1
- package/src/app/[variants]/(auth)/verify-email/layout.tsx +1 -1
- package/src/app/[variants]/(auth)/verify-email/page.tsx +2 -2
- package/src/app/[variants]/(main)/_layout/index.tsx +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/CronTopicGroup.tsx +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/AddTopicButon.tsx +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/AllTopicsDrawer/index.tsx +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/hooks/useThreadNavigation.ts +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/hooks/useTopicNavigation.ts +1 -1
- package/src/app/[variants]/(main)/agent/features/TelemetryNotification.tsx +2 -3
- package/src/app/[variants]/(main)/community/(detail)/assistant/features/Details/Nav.tsx +9 -9
- package/src/app/[variants]/(main)/community/(detail)/assistant/features/Details/Versions/index.tsx +2 -3
- package/src/app/[variants]/(main)/community/(detail)/features/MakedownRender.tsx +1 -2
- package/src/app/[variants]/(main)/community/(detail)/features/ShareButton.tsx +2 -3
- package/src/app/[variants]/(main)/community/(detail)/features/Toc/Heading.tsx +2 -3
- package/src/app/[variants]/(main)/community/(detail)/mcp/features/Details/Versions/index.tsx +2 -2
- package/src/app/[variants]/(main)/community/(detail)/model/features/Details/Nav.tsx +12 -11
- package/src/app/[variants]/(main)/community/(detail)/model/features/Details/Parameter/ParameterItem.tsx +2 -3
- package/src/app/[variants]/(main)/community/(detail)/provider/features/Details/Nav.tsx +11 -10
- package/src/app/[variants]/(main)/community/(detail)/provider/features/Header.tsx +10 -9
- package/src/app/[variants]/(main)/community/(list)/(home)/index.tsx +1 -1
- package/src/app/[variants]/(main)/community/(list)/assistant/features/Category/useCategory.tsx +1 -1
- package/src/app/[variants]/(main)/community/(list)/features/SortButton/index.tsx +2 -3
- package/src/app/[variants]/(main)/community/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/community/features/CreateButton/Inner.tsx +1 -1
- package/src/app/[variants]/(main)/community/features/CreateButton/index.tsx +1 -1
- package/src/app/[variants]/(main)/community/features/Search.tsx +1 -2
- package/src/app/[variants]/(main)/community/features/Title.tsx +5 -5
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/AllTopicsDrawer/index.tsx +1 -1
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/hooks/useThreadNavigation.ts +1 -1
- package/src/app/[variants]/(main)/group/features/Conversation/Header/ShareButton/index.tsx +1 -1
- package/src/app/[variants]/(main)/group/features/TelemetryNotification.tsx +2 -3
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/AllAgentsDrawer/index.tsx +1 -1
- package/src/app/[variants]/(main)/hooks/useActiveTabKey.ts +6 -11
- package/src/app/[variants]/(main)/image/NotSupportClient.tsx +4 -3
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ImageUpload.tsx +1 -1
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/ImageManageModal.tsx +1 -1
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx +1 -1
- package/src/app/[variants]/(main)/memory/(home)/features/RoleTagCloud/index.tsx +1 -1
- package/src/app/[variants]/(main)/memory/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/memory/features/SourceLink.tsx +1 -1
- package/src/app/[variants]/(main)/page/_layout/Body/AllPagesDrawer/index.tsx +1 -1
- package/src/app/[variants]/(main)/resource/features/DndContextWrapper.tsx +4 -2
- package/src/app/[variants]/(main)/resource/library/_layout/Header/LibraryHead.tsx +30 -35
- package/src/app/[variants]/(main)/resource/library/_layout/Header/index.tsx +9 -11
- package/src/app/[variants]/(main)/settings/about/features/ItemCard.tsx +2 -3
- package/src/app/[variants]/(main)/settings/about/features/ItemLink.tsx +2 -3
- package/src/app/[variants]/(main)/settings/about/features/Version.tsx +6 -7
- package/src/app/[variants]/(main)/settings/features/SettingsContent.tsx +1 -1
- package/src/app/[variants]/(main)/settings/features/UpgradeAlert.tsx +4 -4
- package/src/app/[variants]/(main)/settings/provider/(list)/Footer.tsx +2 -2
- package/src/app/[variants]/(main)/settings/provider/detail/index.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/detail/ollama/CheckError.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx +12 -6
- package/src/app/[variants]/(main)/settings/security/index.tsx +1 -1
- package/src/app/[variants]/(main)/settings/stats/features/overview/ShareButton/ShareModal.tsx +1 -1
- package/src/app/[variants]/(main)/settings/stats/features/rankings/AssistantsRank.tsx +1 -1
- package/src/app/[variants]/(main)/settings/stats/features/rankings/TopicsRank.tsx +1 -1
- package/src/app/[variants]/(mobile)/_layout/index.tsx +1 -1
- package/src/app/[variants]/(mobile)/chat/settings/features/AgentInfoDescription/index.tsx +1 -1
- package/src/app/[variants]/(mobile)/chat/settings/features/SettingButton.tsx +1 -1
- package/src/app/[variants]/(mobile)/router/index.tsx +1 -1
- package/src/app/[variants]/page.tsx +1 -1
- package/src/app/[variants]/router/index.tsx +1 -1
- package/src/components/404/index.tsx +4 -4
- package/src/components/Analytics/index.tsx +1 -1
- package/src/components/BrandWatermark/index.tsx +4 -4
- package/src/components/Branding/ProductLogo/Custom.tsx +1 -1
- package/src/components/Error/index.tsx +3 -4
- package/src/components/GoBack/index.tsx +2 -2
- package/src/components/LabsModal/LabCard.tsx +1 -1
- package/src/components/Link.tsx +25 -5
- package/src/components/OllamaSetupGuide/index.tsx +5 -4
- package/src/components/WebFavicon/index.tsx +1 -1
- package/src/components/client/ClientResponsiveContent/index.tsx +1 -1
- package/src/components/client/ClientResponsiveLayout.tsx +1 -1
- package/src/components/mdx/Image.tsx +1 -1
- package/src/components/mdx/Link.tsx +26 -9
- package/src/features/AlertBanner/CloudBanner.tsx +2 -3
- package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +8 -7
- package/src/features/ChatInput/ActionBar/Params/Controls.tsx +1 -3
- package/src/features/ChatInput/ActionBar/Token/index.tsx +1 -1
- package/src/features/ChatInput/Mobile/index.tsx +1 -1
- package/src/features/Conversation/ChatItem/components/MessageContent/index.tsx +1 -1
- package/src/features/Conversation/Error/OllamaBizError/index.tsx +1 -1
- package/src/features/Conversation/Error/OllamaSetupGuide/Desktop.tsx +1 -2
- package/src/features/Conversation/Error/index.tsx +1 -1
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/Settings.tsx +1 -1
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/index.tsx +11 -17
- package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/LoadingPlaceholder/index.tsx +13 -3
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/CustomRender.tsx +43 -0
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/FallbacktArgumentRender.tsx +59 -0
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/index.tsx +46 -0
- package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/index.tsx +13 -19
- package/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx +18 -18
- package/src/features/Conversation/Messages/AssistantGroup/index.tsx +1 -1
- package/src/features/Conversation/Messages/Tool/Tool/index.tsx +11 -10
- package/src/features/Conversation/Messages/components/SearchGrounding.tsx +1 -1
- package/src/features/Conversation/TodoProgress/index.tsx +56 -23
- package/src/features/DataImporter/Error.tsx +3 -3
- package/src/features/DevPanel/CacheViewer/cacheProvider.tsx +2 -1
- package/src/features/DevPanel/MetadataViewer/Og.tsx +1 -1
- package/src/features/DevPanel/features/FloatPanel.tsx +1 -1
- package/src/features/DevPanel/features/Table/TooltipContent.tsx +3 -4
- package/src/features/DevPanel/index.tsx +1 -1
- package/src/features/EditorCanvas/InlineToolbar.tsx +1 -6
- package/src/features/FileViewer/NotSupport/index.tsx +2 -3
- package/src/features/Follow/index.tsx +8 -9
- package/src/features/LibraryModal/AddFilesToKnowledgeBase/SelectForm.tsx +2 -2
- package/src/features/MCP/Scores.tsx +1 -1
- package/src/features/MCPPluginDetail/Nav.tsx +8 -8
- package/src/features/MCPPluginDetail/Overview/TagList.tsx +1 -1
- package/src/features/MobileTabBar/index.tsx +2 -1
- package/src/features/OllamaSetupGuide/Desktop.tsx +1 -2
- package/src/features/PWAInstall/Install.tsx +1 -1
- package/src/features/PWAInstall/index.tsx +1 -1
- package/src/features/PluginStore/McpList/index.tsx +1 -1
- package/src/features/PluginStore/PluginList/Detail/Header.tsx +6 -6
- package/src/features/PluginsUI/Render/DefaultType/index.tsx +1 -1
- package/src/features/PluginsUI/Render/MCPType/index.tsx +1 -1
- package/src/features/Portal/Artifacts/Body/Renderer/index.tsx +1 -1
- package/src/features/ResourceManager/components/ChunkDrawer/index.tsx +1 -1
- package/src/features/ResourceManager/components/Explorer/Header/index.tsx +57 -4
- package/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx +6 -4
- package/src/features/ResourceManager/components/Explorer/ListView/Skeleton.tsx +26 -26
- package/src/features/ResourceManager/components/Explorer/ListView/index.tsx +16 -5
- package/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx +147 -149
- package/src/features/ResourceManager/components/LibraryHierarchy/styles.ts +5 -4
- package/src/features/ResourceManager/index.tsx +1 -1
- package/src/features/Setting/Footer.tsx +4 -5
- package/src/features/User/UserPanel/PanelContent.tsx +1 -1
- package/src/hooks/useActiveTabKey.ts +6 -4
- package/src/hooks/useIsSingleMode.test.ts +10 -24
- package/src/hooks/useIsSingleMode.ts +4 -2
- package/src/hooks/useIsSubSlug.ts +2 -1
- package/src/hooks/useQuery.ts +5 -5
- package/src/layout/GlobalProvider/AppTheme.tsx +2 -2
- package/src/layout/GlobalProvider/StyleRegistry.tsx +1 -1
- package/src/layout/GlobalProvider/useUserStateRedirect.ts +13 -25
- package/src/libs/next/Image.tsx +13 -0
- package/src/libs/next/Link.tsx +13 -0
- package/src/libs/next/dynamic.tsx +13 -0
- package/src/libs/next/index.ts +22 -0
- package/src/libs/next/navigation.ts +22 -0
- package/src/libs/router/Link.tsx +30 -0
- package/src/libs/router/index.ts +18 -0
- package/src/libs/router/navigation.ts +72 -0
- package/src/locales/default/plugin.ts +1 -0
- package/src/server/modules/AgentRuntime/AgentStateManager.ts +5 -1
- package/src/store/chat/slices/message/selectors/dbMessage.test.ts +11 -11
- package/src/store/chat/slices/portal/selectors.test.ts +5 -15
- package/src/store/file/slices/resource/action.ts +4 -2
- package/src/store/page/index.ts +1 -1
- package/src/store/page/slices/crud/index.ts +1 -1
- package/src/tools/inspectors.ts +2 -0
- package/src/tools/interventions.ts +2 -0
- package/src/tools/renders.ts +3 -1
- package/src/tools/streamings.ts +2 -0
- package/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx +0 -52
- package/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx +0 -52
- package/src/app/[variants]/(main)/hooks/usePathname.ts +0 -10
- package/src/app/[variants]/(main)/hooks/useQuery.ts +0 -12
- package/src/app/[variants]/(main)/hooks/useRouter.ts +0 -22
- package/src/app/[variants]/(main)/hooks/useSearchParams.ts +0 -11
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Render/CustomRender.tsx +0 -113
- package/src/features/Conversation/Messages/Tool/Tool/Render.tsx +0 -47
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/AbortResponse.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Arguments/index.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/ErrorResponse.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/ApprovalActions.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/Fallback.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/KeyValueEditor.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/ModeSelector.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/index.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/PluginSettings.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/RejectedResponse.tsx +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
5
|
+
import { Check } from 'lucide-react';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { AddIdentityMemoryParams, AddIdentityMemoryState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
14
|
+
statusIcon: css`
|
|
15
|
+
margin-block-end: -2px;
|
|
16
|
+
margin-inline-start: 4px;
|
|
17
|
+
`,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export const AddIdentityMemoryInspector = memo<
|
|
21
|
+
BuiltinInspectorProps<AddIdentityMemoryParams, AddIdentityMemoryState>
|
|
22
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
23
|
+
const { t } = useTranslation('plugin');
|
|
24
|
+
|
|
25
|
+
const title = args?.title || partialArgs?.title;
|
|
26
|
+
|
|
27
|
+
// Initial streaming state
|
|
28
|
+
if (isArgumentsStreaming && !title) {
|
|
29
|
+
return (
|
|
30
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
31
|
+
<span>{t('builtins.lobe-user-memory.apiName.addIdentityMemory')}</span>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const isSuccess = pluginState?.memoryId;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
className={cx(
|
|
41
|
+
inspectorTextStyles.root,
|
|
42
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
<span>{t('builtins.lobe-user-memory.apiName.addIdentityMemory')}</span>
|
|
46
|
+
{title && (
|
|
47
|
+
<>
|
|
48
|
+
: <span className={highlightTextStyles.primary}>{title}</span>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
{!isLoading && isSuccess && (
|
|
52
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
AddIdentityMemoryInspector.displayName = 'AddIdentityMemoryInspector';
|
|
59
|
+
|
|
60
|
+
export default AddIdentityMemoryInspector;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
5
|
+
import { Check } from 'lucide-react';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { AddPreferenceMemoryParams, AddPreferenceMemoryState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
14
|
+
statusIcon: css`
|
|
15
|
+
margin-block-end: -2px;
|
|
16
|
+
margin-inline-start: 4px;
|
|
17
|
+
`,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export const AddPreferenceMemoryInspector = memo<
|
|
21
|
+
BuiltinInspectorProps<AddPreferenceMemoryParams, AddPreferenceMemoryState>
|
|
22
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
23
|
+
const { t } = useTranslation('plugin');
|
|
24
|
+
|
|
25
|
+
const title = args?.title || partialArgs?.title;
|
|
26
|
+
|
|
27
|
+
// Initial streaming state
|
|
28
|
+
if (isArgumentsStreaming && !title) {
|
|
29
|
+
return (
|
|
30
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
31
|
+
<span>{t('builtins.lobe-user-memory.apiName.addPreferenceMemory')}</span>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const isSuccess = pluginState?.memoryId;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
className={cx(
|
|
41
|
+
inspectorTextStyles.root,
|
|
42
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
<span>{t('builtins.lobe-user-memory.apiName.addPreferenceMemory')}</span>
|
|
46
|
+
{title && (
|
|
47
|
+
<>
|
|
48
|
+
: <span className={highlightTextStyles.primary}>{title}</span>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
{!isLoading && isSuccess && (
|
|
52
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
AddPreferenceMemoryInspector.displayName = 'AddPreferenceMemoryInspector';
|
|
59
|
+
|
|
60
|
+
export default AddPreferenceMemoryInspector;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
5
|
+
import { Check } from 'lucide-react';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { RemoveIdentityMemoryParams, RemoveIdentityMemoryState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
14
|
+
statusIcon: css`
|
|
15
|
+
margin-block-end: -2px;
|
|
16
|
+
margin-inline-start: 4px;
|
|
17
|
+
`,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export const RemoveIdentityMemoryInspector = memo<
|
|
21
|
+
BuiltinInspectorProps<RemoveIdentityMemoryParams, RemoveIdentityMemoryState>
|
|
22
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
23
|
+
const { t } = useTranslation('plugin');
|
|
24
|
+
|
|
25
|
+
const id = args?.id || partialArgs?.id;
|
|
26
|
+
|
|
27
|
+
// Initial streaming state
|
|
28
|
+
if (isArgumentsStreaming && !id) {
|
|
29
|
+
return (
|
|
30
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
31
|
+
<span>{t('builtins.lobe-user-memory.apiName.removeIdentityMemory')}</span>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const isSuccess = pluginState?.identityId;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
className={cx(
|
|
41
|
+
inspectorTextStyles.root,
|
|
42
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
<span>{t('builtins.lobe-user-memory.apiName.removeIdentityMemory')}</span>
|
|
46
|
+
{id && (
|
|
47
|
+
<>
|
|
48
|
+
: <span className={highlightTextStyles.warning}>{id}</span>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
{!isLoading && isSuccess && (
|
|
52
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
RemoveIdentityMemoryInspector.displayName = 'RemoveIdentityMemoryInspector';
|
|
59
|
+
|
|
60
|
+
export default RemoveIdentityMemoryInspector;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { Text } from '@lobehub/ui';
|
|
5
|
+
import { cssVar, cx } from 'antd-style';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { SearchMemoryParams, SearchUserMemoryState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
export const SearchUserMemoryInspector = memo<
|
|
14
|
+
BuiltinInspectorProps<SearchMemoryParams, SearchUserMemoryState>
|
|
15
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
16
|
+
const { t } = useTranslation('plugin');
|
|
17
|
+
|
|
18
|
+
const query = args?.query || partialArgs?.query;
|
|
19
|
+
|
|
20
|
+
// Initial streaming state
|
|
21
|
+
if (isArgumentsStreaming && !query) {
|
|
22
|
+
return (
|
|
23
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
24
|
+
<span>{t('builtins.lobe-user-memory.apiName.searchUserMemory')}</span>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// pluginState is SearchMemoryResult directly (contexts, experiences, preferences)
|
|
30
|
+
const resultCount = pluginState
|
|
31
|
+
? (pluginState.contexts?.length ?? 0) +
|
|
32
|
+
(pluginState.experiences?.length ?? 0) +
|
|
33
|
+
(pluginState.preferences?.length ?? 0)
|
|
34
|
+
: 0;
|
|
35
|
+
const hasResults = resultCount > 0;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
className={cx(
|
|
40
|
+
inspectorTextStyles.root,
|
|
41
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
42
|
+
)}
|
|
43
|
+
>
|
|
44
|
+
<span>{t('builtins.lobe-user-memory.apiName.searchUserMemory')}: </span>
|
|
45
|
+
{query && <span className={highlightTextStyles.primary}>{query}</span>}
|
|
46
|
+
{!isLoading &&
|
|
47
|
+
!isArgumentsStreaming &&
|
|
48
|
+
pluginState &&
|
|
49
|
+
(hasResults ? (
|
|
50
|
+
<span style={{ marginInlineStart: 4 }}>({resultCount})</span>
|
|
51
|
+
) : (
|
|
52
|
+
<Text
|
|
53
|
+
as={'span'}
|
|
54
|
+
color={cssVar.colorTextDescription}
|
|
55
|
+
fontSize={12}
|
|
56
|
+
style={{ marginInlineStart: 4 }}
|
|
57
|
+
>
|
|
58
|
+
({t('builtins.lobe-user-memory.inspector.noResults')})
|
|
59
|
+
</Text>
|
|
60
|
+
))}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
SearchUserMemoryInspector.displayName = 'SearchUserMemoryInspector';
|
|
66
|
+
|
|
67
|
+
export default SearchUserMemoryInspector;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
5
|
+
import { Check } from 'lucide-react';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { UpdateIdentityMemoryParams, UpdateIdentityMemoryState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
14
|
+
statusIcon: css`
|
|
15
|
+
margin-block-end: -2px;
|
|
16
|
+
margin-inline-start: 4px;
|
|
17
|
+
`,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export const UpdateIdentityMemoryInspector = memo<
|
|
21
|
+
BuiltinInspectorProps<UpdateIdentityMemoryParams, UpdateIdentityMemoryState>
|
|
22
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
23
|
+
const { t } = useTranslation('plugin');
|
|
24
|
+
|
|
25
|
+
const id = args?.id || partialArgs?.id;
|
|
26
|
+
|
|
27
|
+
// Initial streaming state
|
|
28
|
+
if (isArgumentsStreaming && !id) {
|
|
29
|
+
return (
|
|
30
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
31
|
+
<span>{t('builtins.lobe-user-memory.apiName.updateIdentityMemory')}</span>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const isSuccess = pluginState?.identityId;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
className={cx(
|
|
41
|
+
inspectorTextStyles.root,
|
|
42
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
<span>{t('builtins.lobe-user-memory.apiName.updateIdentityMemory')}</span>
|
|
46
|
+
{id && (
|
|
47
|
+
<>
|
|
48
|
+
: <span className={highlightTextStyles.warning}>{id}</span>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
{!isLoading && isSuccess && (
|
|
52
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
UpdateIdentityMemoryInspector.displayName = 'UpdateIdentityMemoryInspector';
|
|
59
|
+
|
|
60
|
+
export default UpdateIdentityMemoryInspector;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type BuiltinInspector } from '@lobechat/types';
|
|
2
|
+
|
|
3
|
+
import { MemoryApiName } from '../../types';
|
|
4
|
+
import { AddContextMemoryInspector } from './AddContextMemory';
|
|
5
|
+
import { AddExperienceMemoryInspector } from './AddExperienceMemory';
|
|
6
|
+
import { AddIdentityMemoryInspector } from './AddIdentityMemory';
|
|
7
|
+
import { AddPreferenceMemoryInspector } from './AddPreferenceMemory';
|
|
8
|
+
import { RemoveIdentityMemoryInspector } from './RemoveIdentityMemory';
|
|
9
|
+
import { SearchUserMemoryInspector } from './SearchUserMemory';
|
|
10
|
+
import { UpdateIdentityMemoryInspector } from './UpdateIdentityMemory';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Memory Inspector Components Registry
|
|
14
|
+
*
|
|
15
|
+
* Inspector components customize the title/header area
|
|
16
|
+
* of tool calls in the conversation UI.
|
|
17
|
+
*/
|
|
18
|
+
export const MemoryInspectors: Record<string, BuiltinInspector> = {
|
|
19
|
+
[MemoryApiName.addContextMemory]: AddContextMemoryInspector as BuiltinInspector,
|
|
20
|
+
[MemoryApiName.addExperienceMemory]: AddExperienceMemoryInspector as BuiltinInspector,
|
|
21
|
+
[MemoryApiName.addIdentityMemory]: AddIdentityMemoryInspector as BuiltinInspector,
|
|
22
|
+
[MemoryApiName.addPreferenceMemory]: AddPreferenceMemoryInspector as BuiltinInspector,
|
|
23
|
+
[MemoryApiName.removeIdentityMemory]: RemoveIdentityMemoryInspector as BuiltinInspector,
|
|
24
|
+
[MemoryApiName.searchUserMemory]: SearchUserMemoryInspector as BuiltinInspector,
|
|
25
|
+
[MemoryApiName.updateIdentityMemory]: UpdateIdentityMemoryInspector as BuiltinInspector,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Re-export individual inspectors
|
|
29
|
+
export { AddContextMemoryInspector } from './AddContextMemory';
|
|
30
|
+
export { AddExperienceMemoryInspector } from './AddExperienceMemory';
|
|
31
|
+
export { AddIdentityMemoryInspector } from './AddIdentityMemory';
|
|
32
|
+
export { AddPreferenceMemoryInspector } from './AddPreferenceMemory';
|
|
33
|
+
export { RemoveIdentityMemoryInspector } from './RemoveIdentityMemory';
|
|
34
|
+
export { SearchUserMemoryInspector } from './SearchUserMemory';
|
|
35
|
+
export { UpdateIdentityMemoryInspector } from './UpdateIdentityMemory';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInterventionProps } from '@lobechat/types';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
|
|
6
|
+
import type { AddExperienceMemoryParams } from '../../../types';
|
|
7
|
+
import { ExperienceMemoryCard } from '../../components';
|
|
8
|
+
|
|
9
|
+
const AddExperienceMemoryIntervention = memo<BuiltinInterventionProps<AddExperienceMemoryParams>>(
|
|
10
|
+
({ args }) => {
|
|
11
|
+
return <ExperienceMemoryCard data={args} />;
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
AddExperienceMemoryIntervention.displayName = 'AddExperienceMemoryIntervention';
|
|
16
|
+
|
|
17
|
+
export default AddExperienceMemoryIntervention;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BuiltinIntervention } from '@lobechat/types';
|
|
2
|
+
|
|
3
|
+
import { MemoryApiName } from '../../types';
|
|
4
|
+
import AddExperienceMemoryIntervention from './AddExperienceMemory';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Memory Intervention Components Registry
|
|
8
|
+
*
|
|
9
|
+
* Intervention components display when human approval is required before tool execution.
|
|
10
|
+
*/
|
|
11
|
+
export const MemoryInterventions: Record<string, BuiltinIntervention> = {
|
|
12
|
+
[MemoryApiName.addExperienceMemory]: AddExperienceMemoryIntervention as BuiltinIntervention,
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinRenderProps } from '@lobechat/types';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
|
|
6
|
+
import type { AddExperienceMemoryParams, AddExperienceMemoryState } from '../../../types';
|
|
7
|
+
import { ExperienceMemoryCard } from '../../components';
|
|
8
|
+
|
|
9
|
+
const AddExperienceMemoryRender = memo<
|
|
10
|
+
BuiltinRenderProps<AddExperienceMemoryParams, AddExperienceMemoryState>
|
|
11
|
+
>(({ args }) => {
|
|
12
|
+
return <ExperienceMemoryCard data={args} />;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
AddExperienceMemoryRender.displayName = 'AddExperienceMemoryRender';
|
|
16
|
+
|
|
17
|
+
export default AddExperienceMemoryRender;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinRenderProps } from '@lobechat/types';
|
|
4
|
+
import { Accordion, AccordionItem, Flexbox, Tag, Text } from '@lobehub/ui';
|
|
5
|
+
import { createStaticStyles } from 'antd-style';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { highlightTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { SearchMemoryParams, SearchUserMemoryState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
14
|
+
container: css`
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
|
|
17
|
+
width: 100%;
|
|
18
|
+
border: 1px solid ${cssVar.colorBorderSecondary};
|
|
19
|
+
border-radius: 12px;
|
|
20
|
+
|
|
21
|
+
background: ${cssVar.colorBgContainer};
|
|
22
|
+
`,
|
|
23
|
+
empty: css`
|
|
24
|
+
padding: 24px;
|
|
25
|
+
color: ${cssVar.colorTextTertiary};
|
|
26
|
+
text-align: center;
|
|
27
|
+
`,
|
|
28
|
+
item: css`
|
|
29
|
+
padding-block: 10px;
|
|
30
|
+
padding-inline: 12px;
|
|
31
|
+
border-block-end: 1px dashed ${cssVar.colorBorderSecondary};
|
|
32
|
+
|
|
33
|
+
&:last-child {
|
|
34
|
+
border-block-end: none;
|
|
35
|
+
}
|
|
36
|
+
`,
|
|
37
|
+
itemContent: css`
|
|
38
|
+
font-size: 13px;
|
|
39
|
+
line-height: 1.5;
|
|
40
|
+
color: ${cssVar.colorTextSecondary};
|
|
41
|
+
`,
|
|
42
|
+
itemTitle: css`
|
|
43
|
+
font-size: 14px;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
color: ${cssVar.colorText};
|
|
46
|
+
`,
|
|
47
|
+
sectionHeader: css`
|
|
48
|
+
font-size: 12px;
|
|
49
|
+
font-weight: 500;
|
|
50
|
+
`,
|
|
51
|
+
tags: css`
|
|
52
|
+
padding-block-start: 6px;
|
|
53
|
+
`,
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
interface MemoryItemProps {
|
|
57
|
+
content?: string | null;
|
|
58
|
+
subContent?: string | null;
|
|
59
|
+
tags?: string[] | null;
|
|
60
|
+
title?: string | null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const MemoryItem = memo<MemoryItemProps>(({ title, content, subContent, tags }) => {
|
|
64
|
+
return (
|
|
65
|
+
<Flexbox className={styles.item} gap={4}>
|
|
66
|
+
{title && <div className={styles.itemTitle}>{title}</div>}
|
|
67
|
+
{content && <div className={styles.itemContent}>{content}</div>}
|
|
68
|
+
{subContent && (
|
|
69
|
+
<Text className={styles.itemContent} style={{ fontStyle: 'italic' }} type={'secondary'}>
|
|
70
|
+
{subContent}
|
|
71
|
+
</Text>
|
|
72
|
+
)}
|
|
73
|
+
{tags && tags.length > 0 && (
|
|
74
|
+
<Flexbox className={styles.tags} gap={4} horizontal wrap={'wrap'}>
|
|
75
|
+
{tags.map((tag, index) => (
|
|
76
|
+
<Tag key={index} size={'small'}>
|
|
77
|
+
{tag}
|
|
78
|
+
</Tag>
|
|
79
|
+
))}
|
|
80
|
+
</Flexbox>
|
|
81
|
+
)}
|
|
82
|
+
</Flexbox>
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
MemoryItem.displayName = 'MemoryItem';
|
|
87
|
+
|
|
88
|
+
const SearchUserMemoryRender = memo<BuiltinRenderProps<SearchMemoryParams, SearchUserMemoryState>>(
|
|
89
|
+
({ pluginState }) => {
|
|
90
|
+
const { t } = useTranslation('plugin');
|
|
91
|
+
|
|
92
|
+
const contexts = pluginState?.contexts || [];
|
|
93
|
+
const experiences = pluginState?.experiences || [];
|
|
94
|
+
const preferences = pluginState?.preferences || [];
|
|
95
|
+
|
|
96
|
+
const totalCount = contexts.length + experiences.length + preferences.length;
|
|
97
|
+
|
|
98
|
+
if (totalCount === 0) {
|
|
99
|
+
return (
|
|
100
|
+
<div className={styles.container}>
|
|
101
|
+
<div className={styles.empty}>{t('builtins.lobe-user-memory.inspector.noResults')}</div>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const defaultActiveKeys = [
|
|
107
|
+
...(contexts.length > 0 ? ['contexts'] : []),
|
|
108
|
+
...(experiences.length > 0 ? ['experiences'] : []),
|
|
109
|
+
...(preferences.length > 0 ? ['preferences'] : []),
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<Flexbox className={styles.container}>
|
|
114
|
+
<Accordion defaultExpandedKeys={defaultActiveKeys} gap={0}>
|
|
115
|
+
{/* Contexts */}
|
|
116
|
+
{contexts.length > 0 && (
|
|
117
|
+
<AccordionItem
|
|
118
|
+
itemKey="contexts"
|
|
119
|
+
paddingBlock={8}
|
|
120
|
+
paddingInline={12}
|
|
121
|
+
title={
|
|
122
|
+
<Text className={styles.sectionHeader}>
|
|
123
|
+
<span className={highlightTextStyles.info}>
|
|
124
|
+
{t('builtins.lobe-user-memory.render.contexts' as any)}
|
|
125
|
+
</span>
|
|
126
|
+
<Text as={'span'} type={'secondary'}>
|
|
127
|
+
{' '}
|
|
128
|
+
({contexts.length})
|
|
129
|
+
</Text>
|
|
130
|
+
</Text>
|
|
131
|
+
}
|
|
132
|
+
>
|
|
133
|
+
<Flexbox>
|
|
134
|
+
{contexts.map((item) => (
|
|
135
|
+
<MemoryItem
|
|
136
|
+
content={item.description}
|
|
137
|
+
key={item.id}
|
|
138
|
+
subContent={item.currentStatus}
|
|
139
|
+
tags={item.tags}
|
|
140
|
+
title={item.title}
|
|
141
|
+
/>
|
|
142
|
+
))}
|
|
143
|
+
</Flexbox>
|
|
144
|
+
</AccordionItem>
|
|
145
|
+
)}
|
|
146
|
+
|
|
147
|
+
{/* Experiences */}
|
|
148
|
+
{experiences.length > 0 && (
|
|
149
|
+
<AccordionItem
|
|
150
|
+
itemKey="experiences"
|
|
151
|
+
paddingBlock={8}
|
|
152
|
+
paddingInline={12}
|
|
153
|
+
title={
|
|
154
|
+
<Text className={styles.sectionHeader}>
|
|
155
|
+
<span className={highlightTextStyles.gold}>
|
|
156
|
+
{t('builtins.lobe-user-memory.render.experiences' as any)}
|
|
157
|
+
</span>
|
|
158
|
+
<Text as={'span'} type={'secondary'}>
|
|
159
|
+
{' '}
|
|
160
|
+
({experiences.length})
|
|
161
|
+
</Text>
|
|
162
|
+
</Text>
|
|
163
|
+
}
|
|
164
|
+
>
|
|
165
|
+
<Flexbox>
|
|
166
|
+
{experiences.map((item) => (
|
|
167
|
+
<MemoryItem
|
|
168
|
+
content={item.situation}
|
|
169
|
+
key={item.id}
|
|
170
|
+
subContent={item.keyLearning}
|
|
171
|
+
tags={item.tags}
|
|
172
|
+
title={item.action}
|
|
173
|
+
/>
|
|
174
|
+
))}
|
|
175
|
+
</Flexbox>
|
|
176
|
+
</AccordionItem>
|
|
177
|
+
)}
|
|
178
|
+
|
|
179
|
+
{/* Preferences */}
|
|
180
|
+
{preferences.length > 0 && (
|
|
181
|
+
<AccordionItem
|
|
182
|
+
itemKey="preferences"
|
|
183
|
+
paddingBlock={8}
|
|
184
|
+
paddingInline={12}
|
|
185
|
+
title={
|
|
186
|
+
<Text className={styles.sectionHeader}>
|
|
187
|
+
<span className={highlightTextStyles.warning}>
|
|
188
|
+
{t('builtins.lobe-user-memory.render.preferences' as any)}
|
|
189
|
+
</span>
|
|
190
|
+
<Text as={'span'} type={'secondary'}>
|
|
191
|
+
{' '}
|
|
192
|
+
({preferences.length})
|
|
193
|
+
</Text>
|
|
194
|
+
</Text>
|
|
195
|
+
}
|
|
196
|
+
>
|
|
197
|
+
<Flexbox>
|
|
198
|
+
{preferences.map((item) => (
|
|
199
|
+
<MemoryItem
|
|
200
|
+
content={item.conclusionDirectives}
|
|
201
|
+
key={item.id}
|
|
202
|
+
subContent={item.suggestions}
|
|
203
|
+
tags={item.tags}
|
|
204
|
+
/>
|
|
205
|
+
))}
|
|
206
|
+
</Flexbox>
|
|
207
|
+
</AccordionItem>
|
|
208
|
+
)}
|
|
209
|
+
</Accordion>
|
|
210
|
+
</Flexbox>
|
|
211
|
+
);
|
|
212
|
+
},
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
SearchUserMemoryRender.displayName = 'SearchUserMemoryRender';
|
|
216
|
+
|
|
217
|
+
export default SearchUserMemoryRender;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BuiltinRender } from '@lobechat/types';
|
|
2
|
+
|
|
3
|
+
import { MemoryApiName } from '../../types';
|
|
4
|
+
import AddExperienceMemoryRender from './AddExperienceMemory';
|
|
5
|
+
import SearchUserMemoryRender from './SearchUserMemory';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Memory Render Components Registry
|
|
9
|
+
*
|
|
10
|
+
* Render components display the final result of tool execution.
|
|
11
|
+
*/
|
|
12
|
+
export const MemoryRenders: Record<string, BuiltinRender> = {
|
|
13
|
+
[MemoryApiName.addExperienceMemory]: AddExperienceMemoryRender as BuiltinRender,
|
|
14
|
+
[MemoryApiName.searchUserMemory]: SearchUserMemoryRender as BuiltinRender,
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinStreamingProps } from '@lobechat/types';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
|
|
6
|
+
import type { AddExperienceMemoryParams } from '../../../types';
|
|
7
|
+
import { ExperienceMemoryCard } from '../../components';
|
|
8
|
+
|
|
9
|
+
export const AddExperienceMemoryStreaming = memo<BuiltinStreamingProps<AddExperienceMemoryParams>>(
|
|
10
|
+
({ args }) => {
|
|
11
|
+
return <ExperienceMemoryCard data={args} loading />;
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
AddExperienceMemoryStreaming.displayName = 'AddExperienceMemoryStreaming';
|
|
16
|
+
|
|
17
|
+
export default AddExperienceMemoryStreaming;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type BuiltinStreaming } from '@lobechat/types';
|
|
2
|
+
|
|
3
|
+
import { MemoryApiName } from '../../types';
|
|
4
|
+
import { AddExperienceMemoryStreaming } from './AddExperienceMemory';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Memory Streaming Components Registry
|
|
8
|
+
*
|
|
9
|
+
* Streaming components are used to render tool calls while arguments
|
|
10
|
+
* are still being generated, allowing real-time feedback to users.
|
|
11
|
+
*/
|
|
12
|
+
export const MemoryStreamings: Record<string, BuiltinStreaming> = {
|
|
13
|
+
[MemoryApiName.addExperienceMemory]: AddExperienceMemoryStreaming as BuiltinStreaming,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export {AddExperienceMemoryStreaming} from './AddExperienceMemory';
|