@lobehub/lobehub 2.0.0-next.273 → 2.0.0-next.274
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 +34 -0
- package/changelog/v1.json +9 -0
- package/locales/ar/chat.json +7 -0
- package/locales/ar/models.json +2 -3
- package/locales/ar/plugin.json +22 -1
- package/locales/bg-BG/chat.json +7 -0
- package/locales/bg-BG/models.json +3 -3
- package/locales/bg-BG/plugin.json +22 -1
- package/locales/de-DE/chat.json +7 -0
- package/locales/de-DE/models.json +3 -4
- package/locales/de-DE/plugin.json +22 -1
- package/locales/en-US/chat.json +7 -0
- package/locales/en-US/models.json +5 -5
- package/locales/en-US/plugin.json +22 -1
- package/locales/es-ES/chat.json +7 -0
- package/locales/es-ES/models.json +3 -4
- package/locales/es-ES/plugin.json +22 -1
- package/locales/fa-IR/chat.json +7 -0
- package/locales/fa-IR/models.json +3 -4
- package/locales/fa-IR/plugin.json +22 -1
- package/locales/fr-FR/chat.json +7 -0
- package/locales/fr-FR/models.json +50 -3
- package/locales/fr-FR/plugin.json +22 -1
- package/locales/it-IT/chat.json +7 -0
- package/locales/it-IT/models.json +3 -3
- package/locales/it-IT/plugin.json +22 -1
- package/locales/ja-JP/chat.json +7 -0
- package/locales/ja-JP/models.json +43 -4
- package/locales/ja-JP/plugin.json +22 -1
- package/locales/ko-KR/chat.json +7 -0
- package/locales/ko-KR/models.json +3 -4
- package/locales/ko-KR/plugin.json +22 -1
- package/locales/nl-NL/chat.json +7 -0
- package/locales/nl-NL/models.json +51 -3
- package/locales/nl-NL/plugin.json +22 -1
- package/locales/pl-PL/chat.json +7 -0
- package/locales/pl-PL/models.json +3 -3
- package/locales/pl-PL/plugin.json +22 -1
- package/locales/pt-BR/chat.json +7 -0
- package/locales/pt-BR/models.json +3 -4
- package/locales/pt-BR/plugin.json +22 -1
- package/locales/ru-RU/chat.json +7 -0
- package/locales/ru-RU/models.json +3 -4
- package/locales/ru-RU/plugin.json +22 -1
- package/locales/tr-TR/chat.json +7 -0
- package/locales/tr-TR/models.json +3 -4
- package/locales/tr-TR/plugin.json +22 -1
- package/locales/vi-VN/chat.json +7 -0
- package/locales/vi-VN/models.json +3 -3
- package/locales/vi-VN/plugin.json +22 -1
- package/locales/zh-CN/chat.json +7 -0
- package/locales/zh-CN/models.json +54 -4
- package/locales/zh-CN/plugin.json +22 -1
- package/locales/zh-TW/chat.json +7 -0
- package/locales/zh-TW/models.json +43 -4
- package/locales/zh-TW/plugin.json +22 -1
- package/package.json +1 -1
- package/packages/builtin-tool-agent-builder/package.json +1 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/GetAvailableModels/index.tsx +66 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/InstallPlugin/index.tsx +63 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/SearchMarketTools/index.tsx +64 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/UpdateConfig/index.tsx +94 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/UpdatePrompt/index.tsx +96 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/index.ts +29 -0
- package/packages/builtin-tool-agent-builder/src/client/index.ts +13 -0
- package/packages/builtin-tool-agent-builder/src/executor.ts +132 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ExecuteCode/index.tsx +5 -14
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/RunCommand/index.tsx +5 -13
- package/packages/builtin-tool-group-agent-builder/package.json +7 -1
- package/packages/builtin-tool-group-agent-builder/src/ExecutionRuntime/index.ts +331 -87
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/BatchCreateAgents/index.tsx +110 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/CreateAgent/index.tsx +72 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/InviteAgent/index.tsx +57 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/RemoveAgent/index.tsx +57 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/SearchAgent/index.tsx +66 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateAgentPrompt/index.tsx +120 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroup/index.tsx +87 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroupPrompt/index.tsx +99 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/index.ts +52 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/BatchCreateAgents.tsx +103 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateAgentPrompt/index.tsx +36 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateGroupPrompt/index.tsx +36 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/index.ts +16 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/BatchCreateAgents/index.tsx +88 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateAgentPrompt/index.tsx +37 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateGroupPrompt/index.tsx +35 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/index.ts +22 -0
- package/packages/builtin-tool-group-agent-builder/src/client/index.ts +26 -0
- package/packages/builtin-tool-group-agent-builder/src/executor.ts +284 -0
- package/packages/builtin-tool-group-agent-builder/src/index.ts +1 -14
- package/packages/builtin-tool-group-agent-builder/src/manifest.ts +160 -15
- package/packages/builtin-tool-group-agent-builder/src/systemRole.ts +232 -46
- package/packages/builtin-tool-group-agent-builder/src/types.ts +191 -41
- package/packages/builtin-tool-group-management/src/client/Inspector/Broadcast/index.tsx +2 -2
- package/packages/builtin-tool-group-management/src/manifest.ts +1 -1
- package/packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx +5 -11
- package/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx +6 -15
- package/packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/ExecTask/index.tsx +6 -17
- package/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx +3 -9
- package/packages/builtin-tool-knowledge-base/src/client/Inspector/ReadKnowledge/index.tsx +4 -16
- package/packages/builtin-tool-knowledge-base/src/client/Inspector/SearchKnowledgeBase/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/EditLocalFile/index.tsx +4 -12
- package/packages/builtin-tool-local-system/src/client/Inspector/GlobLocalFiles/index.tsx +5 -13
- package/packages/builtin-tool-local-system/src/client/Inspector/GrepContent/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/ListLocalFiles/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/RenameLocalFile/index.tsx +5 -11
- package/packages/builtin-tool-local-system/src/client/Inspector/RunCommand/index.tsx +5 -13
- package/packages/builtin-tool-local-system/src/client/Inspector/SearchLocalFiles/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/WriteLocalFile/index.tsx +6 -15
- package/packages/builtin-tool-notebook/src/client/Inspector/CreateDocument/index.tsx +7 -15
- package/packages/builtin-tool-page-agent/src/client/Inspector/EditTitle/index.tsx +5 -14
- package/packages/builtin-tool-page-agent/src/client/Inspector/GetPageContent/index.tsx +7 -8
- package/packages/builtin-tool-page-agent/src/client/Inspector/InitPage/index.tsx +4 -10
- package/packages/builtin-tool-page-agent/src/client/Inspector/ModifyNodes/index.tsx +3 -9
- package/packages/builtin-tool-page-agent/src/client/Inspector/ReplaceText/index.tsx +5 -11
- package/packages/builtin-tool-web-browsing/src/client/Inspector/CrawlMultiPages/index.tsx +6 -15
- package/packages/builtin-tool-web-browsing/src/client/Inspector/CrawlSinglePage/index.tsx +6 -15
- package/packages/builtin-tool-web-browsing/src/client/Inspector/Search/index.tsx +4 -15
- package/packages/database/src/models/chatGroup.ts +1 -1
- package/packages/model-bank/src/aiModels/aihubmix.ts +2 -1
- package/packages/model-bank/src/aiModels/google.ts +2 -1
- package/packages/model-bank/src/aiModels/infiniai.ts +9 -6
- package/packages/model-bank/src/aiModels/minimax.ts +9 -5
- package/packages/model-bank/src/aiModels/ollamacloud.ts +4 -2
- package/packages/model-bank/src/aiModels/vertexai.ts +2 -1
- package/packages/types/src/agentGroup/index.ts +8 -0
- package/patches/@upstash__qstash.patch +13 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/agent/cron/[cronId]/index.tsx +4 -3
- package/src/app/[variants]/(main)/agent/profile/features/ProfileEditor/index.tsx +1 -1
- package/src/app/[variants]/(main)/agent/profile/features/store/action.ts +18 -21
- package/src/app/[variants]/(main)/group/_layout/GroupIdSync.tsx +6 -1
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/AgentProfilePopup.tsx +29 -21
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMember.tsx +1 -0
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMemberItem.tsx +35 -18
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/AddTopicButon.tsx +2 -10
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Nav.tsx +10 -2
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/index.tsx +1 -2
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/AgentBuilderProvider.tsx +1 -0
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/TopicSelector.tsx +15 -9
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/index.tsx +12 -6
- package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor/AgentHeader.tsx → GroupProfile/GroupHeader.tsx} +22 -29
- package/src/app/[variants]/(main)/group/profile/features/GroupProfile/index.tsx +96 -0
- package/src/app/[variants]/(main)/group/profile/features/Header/AgentBuilderToggle.tsx +3 -4
- package/src/app/[variants]/(main)/group/profile/features/Header/AutoSaveHint.tsx +11 -7
- package/src/app/[variants]/(main)/group/profile/features/Header/ChromeTabs/index.tsx +147 -0
- package/src/app/[variants]/(main)/group/profile/features/Header/index.tsx +104 -13
- package/src/app/[variants]/(main)/group/profile/features/MemberProfile/AgentHeader.tsx +222 -0
- package/src/app/[variants]/(main)/group/profile/features/MemberProfile/index.tsx +155 -0
- package/src/app/[variants]/(main)/group/profile/features/ProfileHydration.tsx +63 -5
- package/src/app/[variants]/(main)/group/profile/index.tsx +34 -37
- package/src/app/[variants]/(mobile)/(home)/_layout/SessionHydration.tsx +1 -1
- package/src/app/[variants]/(mobile)/(home)/features/SessionListContent/List/Item/index.tsx +1 -1
- package/src/features/AgentBuilder/index.tsx +16 -1
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx +3 -2
- package/src/features/EditorCanvas/EditorCanvas.test.tsx +206 -0
- package/src/features/EditorCanvas/EditorDataMode.tsx +53 -19
- package/src/features/EditorModal/index.tsx +2 -2
- package/src/features/NavPanel/components/SessionHydration.tsx +1 -1
- package/src/features/ShareModal/ShareImage/ChatList/index.tsx +1 -1
- package/src/features/ShareModal/SharePdf/index.tsx +1 -1
- package/src/hooks/useBidirectionalQuerySync.ts +112 -0
- package/src/locales/default/chat.ts +10 -0
- package/src/locales/default/plugin.ts +22 -1
- package/src/server/modules/AgentRuntime/RuntimeExecutors.ts +45 -45
- package/src/server/modules/KeyVaultsEncrypt/index.ts +6 -6
- package/src/server/modules/S3/index.ts +1 -1
- package/src/server/routers/lambda/agent.ts +24 -0
- package/src/server/routers/lambda/agentGroup.ts +39 -0
- package/src/services/agent.ts +22 -0
- package/src/services/chatGroup/index.ts +14 -0
- package/src/store/agent/selectors/selectors.ts +3 -0
- package/src/store/agentGroup/initialState.ts +6 -0
- package/src/store/agentGroup/selectors/byId.ts +3 -1
- package/src/store/agentGroup/selectors/current.ts +2 -2
- package/src/store/agentGroup/slices/lifecycle.ts +18 -0
- package/src/store/chat/agents/__tests__/createAgentExecutors/fixtures/mockStore.ts +1 -1
- package/src/store/chat/slices/aiAgent/actions/__tests__/agentGroup.test.ts +4 -1
- package/src/store/chat/slices/aiAgent/actions/agentGroup.ts +1 -1
- package/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts +65 -0
- package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +2 -1
- package/src/store/chat/slices/builtinTool/actions/__tests__/search.test.ts +1 -1
- package/src/store/chat/slices/builtinTool/actions/index.ts +1 -6
- package/src/store/chat/slices/message/action.test.ts +5 -5
- package/src/store/chat/slices/message/actions/publicApi.ts +5 -5
- package/src/store/chat/slices/message/initialState.ts +0 -5
- package/src/store/chat/slices/message/selectors/displayMessage.test.ts +4 -4
- package/src/store/chat/slices/plugin/action.test.ts +54 -19
- package/src/store/chat/slices/plugin/actions/pluginTypes.ts +15 -21
- package/src/store/chat/slices/topic/action.test.ts +74 -24
- package/src/store/chat/slices/topic/action.ts +21 -13
- package/src/store/chat/slices/topic/selectors.test.ts +1 -1
- package/src/store/global/initialState.ts +10 -0
- package/src/store/global/selectors/systemStatus.ts +5 -0
- package/src/store/groupProfile/action.ts +168 -0
- package/src/store/groupProfile/index.ts +16 -0
- package/src/{app/[variants]/(main)/group/profile/features/store → store/groupProfile}/initialState.ts +17 -0
- package/src/store/groupProfile/selectors.ts +13 -0
- package/src/store/tool/slices/builtin/executors/index.ts +4 -0
- package/src/styles/text.ts +16 -0
- package/src/tools/inspectors.ts +13 -0
- package/src/tools/renders.ts +3 -0
- package/src/tools/streamings.ts +8 -0
- package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/TypoBar.tsx +0 -129
- package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/index.tsx +0 -138
- package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/useSlashItems.tsx +0 -139
- package/src/app/[variants]/(main)/group/profile/features/ProfileEditor/index.tsx +0 -82
- package/src/app/[variants]/(main)/group/profile/features/ProfileProvider.tsx +0 -20
- package/src/app/[variants]/(main)/group/profile/features/StoreUpdater.tsx +0 -24
- package/src/app/[variants]/(main)/group/profile/features/store/action.ts +0 -163
- package/src/app/[variants]/(main)/group/profile/features/store/index.ts +0 -23
- package/src/app/[variants]/(main)/group/profile/features/store/selectors.ts +0 -7
- package/src/features/EditorModal/EditorCanvas.tsx +0 -84
- package/src/features/EditorModal/Typobar.tsx +0 -139
- package/src/store/chat/slices/builtinTool/actions/agentBuilder.ts +0 -192
- package/src/store/chat/slices/builtinTool/actions/groupAgentBuilder.ts +0 -242
- package/src/tools/executionRuntimes.ts +0 -14
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/AgentTool.tsx +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/MentionDropdown.tsx +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/index.tsx +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/types.ts +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/useMentionItems.tsx +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
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 { InviteAgentParams, InviteAgentState } 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 InviteAgentInspector = memo<
|
|
21
|
+
BuiltinInspectorProps<InviteAgentParams, InviteAgentState>
|
|
22
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
23
|
+
const { t } = useTranslation('plugin');
|
|
24
|
+
|
|
25
|
+
const agentId = args?.agentId || partialArgs?.agentId;
|
|
26
|
+
const displayName = pluginState?.agentName || agentId;
|
|
27
|
+
|
|
28
|
+
// Initial streaming state
|
|
29
|
+
if (isArgumentsStreaming && !agentId) {
|
|
30
|
+
return (
|
|
31
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
32
|
+
<span>{t('builtins.lobe-group-agent-builder.apiName.inviteAgent')}</span>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const isSuccess = pluginState?.success;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
className={cx(
|
|
42
|
+
inspectorTextStyles.root,
|
|
43
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
<span>{t('builtins.lobe-group-agent-builder.apiName.inviteAgent')}: </span>
|
|
47
|
+
{displayName && <span className={highlightTextStyles.primary}>{displayName}</span>}
|
|
48
|
+
{!isLoading && isSuccess && (
|
|
49
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
InviteAgentInspector.displayName = 'InviteAgentInspector';
|
|
56
|
+
|
|
57
|
+
export default InviteAgentInspector;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { RemoveAgentParams, RemoveAgentState } 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 RemoveAgentInspector = memo<
|
|
21
|
+
BuiltinInspectorProps<RemoveAgentParams, RemoveAgentState>
|
|
22
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
23
|
+
const { t } = useTranslation('plugin');
|
|
24
|
+
|
|
25
|
+
const agentId = args?.agentId || partialArgs?.agentId;
|
|
26
|
+
const displayName = pluginState?.agentName || agentId;
|
|
27
|
+
|
|
28
|
+
// Initial streaming state
|
|
29
|
+
if (isArgumentsStreaming && !agentId) {
|
|
30
|
+
return (
|
|
31
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
32
|
+
<span>{t('builtins.lobe-group-agent-builder.apiName.removeAgent')}</span>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const isSuccess = pluginState?.success;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
className={cx(
|
|
42
|
+
inspectorTextStyles.root,
|
|
43
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
<span>{t('builtins.lobe-group-agent-builder.apiName.removeAgent')}: </span>
|
|
47
|
+
{displayName && <span className={highlightTextStyles.primary}>{displayName}</span>}
|
|
48
|
+
{!isLoading && isSuccess && (
|
|
49
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
RemoveAgentInspector.displayName = 'RemoveAgentInspector';
|
|
56
|
+
|
|
57
|
+
export default RemoveAgentInspector;
|
|
@@ -0,0 +1,66 @@
|
|
|
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 { SearchAgentParams, SearchAgentState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
export const SearchAgentInspector = memo<
|
|
14
|
+
BuiltinInspectorProps<SearchAgentParams, SearchAgentState>
|
|
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-group-agent-builder.apiName.searchAgent')}</span>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const resultCount = pluginState?.total ?? pluginState?.agents?.length ?? 0;
|
|
30
|
+
const hasResults = resultCount > 0;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
className={cx(
|
|
35
|
+
inspectorTextStyles.root,
|
|
36
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
37
|
+
)}
|
|
38
|
+
>
|
|
39
|
+
<span>{t('builtins.lobe-group-agent-builder.apiName.searchAgent')}</span>
|
|
40
|
+
{query && (
|
|
41
|
+
<>
|
|
42
|
+
: <span className={highlightTextStyles.primary}>{query}</span>
|
|
43
|
+
</>
|
|
44
|
+
)}
|
|
45
|
+
{!isLoading &&
|
|
46
|
+
!isArgumentsStreaming &&
|
|
47
|
+
pluginState?.agents &&
|
|
48
|
+
(hasResults ? (
|
|
49
|
+
<span style={{ marginInlineStart: 4 }}>({resultCount})</span>
|
|
50
|
+
) : (
|
|
51
|
+
<Text
|
|
52
|
+
as={'span'}
|
|
53
|
+
color={cssVar.colorTextDescription}
|
|
54
|
+
fontSize={12}
|
|
55
|
+
style={{ marginInlineStart: 4 }}
|
|
56
|
+
>
|
|
57
|
+
({t('builtins.lobe-group-agent-builder.inspector.noResults')})
|
|
58
|
+
</Text>
|
|
59
|
+
))}
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
SearchAgentInspector.displayName = 'SearchAgentInspector';
|
|
65
|
+
|
|
66
|
+
export default SearchAgentInspector;
|
package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateAgentPrompt/index.tsx
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { Avatar, Flexbox, Text } from '@lobehub/ui';
|
|
5
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
+
import { memo, useMemo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { useAgentGroupStore } from '@/store/agentGroup';
|
|
10
|
+
import { agentGroupSelectors } from '@/store/agentGroup/selectors';
|
|
11
|
+
import { inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
12
|
+
|
|
13
|
+
import type { UpdateAgentPromptParams, UpdateAgentPromptState } from '../../../types';
|
|
14
|
+
|
|
15
|
+
const styles = createStaticStyles(({ css, cssVar: cv }) => ({
|
|
16
|
+
agentName: css`
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
|
|
19
|
+
max-width: 120px;
|
|
20
|
+
|
|
21
|
+
font-weight: 500;
|
|
22
|
+
text-overflow: ellipsis;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
`,
|
|
25
|
+
label: css`
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
color: ${cv.colorTextSecondary};
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
`,
|
|
30
|
+
root: css`
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
display: flex;
|
|
33
|
+
gap: 6px;
|
|
34
|
+
align-items: center;
|
|
35
|
+
`,
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
export const UpdateAgentPromptInspector = memo<
|
|
39
|
+
BuiltinInspectorProps<UpdateAgentPromptParams, UpdateAgentPromptState>
|
|
40
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
41
|
+
const { t } = useTranslation('plugin');
|
|
42
|
+
|
|
43
|
+
const agentId = args?.agentId || partialArgs?.agentId;
|
|
44
|
+
const prompt = args?.prompt || partialArgs?.prompt;
|
|
45
|
+
|
|
46
|
+
// Get agent info from the current group
|
|
47
|
+
const agent = useAgentGroupStore((s) => {
|
|
48
|
+
const agents = agentGroupSelectors.currentGroupAgents(s);
|
|
49
|
+
return agents.find((a) => a.id === agentId);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Calculate length difference
|
|
53
|
+
const lengthDiff = useMemo(() => {
|
|
54
|
+
if (!pluginState) return null;
|
|
55
|
+
|
|
56
|
+
const newLength = pluginState.newPrompt?.length ?? 0;
|
|
57
|
+
const prevLength = pluginState.previousPrompt?.length ?? 0;
|
|
58
|
+
return newLength - prevLength;
|
|
59
|
+
}, [pluginState]);
|
|
60
|
+
|
|
61
|
+
// Initial streaming state
|
|
62
|
+
if (isArgumentsStreaming && !agentId) {
|
|
63
|
+
return (
|
|
64
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
65
|
+
<span>{t('builtins.lobe-group-agent-builder.apiName.updateAgentPrompt')}</span>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const streamingLength = prompt?.length ?? 0;
|
|
71
|
+
|
|
72
|
+
const isSupervisor = agent?.isSupervisor ?? false;
|
|
73
|
+
|
|
74
|
+
// Use different i18n key for supervisor
|
|
75
|
+
const labelKey = isSupervisor
|
|
76
|
+
? 'builtins.lobe-group-agent-builder.apiName.updateSupervisorPrompt'
|
|
77
|
+
: 'builtins.lobe-group-agent-builder.apiName.updateAgentPrompt';
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Flexbox
|
|
81
|
+
align="center"
|
|
82
|
+
className={cx(styles.root, (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText)}
|
|
83
|
+
gap={6}
|
|
84
|
+
horizontal
|
|
85
|
+
>
|
|
86
|
+
<span className={styles.label}>{t(labelKey)}</span>
|
|
87
|
+
{/* Only show avatar and title for non-supervisor agents */}
|
|
88
|
+
{agent && !isSupervisor && (
|
|
89
|
+
<>
|
|
90
|
+
<Avatar avatar={agent.avatar ?? undefined} size={18} title={agent.title ?? undefined} />
|
|
91
|
+
<span className={styles.agentName}>{agent.title}</span>
|
|
92
|
+
</>
|
|
93
|
+
)}
|
|
94
|
+
{/* Show length diff when completed */}
|
|
95
|
+
{!isLoading && !isArgumentsStreaming && lengthDiff !== null && (
|
|
96
|
+
<Text
|
|
97
|
+
as="span"
|
|
98
|
+
code
|
|
99
|
+
color={lengthDiff >= 0 ? cssVar.colorSuccess : cssVar.colorError}
|
|
100
|
+
fontSize={12}
|
|
101
|
+
>
|
|
102
|
+
{lengthDiff >= 0 ? '+' : ''}
|
|
103
|
+
{lengthDiff}
|
|
104
|
+
{t('builtins.lobe-agent-builder.inspector.chars')}
|
|
105
|
+
</Text>
|
|
106
|
+
)}
|
|
107
|
+
{/* Show streaming length */}
|
|
108
|
+
{(isArgumentsStreaming || isLoading) && streamingLength > 0 && (
|
|
109
|
+
<Text as="span" code color={cssVar.colorTextDescription} fontSize={12}>
|
|
110
|
+
({streamingLength}
|
|
111
|
+
{t('builtins.lobe-agent-builder.inspector.chars')})
|
|
112
|
+
</Text>
|
|
113
|
+
)}
|
|
114
|
+
</Flexbox>
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
UpdateAgentPromptInspector.displayName = 'UpdateAgentPromptInspector';
|
|
119
|
+
|
|
120
|
+
export default UpdateAgentPromptInspector;
|
|
@@ -0,0 +1,87 @@
|
|
|
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, useMemo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { UpdateGroupParams, UpdateGroupState } 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 UpdateGroupInspector = memo<BuiltinInspectorProps<UpdateGroupParams, UpdateGroupState>>(
|
|
21
|
+
({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
22
|
+
const { t } = useTranslation('plugin');
|
|
23
|
+
|
|
24
|
+
const config = args?.config || partialArgs?.config;
|
|
25
|
+
const meta = args?.meta || partialArgs?.meta;
|
|
26
|
+
|
|
27
|
+
// Build display text from updated fields
|
|
28
|
+
const displayText = useMemo(() => {
|
|
29
|
+
const fields: string[] = [];
|
|
30
|
+
// Config fields
|
|
31
|
+
if (config?.openingMessage !== undefined) {
|
|
32
|
+
fields.push(t('builtins.lobe-group-agent-builder.inspector.openingMessage'));
|
|
33
|
+
}
|
|
34
|
+
if (config?.openingQuestions !== undefined) {
|
|
35
|
+
fields.push(t('builtins.lobe-group-agent-builder.inspector.openingQuestions'));
|
|
36
|
+
}
|
|
37
|
+
// Meta fields
|
|
38
|
+
if (meta?.title !== undefined) {
|
|
39
|
+
fields.push(t('builtins.lobe-group-agent-builder.inspector.title'));
|
|
40
|
+
}
|
|
41
|
+
if (meta?.description !== undefined) {
|
|
42
|
+
fields.push(t('builtins.lobe-group-agent-builder.inspector.description'));
|
|
43
|
+
}
|
|
44
|
+
if (meta?.avatar !== undefined) {
|
|
45
|
+
fields.push(t('builtins.lobe-group-agent-builder.inspector.avatar'));
|
|
46
|
+
}
|
|
47
|
+
if (meta?.backgroundColor !== undefined) {
|
|
48
|
+
fields.push(t('builtins.lobe-group-agent-builder.inspector.backgroundColor'));
|
|
49
|
+
}
|
|
50
|
+
return fields.length > 0 ? fields.join(', ') : '';
|
|
51
|
+
}, [config, meta, t]);
|
|
52
|
+
|
|
53
|
+
// Initial streaming state
|
|
54
|
+
if (isArgumentsStreaming && !displayText) {
|
|
55
|
+
return (
|
|
56
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
57
|
+
<span>{t('builtins.lobe-group-agent-builder.apiName.updateGroup')}</span>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const isSuccess = pluginState?.success;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
className={cx(
|
|
67
|
+
inspectorTextStyles.root,
|
|
68
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
69
|
+
)}
|
|
70
|
+
>
|
|
71
|
+
<span>{t('builtins.lobe-group-agent-builder.apiName.updateGroup')}</span>
|
|
72
|
+
{displayText && (
|
|
73
|
+
<>
|
|
74
|
+
: <span className={highlightTextStyles.primary}>{displayText}</span>
|
|
75
|
+
</>
|
|
76
|
+
)}
|
|
77
|
+
{!isLoading && isSuccess && (
|
|
78
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
79
|
+
)}
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
UpdateGroupInspector.displayName = 'UpdateGroupInspector';
|
|
86
|
+
|
|
87
|
+
export default UpdateGroupInspector;
|
package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroupPrompt/index.tsx
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { Flexbox, Text } from '@lobehub/ui';
|
|
5
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
+
import { memo, useMemo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { UpdateGroupPromptParams, UpdateGroupPromptState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
const styles = createStaticStyles(({ css, cssVar: cv }) => ({
|
|
14
|
+
groupName: css`
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
|
|
17
|
+
max-width: 120px;
|
|
18
|
+
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
text-overflow: ellipsis;
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
`,
|
|
23
|
+
label: css`
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
color: ${cv.colorTextSecondary};
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
`,
|
|
28
|
+
root: css`
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
display: flex;
|
|
31
|
+
gap: 6px;
|
|
32
|
+
align-items: center;
|
|
33
|
+
`,
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
export const UpdateGroupPromptInspector = memo<
|
|
37
|
+
BuiltinInspectorProps<UpdateGroupPromptParams, UpdateGroupPromptState>
|
|
38
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
39
|
+
const { t } = useTranslation('plugin');
|
|
40
|
+
|
|
41
|
+
const prompt = args?.prompt || partialArgs?.prompt;
|
|
42
|
+
|
|
43
|
+
// Calculate length difference
|
|
44
|
+
const lengthDiff = useMemo(() => {
|
|
45
|
+
if (!pluginState) return null;
|
|
46
|
+
|
|
47
|
+
const newLength = pluginState.newPrompt?.length ?? 0;
|
|
48
|
+
const prevLength = pluginState.previousPrompt?.length ?? 0;
|
|
49
|
+
return newLength - prevLength;
|
|
50
|
+
}, [pluginState]);
|
|
51
|
+
|
|
52
|
+
// Initial streaming state
|
|
53
|
+
if (isArgumentsStreaming && !prompt) {
|
|
54
|
+
return (
|
|
55
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
56
|
+
<span>{t('builtins.lobe-group-agent-builder.apiName.updateGroupPrompt')}</span>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const streamingLength = prompt?.length ?? 0;
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Flexbox
|
|
65
|
+
align="center"
|
|
66
|
+
className={cx(styles.root, (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText)}
|
|
67
|
+
gap={6}
|
|
68
|
+
horizontal
|
|
69
|
+
>
|
|
70
|
+
<span className={styles.label}>
|
|
71
|
+
{t('builtins.lobe-group-agent-builder.apiName.updateGroupPrompt')}
|
|
72
|
+
</span>
|
|
73
|
+
{/* Show length diff when completed */}
|
|
74
|
+
{!isLoading && !isArgumentsStreaming && lengthDiff !== null && (
|
|
75
|
+
<Text
|
|
76
|
+
as="span"
|
|
77
|
+
code
|
|
78
|
+
color={lengthDiff >= 0 ? cssVar.colorSuccess : cssVar.colorError}
|
|
79
|
+
fontSize={12}
|
|
80
|
+
>
|
|
81
|
+
{lengthDiff >= 0 ? '+' : ''}
|
|
82
|
+
{lengthDiff}
|
|
83
|
+
{t('builtins.lobe-agent-builder.inspector.chars')}
|
|
84
|
+
</Text>
|
|
85
|
+
)}
|
|
86
|
+
{/* Show streaming length */}
|
|
87
|
+
{(isArgumentsStreaming || isLoading) && streamingLength > 0 && (
|
|
88
|
+
<Text as="span" code color={cssVar.colorTextDescription} fontSize={12}>
|
|
89
|
+
({streamingLength}
|
|
90
|
+
{t('builtins.lobe-agent-builder.inspector.chars')})
|
|
91
|
+
</Text>
|
|
92
|
+
)}
|
|
93
|
+
</Flexbox>
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
UpdateGroupPromptInspector.displayName = 'UpdateGroupPromptInspector';
|
|
98
|
+
|
|
99
|
+
export default UpdateGroupPromptInspector;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Import shared inspectors from agent-builder
|
|
2
|
+
import {
|
|
3
|
+
GetAvailableModelsInspector,
|
|
4
|
+
InstallPluginInspector,
|
|
5
|
+
SearchMarketToolsInspector,
|
|
6
|
+
UpdateConfigInspector,
|
|
7
|
+
} from '@lobechat/builtin-tool-agent-builder/client';
|
|
8
|
+
import { type BuiltinInspector } from '@lobechat/types';
|
|
9
|
+
|
|
10
|
+
import { GroupAgentBuilderApiName } from '../../types';
|
|
11
|
+
import { BatchCreateAgentsInspector } from './BatchCreateAgents';
|
|
12
|
+
import { CreateAgentInspector } from './CreateAgent';
|
|
13
|
+
import { InviteAgentInspector } from './InviteAgent';
|
|
14
|
+
import { RemoveAgentInspector } from './RemoveAgent';
|
|
15
|
+
import { SearchAgentInspector } from './SearchAgent';
|
|
16
|
+
import { UpdateAgentPromptInspector } from './UpdateAgentPrompt';
|
|
17
|
+
import { UpdateGroupInspector } from './UpdateGroup';
|
|
18
|
+
import { UpdateGroupPromptInspector } from './UpdateGroupPrompt';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Group Agent Builder Inspector Components Registry
|
|
22
|
+
*
|
|
23
|
+
* Inspector components customize the title/header area
|
|
24
|
+
* of tool calls in the conversation UI.
|
|
25
|
+
*/
|
|
26
|
+
export const GroupAgentBuilderInspectors: Record<string, BuiltinInspector> = {
|
|
27
|
+
// Group-specific inspectors
|
|
28
|
+
[GroupAgentBuilderApiName.batchCreateAgents]: BatchCreateAgentsInspector as BuiltinInspector,
|
|
29
|
+
[GroupAgentBuilderApiName.createAgent]: CreateAgentInspector as BuiltinInspector,
|
|
30
|
+
[GroupAgentBuilderApiName.inviteAgent]: InviteAgentInspector as BuiltinInspector,
|
|
31
|
+
[GroupAgentBuilderApiName.removeAgent]: RemoveAgentInspector as BuiltinInspector,
|
|
32
|
+
[GroupAgentBuilderApiName.searchAgent]: SearchAgentInspector as BuiltinInspector,
|
|
33
|
+
[GroupAgentBuilderApiName.updateAgentPrompt]: UpdateAgentPromptInspector as BuiltinInspector,
|
|
34
|
+
[GroupAgentBuilderApiName.updateGroup]: UpdateGroupInspector as BuiltinInspector,
|
|
35
|
+
[GroupAgentBuilderApiName.updateGroupPrompt]: UpdateGroupPromptInspector as BuiltinInspector,
|
|
36
|
+
|
|
37
|
+
// Shared inspectors from agent-builder (reused for group context)
|
|
38
|
+
[GroupAgentBuilderApiName.getAvailableModels]: GetAvailableModelsInspector as BuiltinInspector,
|
|
39
|
+
[GroupAgentBuilderApiName.installPlugin]: InstallPluginInspector as BuiltinInspector,
|
|
40
|
+
[GroupAgentBuilderApiName.searchMarketTools]: SearchMarketToolsInspector as BuiltinInspector,
|
|
41
|
+
[GroupAgentBuilderApiName.updateAgentConfig]: UpdateConfigInspector as BuiltinInspector,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Re-export individual inspectors
|
|
45
|
+
export { BatchCreateAgentsInspector } from './BatchCreateAgents';
|
|
46
|
+
export { CreateAgentInspector } from './CreateAgent';
|
|
47
|
+
export { InviteAgentInspector } from './InviteAgent';
|
|
48
|
+
export { RemoveAgentInspector } from './RemoveAgent';
|
|
49
|
+
export { SearchAgentInspector } from './SearchAgent';
|
|
50
|
+
export { UpdateAgentPromptInspector } from './UpdateAgentPrompt';
|
|
51
|
+
export { UpdateGroupInspector } from './UpdateGroup';
|
|
52
|
+
export { UpdateGroupPromptInspector } from './UpdateGroupPrompt';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { BuiltinRenderProps } from '@lobechat/types';
|
|
4
|
+
import { Avatar, Flexbox } from '@lobehub/ui';
|
|
5
|
+
import { createStaticStyles } from 'antd-style';
|
|
6
|
+
import { Users } from 'lucide-react';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
|
|
10
|
+
import type { BatchCreateAgentsParams, BatchCreateAgentsState } from '../../types';
|
|
11
|
+
|
|
12
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
13
|
+
container: css`
|
|
14
|
+
padding: 4px 16px;
|
|
15
|
+
background: ${cssVar.colorFillQuaternary};
|
|
16
|
+
border-radius: 8px;
|
|
17
|
+
`,
|
|
18
|
+
description: css`
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
display: -webkit-box;
|
|
21
|
+
-webkit-box-orient: vertical;
|
|
22
|
+
-webkit-line-clamp: 1;
|
|
23
|
+
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
line-height: 1.5;
|
|
26
|
+
color: ${cssVar.colorTextDescription};
|
|
27
|
+
text-overflow: ellipsis;
|
|
28
|
+
`,
|
|
29
|
+
empty: css`
|
|
30
|
+
padding: 16px;
|
|
31
|
+
color: ${cssVar.colorTextTertiary};
|
|
32
|
+
`,
|
|
33
|
+
item: css`
|
|
34
|
+
padding-block: 12px;
|
|
35
|
+
|
|
36
|
+
&:not(:last-child) {
|
|
37
|
+
border-block-end: 1px solid ${cssVar.colorBorderSecondary};
|
|
38
|
+
}
|
|
39
|
+
`,
|
|
40
|
+
title: css`
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
|
|
43
|
+
font-size: 13px;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
text-overflow: ellipsis;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
`,
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
|
+
interface AgentItemProps {
|
|
51
|
+
agent: {
|
|
52
|
+
agentId: string;
|
|
53
|
+
success: boolean;
|
|
54
|
+
title: string;
|
|
55
|
+
};
|
|
56
|
+
definition?: {
|
|
57
|
+
avatar?: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
title: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const AgentItem = memo<AgentItemProps>(({ agent, definition }) => {
|
|
64
|
+
const avatar = definition?.avatar;
|
|
65
|
+
const description = definition?.description;
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Flexbox align="center" className={styles.item} gap={12} horizontal>
|
|
69
|
+
<Avatar avatar={avatar} size={24} style={{ flexShrink: 0 }} title={agent.title} />
|
|
70
|
+
<Flexbox flex={1} gap={2} style={{ minWidth: 0, overflow: 'hidden' }}>
|
|
71
|
+
<span className={styles.title}>{agent.title}</span>
|
|
72
|
+
{description && <span className={styles.description}>{description}</span>}
|
|
73
|
+
</Flexbox>
|
|
74
|
+
</Flexbox>
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const BatchCreateAgentsRender = memo<
|
|
79
|
+
BuiltinRenderProps<BatchCreateAgentsParams, BatchCreateAgentsState>
|
|
80
|
+
>(({ args, pluginState }) => {
|
|
81
|
+
const { t } = useTranslation('plugin');
|
|
82
|
+
const { agents: resultAgents } = pluginState || {};
|
|
83
|
+
const definitions = args?.agents || [];
|
|
84
|
+
|
|
85
|
+
if (!resultAgents || resultAgents.length === 0) {
|
|
86
|
+
return (
|
|
87
|
+
<Flexbox align="center" className={styles.empty} gap={8}>
|
|
88
|
+
<Users size={24} />
|
|
89
|
+
<span>{t('builtins.lobe-group-agent-builder.inspector.noResults')}</span>
|
|
90
|
+
</Flexbox>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Flexbox className={styles.container}>
|
|
96
|
+
{resultAgents.map((agent, index) => (
|
|
97
|
+
<AgentItem agent={agent} definition={definitions[index]} key={agent.agentId || index} />
|
|
98
|
+
))}
|
|
99
|
+
</Flexbox>
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export default BatchCreateAgentsRender;
|
package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateAgentPrompt/index.tsx
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinRenderProps } from '@lobechat/types';
|
|
4
|
+
import { Markdown } from '@lobehub/ui';
|
|
5
|
+
import { createStaticStyles } from 'antd-style';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
|
|
8
|
+
import type { UpdateAgentPromptParams, UpdateAgentPromptState } from '../../../types';
|
|
9
|
+
|
|
10
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
11
|
+
container: css`
|
|
12
|
+
padding: 12px;
|
|
13
|
+
border-radius: 8px;
|
|
14
|
+
background: ${cssVar.colorFillQuaternary};
|
|
15
|
+
`,
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
export const UpdateAgentPromptRender = memo<
|
|
19
|
+
BuiltinRenderProps<UpdateAgentPromptParams, UpdateAgentPromptState>
|
|
20
|
+
>(({ pluginState }) => {
|
|
21
|
+
const prompt = pluginState?.newPrompt;
|
|
22
|
+
|
|
23
|
+
if (!prompt) return null;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={styles.container}>
|
|
27
|
+
<div>
|
|
28
|
+
<Markdown variant={'chat'}>{prompt}</Markdown>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
UpdateAgentPromptRender.displayName = 'UpdateAgentPromptRender';
|
|
35
|
+
|
|
36
|
+
export default UpdateAgentPromptRender;
|