@lobehub/lobehub 2.0.0-next.47 → 2.0.0-next.49
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/.env.example +11 -0
- package/CHANGELOG.md +50 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/apps/desktop/src/main/controllers/AuthCtr.ts +27 -2
- package/apps/desktop/src/main/core/infrastructure/ProtocolManager.ts +9 -4
- package/changelog/v1.json +17 -0
- package/docs/development/database-schema.dbml +2 -0
- package/docs/self-hosting/environment-variables/basic.mdx +49 -3
- package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +49 -4
- package/locales/ar/chat.json +1 -0
- package/locales/ar/discover.json +45 -0
- package/locales/ar/marketAuth.json +42 -0
- package/locales/ar/setting.json +94 -1
- package/locales/ar/topic.json +1 -0
- package/locales/bg-BG/chat.json +1 -0
- package/locales/bg-BG/discover.json +45 -0
- package/locales/bg-BG/marketAuth.json +42 -0
- package/locales/bg-BG/setting.json +94 -1
- package/locales/bg-BG/topic.json +1 -0
- package/locales/de-DE/chat.json +1 -0
- package/locales/de-DE/discover.json +45 -0
- package/locales/de-DE/marketAuth.json +42 -0
- package/locales/de-DE/setting.json +94 -1
- package/locales/de-DE/topic.json +1 -0
- package/locales/en-US/chat.json +1 -0
- package/locales/en-US/discover.json +45 -0
- package/locales/en-US/marketAuth.json +42 -0
- package/locales/en-US/setting.json +94 -1
- package/locales/en-US/topic.json +1 -0
- package/locales/es-ES/chat.json +1 -0
- package/locales/es-ES/discover.json +45 -0
- package/locales/es-ES/marketAuth.json +42 -0
- package/locales/es-ES/setting.json +94 -1
- package/locales/es-ES/topic.json +1 -0
- package/locales/fa-IR/chat.json +1 -0
- package/locales/fa-IR/discover.json +45 -0
- package/locales/fa-IR/marketAuth.json +42 -0
- package/locales/fa-IR/setting.json +94 -1
- package/locales/fa-IR/topic.json +1 -0
- package/locales/fr-FR/chat.json +1 -0
- package/locales/fr-FR/discover.json +45 -0
- package/locales/fr-FR/marketAuth.json +42 -0
- package/locales/fr-FR/setting.json +94 -1
- package/locales/fr-FR/topic.json +1 -0
- package/locales/it-IT/chat.json +1 -0
- package/locales/it-IT/discover.json +45 -0
- package/locales/it-IT/marketAuth.json +42 -0
- package/locales/it-IT/setting.json +94 -1
- package/locales/it-IT/topic.json +1 -0
- package/locales/ja-JP/chat.json +1 -0
- package/locales/ja-JP/discover.json +45 -0
- package/locales/ja-JP/marketAuth.json +42 -0
- package/locales/ja-JP/setting.json +94 -1
- package/locales/ja-JP/topic.json +1 -0
- package/locales/ko-KR/chat.json +1 -0
- package/locales/ko-KR/discover.json +45 -0
- package/locales/ko-KR/marketAuth.json +42 -0
- package/locales/ko-KR/setting.json +94 -1
- package/locales/ko-KR/topic.json +1 -0
- package/locales/nl-NL/chat.json +1 -0
- package/locales/nl-NL/discover.json +45 -0
- package/locales/nl-NL/marketAuth.json +42 -0
- package/locales/nl-NL/setting.json +94 -1
- package/locales/nl-NL/topic.json +1 -0
- package/locales/pl-PL/chat.json +1 -0
- package/locales/pl-PL/discover.json +45 -0
- package/locales/pl-PL/marketAuth.json +42 -0
- package/locales/pl-PL/setting.json +94 -1
- package/locales/pl-PL/topic.json +1 -0
- package/locales/pt-BR/chat.json +1 -0
- package/locales/pt-BR/discover.json +45 -0
- package/locales/pt-BR/marketAuth.json +42 -0
- package/locales/pt-BR/setting.json +94 -1
- package/locales/pt-BR/topic.json +1 -0
- package/locales/ru-RU/chat.json +1 -0
- package/locales/ru-RU/discover.json +45 -0
- package/locales/ru-RU/marketAuth.json +42 -0
- package/locales/ru-RU/setting.json +94 -1
- package/locales/ru-RU/topic.json +1 -0
- package/locales/tr-TR/chat.json +1 -0
- package/locales/tr-TR/discover.json +45 -0
- package/locales/tr-TR/marketAuth.json +42 -0
- package/locales/tr-TR/setting.json +94 -1
- package/locales/tr-TR/topic.json +1 -0
- package/locales/vi-VN/chat.json +1 -0
- package/locales/vi-VN/discover.json +45 -0
- package/locales/vi-VN/marketAuth.json +42 -0
- package/locales/vi-VN/setting.json +94 -1
- package/locales/vi-VN/topic.json +1 -0
- package/locales/zh-CN/chat.json +1 -0
- package/locales/zh-CN/discover.json +45 -0
- package/locales/zh-CN/marketAuth.json +42 -0
- package/locales/zh-CN/setting.json +94 -1
- package/locales/zh-CN/topic.json +1 -0
- package/locales/zh-TW/chat.json +1 -0
- package/locales/zh-TW/discover.json +45 -0
- package/locales/zh-TW/marketAuth.json +42 -0
- package/locales/zh-TW/setting.json +94 -1
- package/locales/zh-TW/topic.json +1 -0
- package/package.json +34 -27
- package/packages/agent-runtime/src/core/InterventionChecker.ts +5 -16
- package/packages/agent-runtime/src/core/__tests__/InterventionChecker.test.ts +27 -80
- package/packages/agent-runtime/src/core/__tests__/runtime.test.ts +32 -13
- package/packages/agent-runtime/src/core/runtime.ts +7 -3
- package/packages/agent-runtime/src/types/event.ts +2 -1
- package/packages/agent-runtime/src/types/generalAgent.ts +1 -0
- package/packages/agent-runtime/src/types/instruction.ts +3 -2
- package/packages/agent-runtime/src/types/state.ts +3 -1
- package/packages/const/src/url.ts +1 -0
- package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +4 -1
- package/packages/database/migrations/0044_add_tool_intervention.sql +1 -0
- package/packages/database/migrations/0044_high_toxin.sql +1 -0
- package/packages/database/migrations/0045_add_tool_intervention.sql +1 -0
- package/packages/database/migrations/meta/0039_snapshot.json +1 -1
- package/packages/database/migrations/meta/0044_snapshot.json +7813 -0
- package/packages/database/migrations/meta/0045_snapshot.json +8431 -0
- package/packages/database/migrations/meta/_journal.json +14 -0
- package/packages/database/src/core/migrations.json +36 -7
- package/packages/database/src/models/message.ts +4 -1
- package/packages/database/src/models/session.ts +42 -1
- package/packages/database/src/schemas/agent.ts +1 -0
- package/packages/database/src/schemas/message.ts +5 -8
- package/packages/electron-client-ipc/src/events/index.ts +6 -1
- package/packages/electron-client-ipc/src/events/remoteServer.ts +8 -0
- package/packages/fetch-sse/package.json +29 -0
- package/packages/{utils/src/fetch → fetch-sse/src}/__tests__/fetchSSE.test.ts +4 -4
- package/packages/{utils/src/fetch → fetch-sse/src}/__tests__/parseError.test.ts +7 -4
- package/packages/{utils/src/fetch → fetch-sse/src}/fetchSSE.ts +2 -2
- package/packages/{utils/src/fetch → fetch-sse/src}/parseError.ts +3 -3
- package/packages/model-bank/src/aiModels/mistral.ts +2 -1
- package/packages/model-runtime/src/core/contextBuilders/anthropic.test.ts +17 -11
- package/packages/model-runtime/src/core/contextBuilders/anthropic.ts +1 -1
- package/packages/model-runtime/src/core/contextBuilders/google.test.ts +1 -1
- package/packages/model-runtime/src/core/contextBuilders/google.ts +3 -6
- package/packages/model-runtime/src/core/contextBuilders/openai.test.ts +4 -2
- package/packages/model-runtime/src/core/contextBuilders/openai.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.test.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts +3 -6
- package/packages/model-runtime/src/core/streams/openai/responsesStream.test.ts +1 -1
- package/packages/model-runtime/src/helpers/mergeChatMethodOptions.ts +2 -1
- package/packages/model-runtime/src/providers/aihubmix/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/generateObject.test.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/baichuan/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/bedrock/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/bfl/createImage.test.ts +4 -4
- package/packages/model-runtime/src/providers/bfl/createImage.ts +1 -1
- package/packages/model-runtime/src/providers/cloudflare/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/cohere/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/google/createImage.test.ts +2 -2
- package/packages/model-runtime/src/providers/google/createImage.ts +1 -1
- package/packages/model-runtime/src/providers/google/generateObject.test.ts +1 -1
- package/packages/model-runtime/src/providers/google/index.test.ts +1 -4
- package/packages/model-runtime/src/providers/groq/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/hunyuan/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/minimax/createImage.test.ts +1 -1
- package/packages/model-runtime/src/providers/mistral/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/moonshot/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/novita/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/ollama/index.test.ts +43 -32
- package/packages/model-runtime/src/providers/ollama/index.ts +31 -7
- package/packages/model-runtime/src/providers/openrouter/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/perplexity/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/ppio/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/qwen/createImage.test.ts +1 -1
- package/packages/model-runtime/src/providers/search1api/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/siliconcloud/createImage.ts +1 -1
- package/packages/model-runtime/src/providers/taichu/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/wenxin/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/zhipu/index.test.ts +1 -1
- package/packages/model-runtime/src/utils/errorResponse.test.ts +1 -1
- package/packages/obervability-otel/src/node.ts +15 -1
- package/packages/ssrf-safe-fetch/index.browser.ts +14 -0
- package/packages/ssrf-safe-fetch/package.json +8 -1
- package/packages/types/src/discover/assistants.ts +16 -0
- package/packages/types/src/index.ts +1 -0
- package/packages/types/src/message/common/base.ts +2 -2
- package/packages/types/src/message/common/tools.ts +16 -0
- package/packages/types/src/message/db/item.ts +15 -1
- package/packages/types/src/message/ui/chat.ts +7 -1
- package/packages/types/src/message/ui/params.ts +15 -1
- package/packages/types/src/meta.ts +4 -0
- package/packages/types/src/session/agentSession.ts +2 -0
- package/packages/types/src/tool/intervention.ts +2 -3
- package/packages/types/src/user/settings/tool.ts +15 -28
- package/packages/utils/src/imageToBase64.ts +17 -10
- package/packages/utils/src/index.ts +1 -1
- package/renovate.json +28 -11
- package/src/app/(backend)/market/agent/[[...segments]]/route.ts +153 -0
- package/src/app/(backend)/market/oidc/[[...segments]]/route.ts +207 -0
- package/src/app/[variants]/(main)/(mobile)/me/settings/features/useCategory.tsx +1 -0
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/PinList/index.tsx +4 -2
- package/src/app/[variants]/(main)/chat/components/topic/features/Topic/TopicListContent/TopicItem/TopicContent.tsx +1 -1
- package/src/app/[variants]/(main)/chat/session/features/SessionListContent/List/Item/Actions.tsx +1 -1
- package/src/app/[variants]/(main)/chat/settings/features/AgentInfoDescription/index.tsx +349 -0
- package/src/app/[variants]/(main)/chat/settings/features/HeaderContent.tsx +2 -2
- package/src/app/[variants]/(main)/chat/settings/features/PublishResultModal/index.tsx +64 -0
- package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/MarketPublishButton.tsx +196 -0
- package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/MarketPublishModal.tsx +358 -0
- package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/index.tsx +75 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/AssistantDetailPage.tsx +11 -2
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/Client.tsx +12 -1
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Nav.tsx +19 -12
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Overview/TagList.tsx +14 -5
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Overview/index.tsx +2 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Related/index.tsx +14 -5
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/SystemRole/TagList.tsx +14 -5
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/SystemRole/index.tsx +43 -29
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Versions/index.tsx +137 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/index.tsx +2 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Header.tsx +9 -10
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Sidebar/ActionButton/AddAgent.tsx +105 -14
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Sidebar/Related/index.tsx +20 -6
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/StatusPage/index.tsx +113 -0
- package/src/app/[variants]/(main)/discover/(detail)/features/Breadcrumb.tsx +4 -3
- package/src/app/[variants]/(main)/discover/(list)/_layout/Desktop/Nav.tsx +3 -1
- package/src/app/[variants]/(main)/discover/(list)/assistant/AssistantPage.tsx +4 -1
- package/src/app/[variants]/(main)/discover/(list)/assistant/Client.tsx +6 -2
- package/src/app/[variants]/(main)/discover/(list)/assistant/features/Category/index.tsx +7 -3
- package/src/app/[variants]/(main)/discover/(list)/assistant/features/List/Item.tsx +13 -2
- package/src/app/[variants]/(main)/discover/(list)/assistant/features/MarketSourceSwitch.tsx +64 -0
- package/src/app/[variants]/(main)/discover/(list)/features/SortButton/index.tsx +26 -7
- package/src/app/[variants]/(main)/profile/_layout/Desktop/index.tsx +10 -10
- package/src/app/[variants]/(main)/settings/_layout/type.ts +1 -1
- package/src/app/[variants]/(main)/settings/agent/index.tsx +11 -10
- package/src/app/[variants]/(main)/settings/common/index.tsx +1 -1
- package/src/app/[variants]/(main)/settings/page.tsx +13 -10
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/Item.tsx +35 -36
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/SearchResult.tsx +5 -5
- package/src/app/[variants]/(main)/settings/provider/_layout/Desktop/Container.tsx +10 -4
- package/src/app/market-auth-callback/layout.tsx +15 -0
- package/src/app/market-auth-callback/page.tsx +196 -0
- package/src/features/AgentSetting/AgentPrompt/TokenTag.tsx +3 -2
- package/src/features/AgentSetting/AgentTTS/SelectWithTTSPreview.tsx +1 -1
- package/src/features/AgentSetting/store/action.ts +1 -1
- package/src/features/ChatInput/ActionBar/STT/browser.tsx +1 -1
- package/src/features/ChatInput/ActionBar/STT/openai.tsx +1 -1
- package/src/features/Conversation/Messages/Group/GroupChildren.tsx +20 -15
- package/src/features/Conversation/Messages/Group/GroupContext.tsx +15 -0
- package/src/features/Conversation/Messages/Group/Tool/Inspector/BuiltinPluginTitle.tsx +2 -4
- package/src/features/Conversation/Messages/Group/Tool/Inspector/ToolTitle.tsx +3 -5
- package/src/features/Conversation/Messages/Group/Tool/Inspector/index.tsx +19 -7
- package/src/features/Conversation/Messages/Group/Tool/Render/Arguments/index.tsx +14 -12
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/ApprovalActions.tsx +143 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/KeyValueEditor.tsx +213 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/ModeSelector.tsx +134 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/index.tsx +99 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/RejectedResponse.tsx +45 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/index.tsx +23 -1
- package/src/features/Conversation/Messages/Group/Tool/index.tsx +42 -18
- package/src/features/Conversation/Messages/Group/Tools.tsx +3 -1
- package/src/features/Conversation/components/Extras/TTS/InitPlayer.tsx +1 -1
- package/src/features/PluginTag/PluginStatus.tsx +1 -1
- package/src/hooks/useAgentOwnershipCheck.ts +143 -0
- package/src/instrumentation.node.ts +3 -2
- package/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsx +364 -0
- package/src/layout/AuthProvider/MarketAuth/errors.ts +75 -0
- package/src/layout/AuthProvider/MarketAuth/index.ts +2 -0
- package/src/layout/AuthProvider/MarketAuth/oidc.ts +382 -0
- package/src/layout/AuthProvider/MarketAuth/types.ts +64 -0
- package/src/layout/AuthProvider/index.tsx +17 -4
- package/src/locales/default/chat.ts +22 -0
- package/src/locales/default/common.ts +1 -0
- package/src/locales/default/discover.ts +46 -0
- package/src/locales/default/index.ts +2 -0
- package/src/locales/default/marketAuth.ts +42 -0
- package/src/locales/default/setting.ts +94 -1
- package/src/locales/default/topic.ts +1 -0
- package/src/server/globalConfig/genServerAiProviderConfig.test.ts +5 -5
- package/src/server/globalConfig/genServerAiProviderConfig.ts +1 -1
- package/src/server/routers/lambda/market/index.ts +36 -14
- package/src/server/routers/lambda/message.ts +6 -3
- package/src/server/services/discover/index.test.ts +153 -11
- package/src/server/services/discover/index.ts +339 -40
- package/src/server/services/message/index.ts +13 -0
- package/src/server/sitemap.ts +49 -35
- package/src/services/_url.ts +15 -1
- package/src/services/chat/chat.test.ts +5 -5
- package/src/services/chat/clientModelRuntime.test.ts +1 -1
- package/src/services/chat/index.ts +6 -6
- package/src/services/chat/types.ts +1 -2
- package/src/services/discover.ts +16 -5
- package/src/services/electron/remoteServer.ts +8 -1
- package/src/services/marketApi.ts +124 -0
- package/src/services/message/index.ts +17 -2
- package/src/services/models.ts +2 -1
- package/src/store/chat/agents/GeneralChatAgent.ts +141 -24
- package/src/store/chat/agents/__tests__/GeneralChatAgent.test.ts +605 -0
- package/src/store/chat/agents/createAgentExecutors.ts +144 -26
- package/src/store/chat/agents/createToolEngine.ts +22 -0
- package/src/store/chat/slices/aiChat/actions/conversationControl.ts +106 -0
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +54 -26
- package/src/store/chat/slices/message/reducer.ts +2 -1
- package/src/store/chat/slices/plugin/actions/optimisticUpdate.ts +26 -1
- package/src/store/discover/slices/assistant/action.ts +20 -7
- package/src/store/user/slices/settings/action.ts +15 -0
- package/{packages/utils/src → src/utils}/electron/desktopRemoteRPCFetch.ts +1 -1
- package/{packages/utils/src → src/utils/server}/parseModels.ts +1 -2
- package/vitest.config.mts +2 -0
- package/packages/model-runtime/src/utils/imageToBase64.test.ts +0 -91
- package/packages/model-runtime/src/utils/imageToBase64.ts +0 -62
- package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +0 -98
- package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/index.tsx +0 -35
- package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/style.ts +0 -47
- /package/packages/{utils/src/fetch → fetch-sse/src}/headers.ts +0 -0
- /package/packages/{utils/src/fetch → fetch-sse/src}/index.ts +0 -0
- /package/packages/{utils/src/fetch → fetch-sse/src}/request.ts +0 -0
- /package/{packages/utils/src → src/utils/server}/__snapshots__/parseModels.test.ts.snap +0 -0
- /package/{packages/utils/src → src/utils/server}/parseModels.test.ts +0 -0
|
@@ -13,15 +13,16 @@ import { useCategory } from '@/features/AgentSetting/AgentCategory/useCategory';
|
|
|
13
13
|
import { ChatSettingsTabs } from '@/store/global/initialState';
|
|
14
14
|
import { useUserStore } from '@/store/user';
|
|
15
15
|
import { settingsSelectors } from '@/store/user/selectors';
|
|
16
|
-
|
|
17
|
-
import
|
|
16
|
+
|
|
17
|
+
import DesktopLayout from './_layout/Desktop';
|
|
18
|
+
import MobileLayout from './_layout/Mobile';
|
|
18
19
|
|
|
19
20
|
type AgentPageType = {
|
|
20
21
|
mobile?: boolean;
|
|
21
|
-
}
|
|
22
|
+
};
|
|
22
23
|
|
|
23
24
|
const Page = memo((props: AgentPageType) => {
|
|
24
|
-
const { mobile } = props
|
|
25
|
+
const { mobile } = props;
|
|
25
26
|
const cateItems = useCategory();
|
|
26
27
|
const [tab, setTab] = useQueryState('tab', {
|
|
27
28
|
defaultValue: ChatSettingsTabs.Prompt,
|
|
@@ -37,7 +38,6 @@ const Page = memo((props: AgentPageType) => {
|
|
|
37
38
|
|
|
38
39
|
if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
|
|
39
40
|
|
|
40
|
-
|
|
41
41
|
const PageContent = (
|
|
42
42
|
<>
|
|
43
43
|
{mobile && (
|
|
@@ -65,12 +65,13 @@ const Page = memo((props: AgentPageType) => {
|
|
|
65
65
|
tab={tab as ChatSettingsTabs}
|
|
66
66
|
/>
|
|
67
67
|
</>
|
|
68
|
-
)
|
|
68
|
+
);
|
|
69
69
|
|
|
70
|
-
return mobile ?
|
|
71
|
-
{PageContent}
|
|
72
|
-
|
|
73
|
-
{PageContent}</DesktopLayout
|
|
70
|
+
return mobile ? (
|
|
71
|
+
<MobileLayout>{PageContent}</MobileLayout>
|
|
72
|
+
) : (
|
|
73
|
+
<DesktopLayout>{PageContent}</DesktopLayout>
|
|
74
|
+
);
|
|
74
75
|
});
|
|
75
76
|
|
|
76
77
|
Page.displayName = 'AgentSetting';
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import ServerLayout from '@/components/server/ServerLayout';
|
|
2
|
+
import { serverFeatureFlags } from '@/config/featureFlags';
|
|
2
3
|
import { metadataModule } from '@/server/metadata';
|
|
3
4
|
import { translation } from '@/server/translation';
|
|
4
5
|
import { DynamicLayoutProps } from '@/types/next';
|
|
5
6
|
import { RouteVariants } from '@/utils/server/routeVariants';
|
|
6
7
|
|
|
8
|
+
import SettingsContextProvider from './_layout/ContextProvider';
|
|
7
9
|
import Desktop from './_layout/Desktop';
|
|
8
10
|
import Mobile from './_layout/Mobile';
|
|
9
11
|
import { LayoutProps } from './_layout/type';
|
|
10
12
|
|
|
11
|
-
import { serverFeatureFlags } from '@/config/featureFlags';
|
|
12
|
-
import SettingsContextProvider from './_layout/ContextProvider';
|
|
13
|
-
|
|
14
13
|
export const generateMetadata = async (props: DynamicLayoutProps) => {
|
|
15
14
|
const locale = await RouteVariants.getLocale(props);
|
|
16
15
|
const { t } = await translation('setting', locale);
|
|
@@ -21,19 +20,23 @@ export const generateMetadata = async (props: DynamicLayoutProps) => {
|
|
|
21
20
|
});
|
|
22
21
|
};
|
|
23
22
|
|
|
24
|
-
const SettingsLayout = ServerLayout<
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const SettingsLayout = ServerLayout<
|
|
24
|
+
LayoutProps & {
|
|
25
|
+
showLLM?: boolean;
|
|
26
|
+
}
|
|
27
|
+
>({ Desktop, Mobile });
|
|
27
28
|
|
|
28
29
|
const SettingsPage = async (props: DynamicLayoutProps) => {
|
|
29
30
|
const showLLM = serverFeatureFlags().showProvider;
|
|
30
31
|
const { showOpenAIProxyUrl, showOpenAIApiKey } = serverFeatureFlags();
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
|
-
<SettingsContextProvider
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
<SettingsContextProvider
|
|
35
|
+
value={{
|
|
36
|
+
showOpenAIApiKey: showOpenAIApiKey,
|
|
37
|
+
showOpenAIProxyUrl: showOpenAIProxyUrl,
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
37
40
|
<SettingsLayout {...props} showLLM={showLLM} />
|
|
38
41
|
</SettingsContextProvider>
|
|
39
42
|
);
|
|
@@ -44,42 +44,41 @@ const ProviderItem = memo<ProviderItemProps>(
|
|
|
44
44
|
const { styles, cx } = useStyles();
|
|
45
45
|
const searchParams = useSearchParams();
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
const activeKey = searchParams.get('provider');
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
49
|
+
const isCustom = source === AiProviderSourceEnum.Custom;
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
className={cx(styles.container, activeKey === id && styles.active)}
|
|
53
|
+
onClick={() => {
|
|
54
|
+
onClick(id);
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<Flexbox gap={8} horizontal>
|
|
58
|
+
{isCustom && logo ? (
|
|
59
|
+
<Avatar
|
|
60
|
+
alt={name || id}
|
|
61
|
+
avatar={logo}
|
|
62
|
+
shape={'square'}
|
|
63
|
+
size={24}
|
|
64
|
+
style={{ borderRadius: 6 }}
|
|
65
|
+
/>
|
|
66
|
+
) : (
|
|
67
|
+
<ProviderIcon provider={id} size={24} style={{ borderRadius: 6 }} type={'avatar'} />
|
|
68
|
+
)}
|
|
69
|
+
{name}
|
|
70
|
+
</Flexbox>
|
|
71
|
+
<Flexbox horizontal>
|
|
72
|
+
{enabled && (
|
|
73
|
+
<Center width={24}>
|
|
74
|
+
<Badge status="success" />
|
|
75
|
+
</Center>
|
|
76
|
+
)}
|
|
77
|
+
{/* cloud slot */}
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
);
|
|
79
|
+
{/* cloud slot */}
|
|
80
|
+
</Flexbox>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
});
|
|
85
84
|
export default ProviderItem;
|
|
@@ -9,10 +9,8 @@ import { useAiInfraStore } from '@/store/aiInfra';
|
|
|
9
9
|
|
|
10
10
|
import ProviderItem from './Item';
|
|
11
11
|
|
|
12
|
-
const SearchResult = memo((props:{
|
|
13
|
-
onProviderSelect
|
|
14
|
-
}) => {
|
|
15
|
-
const {onProviderSelect =()=>{} } = props
|
|
12
|
+
const SearchResult = memo((props: { onProviderSelect?: (key: string) => void }) => {
|
|
13
|
+
const { onProviderSelect = () => {} } = props;
|
|
16
14
|
const { t } = useTranslation('modelProvider');
|
|
17
15
|
|
|
18
16
|
const searchKeyword = useAiInfraStore((s) => s.providerSearchKeyword);
|
|
@@ -37,7 +35,9 @@ const SearchResult = memo((props:{
|
|
|
37
35
|
{t('menu.notFound')}
|
|
38
36
|
</Flexbox>
|
|
39
37
|
) : (
|
|
40
|
-
filteredProviders.map((item) =>
|
|
38
|
+
filteredProviders.map((item) => (
|
|
39
|
+
<ProviderItem {...item} key={item.id} onClick={onProviderSelect} />
|
|
40
|
+
))
|
|
41
41
|
)}
|
|
42
42
|
</Flexbox>
|
|
43
43
|
);
|
|
@@ -5,9 +5,15 @@ import { PropsWithChildren, memo } from 'react';
|
|
|
5
5
|
import SettingContainer from '@/features/Setting/SettingContainer';
|
|
6
6
|
|
|
7
7
|
const Container = memo<PropsWithChildren>(({ children }) => {
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
return (
|
|
9
|
+
<SettingContainer
|
|
10
|
+
style={{
|
|
11
|
+
paddingBlock: 24,
|
|
12
|
+
paddingInline: 32,
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
{children}
|
|
16
|
+
</SettingContainer>
|
|
17
|
+
);
|
|
12
18
|
});
|
|
13
19
|
export default Container;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface RootLayoutProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const RootLayout = ({ children }: RootLayoutProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<html lang="en" suppressHydrationWarning>
|
|
10
|
+
<body>{children}</body>
|
|
11
|
+
</html>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default RootLayout;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Icon } from '@lobehub/ui';
|
|
4
|
+
import { Card, Result } from 'antd';
|
|
5
|
+
import { CheckCircle, Clock, ShieldX } from 'lucide-react';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { Center } from 'react-layout-kit';
|
|
9
|
+
|
|
10
|
+
type CallbackStatus = 'loading' | 'success' | 'error';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Market OIDC 授权回调页面
|
|
14
|
+
* 处理从 OIDC 服务器返回的授权码
|
|
15
|
+
*/
|
|
16
|
+
const MarketAuthCallbackPage = () => {
|
|
17
|
+
const { t } = useTranslation('marketAuth');
|
|
18
|
+
const [status, setStatus] = useState<CallbackStatus>('loading');
|
|
19
|
+
const [message, setMessage] = useState('');
|
|
20
|
+
const [countdown, setCountdown] = useState(3);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
console.log('[MarketAuthCallback] Processing authorization callback');
|
|
24
|
+
|
|
25
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
26
|
+
const code = urlParams.get('code');
|
|
27
|
+
const state = urlParams.get('state');
|
|
28
|
+
const error = urlParams.get('error');
|
|
29
|
+
const errorDescription = urlParams.get('error_description');
|
|
30
|
+
|
|
31
|
+
if (error) {
|
|
32
|
+
console.error('[MarketAuthCallback] Authorization error:', error, errorDescription);
|
|
33
|
+
setStatus('error');
|
|
34
|
+
setMessage(t('callback.messages.authFailed', { error: errorDescription || error }));
|
|
35
|
+
|
|
36
|
+
// 向父窗口发送错误消息
|
|
37
|
+
if (window.opener) {
|
|
38
|
+
window.opener.postMessage(
|
|
39
|
+
{
|
|
40
|
+
error: errorDescription || error,
|
|
41
|
+
type: 'MARKET_AUTH_ERROR',
|
|
42
|
+
},
|
|
43
|
+
window.location.origin,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (code && state) {
|
|
50
|
+
console.log('[MarketAuthCallback] Authorization successful, code received');
|
|
51
|
+
setStatus('success');
|
|
52
|
+
setMessage(t('callback.messages.successWithRedirect'));
|
|
53
|
+
|
|
54
|
+
// 向父窗口发送成功消息
|
|
55
|
+
if (window.opener) {
|
|
56
|
+
window.opener.postMessage(
|
|
57
|
+
{
|
|
58
|
+
code,
|
|
59
|
+
state,
|
|
60
|
+
type: 'MARKET_AUTH_SUCCESS',
|
|
61
|
+
},
|
|
62
|
+
window.location.origin,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// 开始倒计时并在3秒后关闭窗口
|
|
67
|
+
let timeLeft = 3;
|
|
68
|
+
setCountdown(timeLeft);
|
|
69
|
+
|
|
70
|
+
const countdownTimer = setInterval(() => {
|
|
71
|
+
timeLeft -= 1;
|
|
72
|
+
setCountdown(timeLeft);
|
|
73
|
+
|
|
74
|
+
if (timeLeft <= 0) {
|
|
75
|
+
clearInterval(countdownTimer);
|
|
76
|
+
window.close();
|
|
77
|
+
}
|
|
78
|
+
}, 1000);
|
|
79
|
+
} else {
|
|
80
|
+
console.error('[MarketAuthCallback] Missing code or state parameter');
|
|
81
|
+
setStatus('error');
|
|
82
|
+
setMessage(t('callback.messages.missingParams'));
|
|
83
|
+
|
|
84
|
+
if (window.opener) {
|
|
85
|
+
window.opener.postMessage(
|
|
86
|
+
{
|
|
87
|
+
error: 'Missing authorization parameters',
|
|
88
|
+
type: 'MARKET_AUTH_ERROR',
|
|
89
|
+
},
|
|
90
|
+
window.location.origin,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, [t]);
|
|
95
|
+
|
|
96
|
+
const getStatusIcon = () => {
|
|
97
|
+
switch (status) {
|
|
98
|
+
case 'success': {
|
|
99
|
+
return <Icon icon={CheckCircle} />;
|
|
100
|
+
}
|
|
101
|
+
case 'error': {
|
|
102
|
+
return <Icon icon={ShieldX} />;
|
|
103
|
+
}
|
|
104
|
+
default: {
|
|
105
|
+
return <Icon icon={Clock} />;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const getResultStatus = () => {
|
|
111
|
+
switch (status) {
|
|
112
|
+
case 'success': {
|
|
113
|
+
return 'success';
|
|
114
|
+
}
|
|
115
|
+
case 'error': {
|
|
116
|
+
return 'error';
|
|
117
|
+
}
|
|
118
|
+
default: {
|
|
119
|
+
return 'info';
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const getTitle = () => {
|
|
125
|
+
switch (status) {
|
|
126
|
+
case 'loading': {
|
|
127
|
+
return t('callback.titles.loading');
|
|
128
|
+
}
|
|
129
|
+
case 'success': {
|
|
130
|
+
return t('callback.titles.success');
|
|
131
|
+
}
|
|
132
|
+
case 'error': {
|
|
133
|
+
return t('callback.titles.error');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const getSubTitle = () => {
|
|
139
|
+
if (status === 'loading') {
|
|
140
|
+
return t('callback.messages.processing');
|
|
141
|
+
}
|
|
142
|
+
if (status === 'success') {
|
|
143
|
+
return t('callback.messages.successWithCountdown', { countdown, message });
|
|
144
|
+
}
|
|
145
|
+
return message;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const getExtra = () => {
|
|
149
|
+
if (status === 'error') {
|
|
150
|
+
return (
|
|
151
|
+
<button
|
|
152
|
+
onClick={() => window.close()}
|
|
153
|
+
style={{
|
|
154
|
+
backgroundColor: '#ff4d4f',
|
|
155
|
+
border: 'none',
|
|
156
|
+
borderRadius: '6px',
|
|
157
|
+
color: 'white',
|
|
158
|
+
cursor: 'pointer',
|
|
159
|
+
fontSize: '14px',
|
|
160
|
+
padding: '8px 16px',
|
|
161
|
+
}}
|
|
162
|
+
type="button"
|
|
163
|
+
>
|
|
164
|
+
{t('callback.buttons.close')}
|
|
165
|
+
</button>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
return undefined;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<Center height="100vh">
|
|
173
|
+
<Card
|
|
174
|
+
style={{
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
display: 'flex',
|
|
177
|
+
justifyContent: 'center',
|
|
178
|
+
minHeight: 280,
|
|
179
|
+
minWidth: 500,
|
|
180
|
+
width: '100%',
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
<Result
|
|
184
|
+
extra={getExtra()}
|
|
185
|
+
icon={getStatusIcon()}
|
|
186
|
+
status={getResultStatus()}
|
|
187
|
+
style={{ padding: 0 }}
|
|
188
|
+
subTitle={getSubTitle()}
|
|
189
|
+
title={getTitle()}
|
|
190
|
+
/>
|
|
191
|
+
</Card>
|
|
192
|
+
</Center>
|
|
193
|
+
);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export default MarketAuthCallbackPage;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Tag } from '@lobehub/ui';
|
|
2
|
-
import { memo } from 'react';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
3
|
|
|
4
4
|
import { useTokenCount } from '@/hooks/useTokenCount';
|
|
5
5
|
|
|
6
|
-
const Tokens = memo<{ value: string }>(({ value }) => {
|
|
6
|
+
const Tokens = memo<{ style?: React.CSSProperties, value: string; }>(({ value, style }) => {
|
|
7
7
|
const systemTokenCount = useTokenCount(value);
|
|
8
8
|
if (!value || !systemTokenCount) return;
|
|
9
9
|
|
|
@@ -12,6 +12,7 @@ const Tokens = memo<{ value: string }>(({ value }) => {
|
|
|
12
12
|
style={{
|
|
13
13
|
marginTop: 24,
|
|
14
14
|
width: 'fit-content',
|
|
15
|
+
...style,
|
|
15
16
|
}}
|
|
16
17
|
>
|
|
17
18
|
Token: {systemTokenCount}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getMessageError } from '@lobechat/fetch-sse';
|
|
1
2
|
import { ChatMessageError } from '@lobechat/types';
|
|
2
3
|
import { AudioPlayer } from '@lobehub/tts/react';
|
|
3
4
|
import { Alert, Button, Highlighter, Select, SelectProps } from '@lobehub/ui';
|
|
@@ -9,7 +10,6 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
9
10
|
|
|
10
11
|
import { useTTS } from '@/hooks/useTTS';
|
|
11
12
|
import { TTSServer } from '@/types/agent';
|
|
12
|
-
import { getMessageError } from '@/utils/fetch';
|
|
13
13
|
|
|
14
14
|
interface SelectWithTTSPreviewProps extends SelectProps {
|
|
15
15
|
server: TTSServer;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MessageTextChunk } from '@lobechat/fetch-sse';
|
|
1
2
|
import {
|
|
2
3
|
chainPickEmoji,
|
|
3
4
|
chainSummaryAgentName,
|
|
@@ -16,7 +17,6 @@ import { systemAgentSelectors } from '@/store/user/slices/settings/selectors';
|
|
|
16
17
|
import { LobeAgentChatConfig, LobeAgentConfig } from '@/types/agent';
|
|
17
18
|
import { MetaData } from '@/types/meta';
|
|
18
19
|
import { SystemAgentItem } from '@/types/user/settings';
|
|
19
|
-
import { MessageTextChunk } from '@/utils/fetch';
|
|
20
20
|
import { merge } from '@/utils/merge';
|
|
21
21
|
import { setNamespace } from '@/utils/storeDebug';
|
|
22
22
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getMessageError } from '@lobechat/fetch-sse';
|
|
1
2
|
import { ChatMessageError } from '@lobechat/types';
|
|
2
3
|
import { SpeechRecognitionOptions, useSpeechRecognition } from '@lobehub/tts/react';
|
|
3
4
|
import isEqual from 'fast-deep-equal';
|
|
@@ -13,7 +14,6 @@ import { useGlobalStore } from '@/store/global';
|
|
|
13
14
|
import { globalGeneralSelectors } from '@/store/global/selectors';
|
|
14
15
|
import { useUserStore } from '@/store/user';
|
|
15
16
|
import { settingsSelectors } from '@/store/user/selectors';
|
|
16
|
-
import { getMessageError } from '@/utils/fetch';
|
|
17
17
|
|
|
18
18
|
import CommonSTT from './common';
|
|
19
19
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getMessageError } from '@lobechat/fetch-sse';
|
|
1
2
|
import { ChatMessageError } from '@lobechat/types';
|
|
2
3
|
import { getRecordMineType } from '@lobehub/tts';
|
|
3
4
|
import { OpenAISTTOptions, useOpenAISTT } from '@lobehub/tts/react';
|
|
@@ -16,7 +17,6 @@ import { useGlobalStore } from '@/store/global';
|
|
|
16
17
|
import { globalGeneralSelectors } from '@/store/global/selectors';
|
|
17
18
|
import { useUserStore } from '@/store/user';
|
|
18
19
|
import { settingsSelectors } from '@/store/user/selectors';
|
|
19
|
-
import { getMessageError } from '@/utils/fetch';
|
|
20
20
|
|
|
21
21
|
import CommonSTT from './common';
|
|
22
22
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AssistantContentBlock } from '@lobechat/types';
|
|
2
2
|
import { createStyles } from 'antd-style';
|
|
3
3
|
import isEqual from 'fast-deep-equal';
|
|
4
|
-
import { memo } from 'react';
|
|
4
|
+
import { memo, useMemo } from 'react';
|
|
5
5
|
import { Flexbox } from 'react-layout-kit';
|
|
6
6
|
|
|
7
|
+
import { GroupMessageContext } from './GroupContext';
|
|
7
8
|
import GroupItem from './GroupItem';
|
|
8
9
|
|
|
9
10
|
const useStyles = createStyles(({ css }) => {
|
|
@@ -28,21 +29,25 @@ const GroupChildren = memo<GroupChildrenProps>(
|
|
|
28
29
|
({ blocks, contentId, disableEditing, messageIndex, id }) => {
|
|
29
30
|
const { styles } = useStyles();
|
|
30
31
|
|
|
32
|
+
const contextValue = useMemo(() => ({ assistantGroupId: id }), [id]);
|
|
33
|
+
|
|
31
34
|
return (
|
|
32
|
-
<
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
<GroupMessageContext value={contextValue}>
|
|
36
|
+
<Flexbox className={styles.container} gap={8}>
|
|
37
|
+
{blocks.map((item, index) => {
|
|
38
|
+
return (
|
|
39
|
+
<GroupItem
|
|
40
|
+
{...item}
|
|
41
|
+
contentId={contentId}
|
|
42
|
+
disableEditing={disableEditing}
|
|
43
|
+
index={index}
|
|
44
|
+
key={`${id}_${index}`}
|
|
45
|
+
messageIndex={messageIndex}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
})}
|
|
49
|
+
</Flexbox>
|
|
50
|
+
</GroupMessageContext>
|
|
46
51
|
);
|
|
47
52
|
},
|
|
48
53
|
isEqual,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
interface GroupMessageContextValue {
|
|
4
|
+
assistantGroupId: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const GroupMessageContext = createContext<GroupMessageContextValue | null>(null);
|
|
8
|
+
|
|
9
|
+
export const useGroupMessage = () => {
|
|
10
|
+
const context = useContext(GroupMessageContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error('useGroupMessage must be used within GroupMessageContext');
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
};
|
|
@@ -23,20 +23,18 @@ export const useStyles = createStyles(({ css, token }) => ({
|
|
|
23
23
|
|
|
24
24
|
interface BuiltinPluginTitleProps {
|
|
25
25
|
apiName: string;
|
|
26
|
-
hasResult?: boolean;
|
|
27
26
|
icon?: ReactNode;
|
|
28
27
|
identifier: string;
|
|
29
28
|
index: number;
|
|
29
|
+
isLoading?: boolean;
|
|
30
30
|
messageId: string;
|
|
31
31
|
title: string;
|
|
32
32
|
toolCallId: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const BuiltinPluginTitle = memo<BuiltinPluginTitleProps>(({ apiName, title,
|
|
35
|
+
const BuiltinPluginTitle = memo<BuiltinPluginTitleProps>(({ apiName, title, isLoading }) => {
|
|
36
36
|
const { styles } = useStyles();
|
|
37
37
|
|
|
38
|
-
const isLoading = !hasResult;
|
|
39
|
-
|
|
40
38
|
return (
|
|
41
39
|
<Flexbox align={'center'} className={isLoading ? styles.shinyText : ''} gap={4} horizontal>
|
|
42
40
|
<div>{title}</div>
|
|
@@ -31,20 +31,18 @@ export const useStyles = createStyles(({ css, token }) => ({
|
|
|
31
31
|
|
|
32
32
|
interface ToolTitleProps {
|
|
33
33
|
apiName: string;
|
|
34
|
-
hasResult?: boolean;
|
|
35
34
|
identifier: string;
|
|
36
35
|
index: number;
|
|
36
|
+
isLoading?: boolean;
|
|
37
37
|
messageId: string;
|
|
38
38
|
toolCallId: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const ToolTitle = memo<ToolTitleProps>(
|
|
42
|
-
({ identifier, apiName,
|
|
42
|
+
({ identifier, apiName, isLoading, index, toolCallId, messageId }) => {
|
|
43
43
|
const { t } = useTranslation('plugin');
|
|
44
44
|
const { styles } = useStyles();
|
|
45
45
|
|
|
46
|
-
const isLoading = !hasResult;
|
|
47
|
-
|
|
48
46
|
const pluginMeta = useToolStore(toolSelectors.getMetaById(identifier), isEqual);
|
|
49
47
|
|
|
50
48
|
const plugins = useMemo(
|
|
@@ -69,9 +67,9 @@ const ToolTitle = memo<ToolTitleProps>(
|
|
|
69
67
|
return (
|
|
70
68
|
<BuiltinPluginTitle
|
|
71
69
|
{...builtinPluginTitle}
|
|
72
|
-
hasResult={hasResult}
|
|
73
70
|
identifier={identifier}
|
|
74
71
|
index={index}
|
|
72
|
+
isLoading={isLoading}
|
|
75
73
|
messageId={messageId}
|
|
76
74
|
toolCallId={toolCallId}
|
|
77
75
|
/>
|