@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
|
@@ -2,7 +2,6 @@ import { Form } from '@lobehub/ui';
|
|
|
2
2
|
import type { FormItemProps } from '@lobehub/ui';
|
|
3
3
|
import { Form as AntdForm, Grid, Switch } from 'antd';
|
|
4
4
|
import isEqual from 'fast-deep-equal';
|
|
5
|
-
import Link from 'next/link';
|
|
6
5
|
import { memo } from 'react';
|
|
7
6
|
import { Trans, useTranslation } from 'react-i18next';
|
|
8
7
|
|
|
@@ -62,12 +61,13 @@ const ControlsForm = memo(() => {
|
|
|
62
61
|
<span style={isNarrow ? descNarrow : descWide}>
|
|
63
62
|
<Trans i18nKey={'extendParams.disableContextCaching.desc'} ns={'chat'}>
|
|
64
63
|
单条对话生成成本最高可降低 90%,响应速度提升 4 倍(
|
|
65
|
-
<
|
|
64
|
+
<a
|
|
66
65
|
href={'https://www.anthropic.com/news/prompt-caching?utm_source=lobechat'}
|
|
67
|
-
rel=
|
|
66
|
+
rel="noreferrer nofollow"
|
|
67
|
+
target="_blank"
|
|
68
68
|
>
|
|
69
69
|
了解更多
|
|
70
|
-
</
|
|
70
|
+
</a>
|
|
71
71
|
)。开启后将自动禁用历史记录限制
|
|
72
72
|
</Trans>
|
|
73
73
|
</span>
|
|
@@ -83,14 +83,15 @@ const ControlsForm = memo(() => {
|
|
|
83
83
|
<span style={isNarrow ? descNarrow : descWide}>
|
|
84
84
|
<Trans i18nKey={'extendParams.enableReasoning.desc'} ns={'chat'}>
|
|
85
85
|
基于 Claude Thinking 机制限制(
|
|
86
|
-
<
|
|
86
|
+
<a
|
|
87
87
|
href={
|
|
88
88
|
'https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking?utm_source=lobechat#why-thinking-blocks-must-be-preserved'
|
|
89
89
|
}
|
|
90
|
-
rel=
|
|
90
|
+
rel="noreferrer nofollow"
|
|
91
|
+
target="_blank"
|
|
91
92
|
>
|
|
92
93
|
了解更多
|
|
93
|
-
</
|
|
94
|
+
</a>
|
|
94
95
|
),开启后将自动禁用历史消息数限制
|
|
95
96
|
</Trans>
|
|
96
97
|
</span>
|
|
@@ -306,9 +306,7 @@ const Controls = memo<ControlsProps>(({ setUpdating }) => {
|
|
|
306
306
|
...(enableMaxTokens
|
|
307
307
|
? [
|
|
308
308
|
{
|
|
309
|
-
children:
|
|
310
|
-
<SliderWithInput max={32_000} min={0} step={100} unlimitedInput />
|
|
311
|
-
),
|
|
309
|
+
children: <SliderWithInput max={32_000} min={0} step={100} unlimitedInput />,
|
|
312
310
|
label: (
|
|
313
311
|
<Flexbox align={'center'} className={styles.label} gap={8} horizontal>
|
|
314
312
|
{t('settingModel.maxTokens.title')}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { ChatInput, ChatInputActionBar } from '@lobehub/editor/react';
|
|
4
4
|
import { Flexbox } from '@lobehub/ui';
|
|
5
5
|
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
-
import dynamic from 'next/dynamic';
|
|
6
|
+
import dynamic from '@/libs/next/dynamic';
|
|
7
7
|
import { memo } from 'react';
|
|
8
8
|
|
|
9
9
|
import { useChatInputStore } from '@/features/ChatInput/store';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flexbox } from '@lobehub/ui';
|
|
2
2
|
import { createStaticStyles, cx } from 'antd-style';
|
|
3
|
-
import dynamic from 'next/dynamic';
|
|
3
|
+
import dynamic from '@/libs/next/dynamic';
|
|
4
4
|
import { type ReactNode, Suspense, memo, useCallback } from 'react';
|
|
5
5
|
|
|
6
6
|
import { useConversationStore } from '@/features/Conversation/store';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ChatMessageError } from '@lobechat/types';
|
|
2
2
|
import { type AlertProps, Skeleton } from '@lobehub/ui';
|
|
3
|
-
import dynamic from 'next/dynamic';
|
|
3
|
+
import dynamic from '@/libs/next/dynamic';
|
|
4
4
|
import { memo } from 'react';
|
|
5
5
|
|
|
6
6
|
import ErrorContent from '@/features/Conversation/ChatItem/components/ErrorContent';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Ollama } from '@lobehub/icons';
|
|
2
2
|
import { Button } from '@lobehub/ui';
|
|
3
|
-
import Link from 'next/link';
|
|
4
3
|
import { memo } from 'react';
|
|
5
4
|
import { Trans, useTranslation } from 'react-i18next';
|
|
6
5
|
|
|
@@ -29,7 +28,7 @@ const OllamaDesktopSetupGuide = memo<{ id?: string }>(({ id }) => {
|
|
|
29
28
|
avatar={<Ollama.Avatar shape={'square'} size={40} />}
|
|
30
29
|
desc={
|
|
31
30
|
<Trans
|
|
32
|
-
components={[<span key="0" />, <
|
|
31
|
+
components={[<span key="0" />, <a href={'https://ollama.com/download'} key="1" rel="noreferrer" target="_blank" />]}
|
|
33
32
|
i18nKey={'OllamaSetupGuide.install.description'}
|
|
34
33
|
ns={'components'}
|
|
35
34
|
/>
|
|
@@ -3,7 +3,7 @@ import { AgentRuntimeErrorType, type ILobeAgentRuntimeErrorType } from '@lobecha
|
|
|
3
3
|
import { ChatErrorType, type ChatMessageError, type ErrorType } from '@lobechat/types';
|
|
4
4
|
import { type IPluginErrorType } from '@lobehub/chat-plugin-sdk';
|
|
5
5
|
import { type AlertProps, Block, Highlighter, Skeleton } from '@lobehub/ui';
|
|
6
|
-
import dynamic from 'next/dynamic';
|
|
6
|
+
import dynamic from '@/libs/next/dynamic';
|
|
7
7
|
import { memo, useMemo } from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionIcon, createRawModal } from '@lobehub/ui';
|
|
2
2
|
import { LucideSettings } from 'lucide-react';
|
|
3
|
-
import dynamic from 'next/dynamic';
|
|
3
|
+
import dynamic from '@/libs/next/dynamic';
|
|
4
4
|
import { memo } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
|
|
@@ -8,49 +8,43 @@ import Settings from './Settings';
|
|
|
8
8
|
|
|
9
9
|
interface ActionsProps {
|
|
10
10
|
assistantMessageId: string;
|
|
11
|
-
|
|
11
|
+
canToggleCustomToolRender?: boolean;
|
|
12
12
|
identifier: string;
|
|
13
|
+
setShowCustomToolRender?: (show: boolean) => void;
|
|
13
14
|
setShowDebug?: (show: boolean) => void;
|
|
14
|
-
|
|
15
|
-
showCustomPluginRender: boolean;
|
|
15
|
+
showCustomToolRender?: boolean;
|
|
16
16
|
showDebug?: boolean;
|
|
17
|
-
showPluginRender: boolean;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
const Actions = memo<ActionsProps>(
|
|
21
20
|
({
|
|
22
21
|
assistantMessageId,
|
|
22
|
+
canToggleCustomToolRender,
|
|
23
23
|
identifier,
|
|
24
|
+
setShowCustomToolRender,
|
|
24
25
|
setShowDebug,
|
|
25
|
-
|
|
26
|
-
showCustomPluginRender,
|
|
26
|
+
showCustomToolRender,
|
|
27
27
|
showDebug,
|
|
28
|
-
showPluginRender,
|
|
29
|
-
handleExpand,
|
|
30
28
|
}) => {
|
|
31
29
|
const { t } = useTranslation('plugin');
|
|
32
30
|
const deleteAssistantMessage = useConversationStore((s) => s.deleteAssistantMessage);
|
|
33
31
|
|
|
34
32
|
return (
|
|
35
33
|
<>
|
|
36
|
-
{
|
|
34
|
+
{canToggleCustomToolRender && (
|
|
37
35
|
<ActionIcon
|
|
38
|
-
icon={
|
|
36
|
+
icon={showCustomToolRender ? LogsIcon : LayoutPanelTop}
|
|
39
37
|
onClick={() => {
|
|
40
|
-
|
|
41
|
-
handleExpand?.(true);
|
|
38
|
+
setShowCustomToolRender?.(!showCustomToolRender);
|
|
42
39
|
}}
|
|
43
40
|
size={'small'}
|
|
44
|
-
title={
|
|
41
|
+
title={showCustomToolRender ? t('inspector.args') : t('inspector.pluginRender')}
|
|
45
42
|
/>
|
|
46
43
|
)}
|
|
47
44
|
<ActionIcon
|
|
48
45
|
active={showDebug}
|
|
49
46
|
icon={showDebug ? LucideBugOff : LucideBug}
|
|
50
|
-
onClick={() =>
|
|
51
|
-
setShowDebug?.(!showDebug);
|
|
52
|
-
handleExpand?.(true);
|
|
53
|
-
}}
|
|
47
|
+
onClick={() => setShowDebug?.(!showDebug)}
|
|
54
48
|
size={'small'}
|
|
55
49
|
title={t(showDebug ? 'debug.off' : 'debug.on')}
|
|
56
50
|
/>
|
|
@@ -2,6 +2,7 @@ import { safeParseJSON } from '@lobechat/utils';
|
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import { getBuiltinPlaceholder } from '@/tools/placeholders';
|
|
5
|
+
import { getBuiltinStreaming } from '@/tools/streamings';
|
|
5
6
|
|
|
6
7
|
import Arguments from '../Arguments';
|
|
7
8
|
|
|
@@ -9,16 +10,25 @@ interface LoadingPlaceholderProps {
|
|
|
9
10
|
apiName: string;
|
|
10
11
|
identifier: string;
|
|
11
12
|
loading?: boolean;
|
|
13
|
+
messageId: string;
|
|
12
14
|
requestArgs?: string;
|
|
15
|
+
toolCallId: string;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
const LoadingPlaceholder = memo<LoadingPlaceholderProps>(
|
|
16
|
-
({ identifier, requestArgs, apiName, loading }) => {
|
|
17
|
-
const Render =
|
|
19
|
+
({ identifier, requestArgs, apiName, loading, toolCallId, messageId }) => {
|
|
20
|
+
const Render =
|
|
21
|
+
getBuiltinPlaceholder(identifier, apiName) || getBuiltinStreaming(identifier, apiName);
|
|
18
22
|
|
|
19
23
|
if (Render) {
|
|
20
24
|
return (
|
|
21
|
-
<Render
|
|
25
|
+
<Render
|
|
26
|
+
apiName={apiName}
|
|
27
|
+
args={safeParseJSON(requestArgs) || {}}
|
|
28
|
+
identifier={identifier}
|
|
29
|
+
messageId={messageId}
|
|
30
|
+
toolCallId={toolCallId}
|
|
31
|
+
/>
|
|
22
32
|
);
|
|
23
33
|
}
|
|
24
34
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ChatPluginPayload } from '@/types/index';
|
|
2
|
+
import { Flexbox } from '@lobehub/ui';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import PluginRender from '@/features/PluginsUI/Render';
|
|
6
|
+
|
|
7
|
+
interface CustomRenderProps {
|
|
8
|
+
content: string;
|
|
9
|
+
/**
|
|
10
|
+
* The real message ID (tool message ID)
|
|
11
|
+
*/
|
|
12
|
+
messageId?: string;
|
|
13
|
+
plugin?: ChatPluginPayload;
|
|
14
|
+
pluginState?: any;
|
|
15
|
+
/**
|
|
16
|
+
* The tool call ID from the assistant message
|
|
17
|
+
*/
|
|
18
|
+
toolCallId: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const CustomRender = memo<CustomRenderProps>(
|
|
22
|
+
({ toolCallId, messageId, content, pluginState, plugin }) => {
|
|
23
|
+
return (
|
|
24
|
+
<Flexbox gap={12} id={toolCallId} width={'100%'}>
|
|
25
|
+
<PluginRender
|
|
26
|
+
arguments={plugin?.arguments}
|
|
27
|
+
content={content}
|
|
28
|
+
identifier={plugin?.identifier}
|
|
29
|
+
loading={false}
|
|
30
|
+
messageId={messageId}
|
|
31
|
+
payload={plugin}
|
|
32
|
+
pluginState={pluginState}
|
|
33
|
+
toolCallId={toolCallId}
|
|
34
|
+
type={plugin?.type}
|
|
35
|
+
/>
|
|
36
|
+
</Flexbox>
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
CustomRender.displayName = 'GroupCustomRender';
|
|
42
|
+
|
|
43
|
+
export default CustomRender;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Block, Flexbox, Highlighter, Text } from '@lobehub/ui';
|
|
2
|
+
import { Divider } from 'antd';
|
|
3
|
+
import { memo, useMemo } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
|
|
6
|
+
import Arguments from '../Arguments';
|
|
7
|
+
|
|
8
|
+
interface FallbackArgumentRenderProps {
|
|
9
|
+
content: string;
|
|
10
|
+
requestArgs?: string;
|
|
11
|
+
toolCallId: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const FallbackArgumentRender = memo<FallbackArgumentRenderProps>(
|
|
15
|
+
({ toolCallId, content, requestArgs }) => {
|
|
16
|
+
const { t } = useTranslation('plugin');
|
|
17
|
+
|
|
18
|
+
// Parse and display result content
|
|
19
|
+
const { data, language } = useMemo(() => {
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(content || '');
|
|
22
|
+
// If parsed result is a string, return it directly
|
|
23
|
+
if (typeof parsed === 'string') {
|
|
24
|
+
return { data: parsed, language: 'plaintext' };
|
|
25
|
+
}
|
|
26
|
+
return { data: JSON.stringify(parsed, null, 2), language: 'json' };
|
|
27
|
+
} catch {
|
|
28
|
+
return { data: content || '', language: 'plaintext' };
|
|
29
|
+
}
|
|
30
|
+
}, [content]);
|
|
31
|
+
|
|
32
|
+
// Default render: show arguments and result
|
|
33
|
+
return (
|
|
34
|
+
<Block id={toolCallId} variant={'outlined'} width={'100%'}>
|
|
35
|
+
<Arguments arguments={requestArgs} />
|
|
36
|
+
{content && (
|
|
37
|
+
<>
|
|
38
|
+
<Divider style={{ marginBlock: 0 }} />
|
|
39
|
+
<Flexbox paddingBlock={'8px 0'} paddingInline={16}>
|
|
40
|
+
<Text>{t('debug.response')}</Text>
|
|
41
|
+
</Flexbox>
|
|
42
|
+
<Highlighter
|
|
43
|
+
language={language}
|
|
44
|
+
style={{
|
|
45
|
+
background: 'transparent',
|
|
46
|
+
borderRadius: 0,
|
|
47
|
+
maxHeight: 300,
|
|
48
|
+
overflow: 'auto',
|
|
49
|
+
}}
|
|
50
|
+
variant={'filled'}
|
|
51
|
+
>
|
|
52
|
+
{data}
|
|
53
|
+
</Highlighter>
|
|
54
|
+
</>
|
|
55
|
+
)}
|
|
56
|
+
</Block>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type ChatPluginPayload } from '@lobechat/types';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
import { getBuiltinRender } from '@/tools/renders';
|
|
5
|
+
|
|
6
|
+
import CustomRender from './CustomRender';
|
|
7
|
+
import { FallbackArgumentRender } from './FallbacktArgumentRender';
|
|
8
|
+
|
|
9
|
+
interface ToolRenderProps {
|
|
10
|
+
content: string;
|
|
11
|
+
messageId?: string;
|
|
12
|
+
plugin?: ChatPluginPayload;
|
|
13
|
+
pluginState?: any;
|
|
14
|
+
showCustomToolRender?: boolean;
|
|
15
|
+
toolCallId: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const ToolRender = memo<ToolRenderProps>(
|
|
19
|
+
({ showCustomToolRender, content, messageId, plugin, pluginState, toolCallId }) => {
|
|
20
|
+
const hasCustomRender = !!getBuiltinRender(plugin?.identifier, plugin?.apiName);
|
|
21
|
+
|
|
22
|
+
if (hasCustomRender && showCustomToolRender) {
|
|
23
|
+
return (
|
|
24
|
+
<CustomRender
|
|
25
|
+
content={content}
|
|
26
|
+
messageId={messageId}
|
|
27
|
+
plugin={plugin}
|
|
28
|
+
pluginState={pluginState}
|
|
29
|
+
toolCallId={toolCallId}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<FallbackArgumentRender
|
|
36
|
+
content={content}
|
|
37
|
+
requestArgs={plugin?.arguments}
|
|
38
|
+
toolCallId={toolCallId}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
ToolRender.displayName = 'ToolResultRender';
|
|
45
|
+
|
|
46
|
+
export default ToolRender;
|
|
@@ -6,12 +6,12 @@ import { Suspense, memo } from 'react';
|
|
|
6
6
|
import { getBuiltinStreaming } from '@/tools/streamings';
|
|
7
7
|
|
|
8
8
|
import AbortResponse from './AbortResponse';
|
|
9
|
-
import CustomRender from './CustomRender';
|
|
10
9
|
import ErrorResponse from './ErrorResponse';
|
|
11
10
|
import Intervention from './Intervention';
|
|
12
11
|
import ModeSelector from './Intervention/ModeSelector';
|
|
13
12
|
import LoadingPlaceholder from './LoadingPlaceholder';
|
|
14
13
|
import RejectedResponse from './RejectedResponse';
|
|
14
|
+
import ToolRender from './Render';
|
|
15
15
|
|
|
16
16
|
interface RenderProps {
|
|
17
17
|
apiName: string;
|
|
@@ -26,8 +26,7 @@ interface RenderProps {
|
|
|
26
26
|
*/
|
|
27
27
|
messageId: string;
|
|
28
28
|
result?: ChatToolResult;
|
|
29
|
-
|
|
30
|
-
showPluginRender: boolean;
|
|
29
|
+
showCustomToolRender?: boolean;
|
|
31
30
|
toolCallId: string;
|
|
32
31
|
toolMessageId?: string;
|
|
33
32
|
type?: string;
|
|
@@ -45,8 +44,6 @@ const Render = memo<RenderProps>(
|
|
|
45
44
|
messageId,
|
|
46
45
|
arguments: requestArgs,
|
|
47
46
|
disableEditing,
|
|
48
|
-
showPluginRender,
|
|
49
|
-
setShowPluginRender,
|
|
50
47
|
identifier,
|
|
51
48
|
apiName,
|
|
52
49
|
result,
|
|
@@ -55,6 +52,7 @@ const Render = memo<RenderProps>(
|
|
|
55
52
|
toolMessageId,
|
|
56
53
|
isArgumentsStreaming,
|
|
57
54
|
isToolCalling,
|
|
55
|
+
showCustomToolRender,
|
|
58
56
|
}) => {
|
|
59
57
|
if (toolMessageId && intervention?.status === 'pending' && !disableEditing) {
|
|
60
58
|
return (
|
|
@@ -124,7 +122,9 @@ const Render = memo<RenderProps>(
|
|
|
124
122
|
apiName={apiName}
|
|
125
123
|
identifier={identifier}
|
|
126
124
|
loading
|
|
125
|
+
messageId={messageId}
|
|
127
126
|
requestArgs={requestArgs}
|
|
127
|
+
toolCallId={toolCallId}
|
|
128
128
|
/>
|
|
129
129
|
);
|
|
130
130
|
|
|
@@ -133,23 +133,17 @@ const Render = memo<RenderProps>(
|
|
|
133
133
|
return (
|
|
134
134
|
<Suspense fallback={placeholder}>
|
|
135
135
|
<Flexbox gap={8}>
|
|
136
|
-
<
|
|
136
|
+
<ToolRender
|
|
137
137
|
content={result.content || ''}
|
|
138
138
|
messageId={toolMessageId}
|
|
139
|
-
plugin={
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
type,
|
|
146
|
-
} as any)
|
|
147
|
-
: undefined
|
|
148
|
-
}
|
|
139
|
+
plugin={{
|
|
140
|
+
apiName,
|
|
141
|
+
arguments: requestArgs || '',
|
|
142
|
+
identifier,
|
|
143
|
+
type: type as any,
|
|
144
|
+
}}
|
|
149
145
|
pluginState={result.state}
|
|
150
|
-
|
|
151
|
-
setShowPluginRender={setShowPluginRender}
|
|
152
|
-
showPluginRender={showPluginRender}
|
|
146
|
+
showCustomToolRender={showCustomToolRender}
|
|
153
147
|
toolCallId={toolCallId}
|
|
154
148
|
/>
|
|
155
149
|
{!disableEditing && (
|
|
@@ -2,9 +2,9 @@ import { LOADING_FLAT } from '@lobechat/const';
|
|
|
2
2
|
import { type ChatToolResult, type ToolIntervention } from '@lobechat/types';
|
|
3
3
|
import { AccordionItem, Flexbox, Skeleton } from '@lobehub/ui';
|
|
4
4
|
import { Divider } from 'antd';
|
|
5
|
-
import dynamic from 'next/dynamic';
|
|
6
5
|
import { memo, useEffect, useState } from 'react';
|
|
7
6
|
|
|
7
|
+
import dynamic from '@/libs/next/dynamic';
|
|
8
8
|
import { useChatStore } from '@/store/chat';
|
|
9
9
|
import { operationSelectors } from '@/store/chat/slices/operation/selectors';
|
|
10
10
|
import { useToolStore } from '@/store/tool';
|
|
@@ -21,7 +21,7 @@ const Debug = dynamic(() => import('./Debug'), {
|
|
|
21
21
|
ssr: false,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const Detail = dynamic(() => import('./Detail'), {
|
|
25
25
|
loading: () => <Skeleton.Block active height={120} width={'100%'} />,
|
|
26
26
|
ssr: false,
|
|
27
27
|
});
|
|
@@ -57,7 +57,9 @@ const Tool = memo<GroupToolProps>(
|
|
|
57
57
|
toolSelectors.getRenderDisplayControl(identifier, apiName),
|
|
58
58
|
);
|
|
59
59
|
const [showDebug, setShowDebug] = useState(false);
|
|
60
|
-
const [
|
|
60
|
+
const [showToolRender, setShowToolRender] = useState(false);
|
|
61
|
+
// Controls switching between custom render and fallback ArgumentRender
|
|
62
|
+
const [showCustomToolRender, setShowCustomToolRender] = useState(true);
|
|
61
63
|
|
|
62
64
|
const isPending = intervention?.status === 'pending';
|
|
63
65
|
const isReject = intervention?.status === 'rejected';
|
|
@@ -65,8 +67,6 @@ const Tool = memo<GroupToolProps>(
|
|
|
65
67
|
const needExpand = renderDisplayControl !== 'collapsed' || isPending;
|
|
66
68
|
const isAlwaysExpand = renderDisplayControl === 'alwaysExpand';
|
|
67
69
|
|
|
68
|
-
const showCustomPluginRender = !isPending && !isReject && !isAbort;
|
|
69
|
-
|
|
70
70
|
let isArgumentsStreaming = false;
|
|
71
71
|
try {
|
|
72
72
|
JSON.parse(requestArgs || '{}');
|
|
@@ -88,14 +88,16 @@ const Tool = memo<GroupToolProps>(
|
|
|
88
88
|
const isToolCalling = isToolCallingFromOperation || isToolCallingFallback;
|
|
89
89
|
|
|
90
90
|
const hasCustomRender = !!getBuiltinRender(identifier, apiName);
|
|
91
|
+
// Only allow toggle when has custom render and not in pending/reject/abort state
|
|
92
|
+
const canToggleCustomToolRender = hasCustomRender && !isPending && !isReject && !isAbort;
|
|
91
93
|
|
|
92
|
-
// Handle expand state changes
|
|
94
|
+
// Handle expand state changes
|
|
93
95
|
const handleExpand = (expand?: boolean) => {
|
|
94
96
|
// Block collapse action when alwaysExpand is set
|
|
95
97
|
if (isAlwaysExpand && expand === false) {
|
|
96
98
|
return;
|
|
97
99
|
}
|
|
98
|
-
|
|
100
|
+
setShowToolRender(!!expand);
|
|
99
101
|
};
|
|
100
102
|
|
|
101
103
|
useEffect(() => {
|
|
@@ -104,27 +106,26 @@ const Tool = memo<GroupToolProps>(
|
|
|
104
106
|
}
|
|
105
107
|
}, [needExpand]);
|
|
106
108
|
|
|
107
|
-
const
|
|
109
|
+
const isToolDetailExpand = forceShowStreamingRender || showToolRender || showDebug;
|
|
110
|
+
|
|
108
111
|
return (
|
|
109
112
|
<AccordionItem
|
|
110
113
|
action={
|
|
111
114
|
!disableEditing && (
|
|
112
115
|
<Actions
|
|
113
116
|
assistantMessageId={assistantMessageId}
|
|
114
|
-
|
|
117
|
+
canToggleCustomToolRender={canToggleCustomToolRender}
|
|
115
118
|
identifier={identifier}
|
|
119
|
+
setShowCustomToolRender={setShowCustomToolRender}
|
|
116
120
|
setShowDebug={setShowDebug}
|
|
117
|
-
|
|
118
|
-
showCustomPluginRender={showCustomPluginRender}
|
|
121
|
+
showCustomToolRender={showCustomToolRender}
|
|
119
122
|
showDebug={showDebug}
|
|
120
|
-
showPluginRender={showPluginRender}
|
|
121
123
|
/>
|
|
122
124
|
)
|
|
123
125
|
}
|
|
124
|
-
|
|
125
|
-
expand={isToolRenderExpand}
|
|
126
|
+
expand={isToolDetailExpand}
|
|
126
127
|
itemKey={id}
|
|
127
|
-
onExpandChange={
|
|
128
|
+
onExpandChange={handleExpand}
|
|
128
129
|
paddingBlock={4}
|
|
129
130
|
paddingInline={4}
|
|
130
131
|
title={
|
|
@@ -151,7 +152,7 @@ const Tool = memo<GroupToolProps>(
|
|
|
151
152
|
/>
|
|
152
153
|
)}
|
|
153
154
|
<ToolErrorBoundary apiName={apiName} identifier={identifier}>
|
|
154
|
-
<
|
|
155
|
+
<Detail
|
|
155
156
|
apiName={apiName}
|
|
156
157
|
arguments={requestArgs}
|
|
157
158
|
disableEditing={disableEditing}
|
|
@@ -161,8 +162,7 @@ const Tool = memo<GroupToolProps>(
|
|
|
161
162
|
isToolCalling={isToolCalling}
|
|
162
163
|
messageId={assistantMessageId}
|
|
163
164
|
result={result}
|
|
164
|
-
|
|
165
|
-
showPluginRender={showPluginRender}
|
|
165
|
+
showCustomToolRender={showCustomToolRender}
|
|
166
166
|
toolCallId={id}
|
|
167
167
|
toolMessageId={toolMessageId}
|
|
168
168
|
type={type}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { AssistantContentBlock } from '@lobechat/types';
|
|
4
4
|
import isEqual from 'fast-deep-equal';
|
|
5
|
-
import dynamic from 'next/dynamic';
|
|
5
|
+
import dynamic from '@/libs/next/dynamic';
|
|
6
6
|
import { type MouseEventHandler, Suspense, memo, useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { MESSAGE_ACTION_BAR_PORTAL_ATTRIBUTES } from '@/const/messageActionPortal';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Accordion, AccordionItem, Flexbox, Skeleton } from '@lobehub/ui';
|
|
2
|
-
import dynamic from 'next/dynamic';
|
|
3
2
|
import { type CSSProperties, memo, useState } from 'react';
|
|
4
3
|
|
|
5
4
|
import Actions from '@/features/Conversation/Messages/AssistantGroup/Tool/Actions';
|
|
5
|
+
import dynamic from '@/libs/next/dynamic';
|
|
6
|
+
import { getBuiltinRender } from '@/tools/renders';
|
|
6
7
|
|
|
7
8
|
import { dataSelectors, messageStateSelectors, useConversationStore } from '../../../store';
|
|
8
9
|
import Inspectors from '../../AssistantGroup/Tool/Inspector';
|
|
@@ -12,7 +13,7 @@ const Debug = dynamic(() => import('../../AssistantGroup/Tool/Debug'), {
|
|
|
12
13
|
ssr: false,
|
|
13
14
|
});
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
+
const Detail = dynamic(() => import('../../AssistantGroup/Tool/Detail'), {
|
|
16
17
|
loading: () => <Skeleton.Block active height={120} width={'100%'} />,
|
|
17
18
|
ssr: false,
|
|
18
19
|
});
|
|
@@ -44,7 +45,7 @@ const Tool = memo<InspectorProps>(
|
|
|
44
45
|
type,
|
|
45
46
|
}) => {
|
|
46
47
|
const [showDebug, setShowDebug] = useState(false);
|
|
47
|
-
const [
|
|
48
|
+
const [showCustomToolRender, setShowCustomToolRender] = useState(true);
|
|
48
49
|
const [expand, setExpand] = useState(true);
|
|
49
50
|
|
|
50
51
|
// Fetch tool message from store
|
|
@@ -68,6 +69,8 @@ const Tool = memo<InspectorProps>(
|
|
|
68
69
|
// Don't render if still loading and no message yet
|
|
69
70
|
if (loading && !toolMessage) return null;
|
|
70
71
|
|
|
72
|
+
const hasCustomRender = !!getBuiltinRender(identifier, apiName);
|
|
73
|
+
|
|
71
74
|
return (
|
|
72
75
|
<Accordion
|
|
73
76
|
expandedKeys={expand ? ['tool'] : []}
|
|
@@ -79,13 +82,12 @@ const Tool = memo<InspectorProps>(
|
|
|
79
82
|
!disableEditing && (
|
|
80
83
|
<Actions
|
|
81
84
|
assistantMessageId={messageId}
|
|
82
|
-
|
|
85
|
+
canToggleCustomToolRender={hasCustomRender}
|
|
83
86
|
identifier={identifier}
|
|
87
|
+
setShowCustomToolRender={setShowCustomToolRender}
|
|
84
88
|
setShowDebug={setShowDebug}
|
|
85
|
-
|
|
86
|
-
showCustomPluginRender={false}
|
|
89
|
+
showCustomToolRender={showCustomToolRender}
|
|
87
90
|
showDebug={showDebug}
|
|
88
|
-
showPluginRender={showPluginRender}
|
|
89
91
|
/>
|
|
90
92
|
)
|
|
91
93
|
}
|
|
@@ -105,15 +107,14 @@ const Tool = memo<InspectorProps>(
|
|
|
105
107
|
type={type}
|
|
106
108
|
/>
|
|
107
109
|
)}
|
|
108
|
-
<
|
|
110
|
+
<Detail
|
|
109
111
|
apiName={apiName}
|
|
110
112
|
arguments={requestArgs}
|
|
111
113
|
disableEditing={disableEditing}
|
|
112
114
|
identifier={identifier}
|
|
113
115
|
messageId={messageId}
|
|
114
116
|
result={result}
|
|
115
|
-
|
|
116
|
-
showPluginRender={showPluginRender}
|
|
117
|
+
showCustomToolRender={showCustomToolRender}
|
|
117
118
|
toolCallId={toolCallId}
|
|
118
119
|
type={type}
|
|
119
120
|
/>
|
|
@@ -2,7 +2,7 @@ import { Flexbox, Icon, SearchResultCards, Tag } from '@lobehub/ui';
|
|
|
2
2
|
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
3
3
|
import { ChevronDown, ChevronRight, Globe } from 'lucide-react';
|
|
4
4
|
import { AnimatePresence, m as motion } from 'motion/react';
|
|
5
|
-
import Image from 'next/
|
|
5
|
+
import Image from '@/libs/next/Image';
|
|
6
6
|
import { memo, useState } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
|