Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(cc): show cloud credentials alert and disable input when not configured (#14822)

LiJiana2d91b205e27
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 2c205755264..402b5077564 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -196,6 +196,9 @@
"groupWizard.searchTemplates": "Search templates...",
"groupWizard.title": "Create Group",
"groupWizard.useTemplate": "Use Template",
+ "heteroAgent.cloudNotConfigured.action": "Configure",
+ "heteroAgent.cloudNotConfigured.desc": "Configure your Claude Code token in agent profile to start sending messages.",
+ "heteroAgent.cloudNotConfigured.title": "Cloud credentials required",
"heteroAgent.cloudRepo.multiSelected": "{{count}} repos selected",
"heteroAgent.cloudRepo.noRepos": "No repositories configured. Add them in agent settings.",
"heteroAgent.cloudRepo.notSet": "No repo selected",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index b94e5d68416..46a977eef4e 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -196,6 +196,9 @@
"groupWizard.searchTemplates": "搜索模板…",
"groupWizard.title": "创建群组",
"groupWizard.useTemplate": "使用模板",
+ "heteroAgent.cloudNotConfigured.action": "立即配置",
+ "heteroAgent.cloudNotConfigured.desc": "请在 Agent 资料中配置 Claude Code Token,以开始发送消息。",
+ "heteroAgent.cloudNotConfigured.title": "需要配置云端凭证",
"heteroAgent.cloudRepo.multiSelected": "已选 {{count}} 个仓库",
"heteroAgent.cloudRepo.noRepos": "未配置仓库,请在助理设置中添加。",
"heteroAgent.cloudRepo.notSet": "未选择仓库",
diff --git a/src/business/client/hooks/useHeteroAgentCloudConfig.ts b/src/business/client/hooks/useHeteroAgentCloudConfig.ts
new file mode 100644
index 00000000000..364fc5fde5d
--- /dev/null
+++ b/src/business/client/hooks/useHeteroAgentCloudConfig.ts
@@ -0,0 +1,54 @@
+import { isDesktop } from '@lobechat/const';
+import { useParams } from 'react-router-dom';
+import urlJoin from 'url-join';
+
+import { useQueryRoute } from '@/hooks/useQueryRoute';
+import { lambdaQuery } from '@/libs/trpc/client';
+import { useAgentStore } from '@/store/agent';
+import { agentSelectors } from '@/store/agent/selectors';
+
+// Fixed cred key — must stay in sync with CloudHeterogeneousConfig
+const CLAUDE_TOKEN_CRED_KEY = 'CLAUDE_CODE_OAUTH_TOKEN';
+
+interface HeteroAgentCloudConfig {
+ goToConfig: () => void;
+ isConfigured: boolean;
+}
+
+export const useHeteroAgentCloudConfig = (): HeteroAgentCloudConfig => {
+ const params = useParams<{ aid: string }>();
+ const router = useQueryRoute();
+
+ const heterogeneousProvider = useAgentStore(
+ (s) => agentSelectors.currentAgentConfig(s)?.agencyConfig?.heterogeneousProvider,
+ );
+
+ // Only claude-code agents require a cloud credential — codex and other providers do not use this key
+ const isClaudeCode = heterogeneousProvider?.type === 'claude-code';
+ const needsCredCheck = !isDesktop && isClaudeCode;
+
+ // Only fetch credentials when actually needed
+ const { data: credsData } = lambdaQuery.market.creds.list.useQuery(undefined, {
+ enabled: needsCredCheck,
+ });
+
+ // isConfigured is true when:
+ // 1. Running on desktop (local execution, no cloud creds needed), or
+ // 2. No heterogeneous provider on this agent, or
+ // 3. Provider is not claude-code (e.g. codex — no cloud credential required), or
+ // 4. The agent env has a CLAUDE_CODE_CRED_KEY reference set, or
+ // 5. The CLAUDE_CODE_OAUTH_TOKEN credential actually exists in the vault
+ // (handles the case where the credential was saved but the env ref wasn't written)
+ const hasCredInVault = (credsData?.data ?? []).some((c) => c.key === CLAUDE_TOKEN_CRED_KEY);
+ const isConfigured =
+ !needsCredCheck || !!heterogeneousProvider?.env?.CLAUDE_CODE_CRED_KEY || hasCredInVault;
+
+ const goToConfig = () => {
+ const agentId = params.aid;
+ if (agentId) {
+ router.push(urlJoin('/agent', agentId, 'profile'));
+ }
+ };
+
+ return { goToConfig, isConfigured };
+};
diff --git a/src/features/ChatInput/store/action.ts b/src/features/ChatInput/store/action.ts
index 3a731d2a692..98b73b26c0b 100644
--- a/src/features/ChatInput/store/action.ts
+++ b/src/features/ChatInput/store/action.ts
@@ -34,6 +34,7 @@ export const store: CreateStore = (publicState) => (set, get) => ({
handleSendButton: () => {
const editor = get().editor;
if (!editor) return;
+ if (get().sendButtonProps?.disabled) return;
get().onSend?.({
clearContent: () => editor?.cleanDocument(),
diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.ts
index 8ae7d3eea5a..be1de967bd5 100644
--- a/src/locales/default/chat.ts
+++ b/src/locales/default/chat.ts
@@ -167,6 +167,10 @@ export default {
'Claude Code sessions are pinned to a working directory. Switching will start a new session for this topic — chat messages stay, but the previous session context cannot be resumed.',
'heteroAgent.switchCwd.ok': 'Switch and start new session',
'heteroAgent.switchCwd.title': 'Switch working directory?',
+ 'heteroAgent.cloudNotConfigured.action': 'Configure',
+ 'heteroAgent.cloudNotConfigured.desc':
+ 'Configure your Claude Code token in agent profile to start sending messages.',
+ 'heteroAgent.cloudNotConfigured.title': 'Cloud credentials required',
'heteroAgent.cloudRepo.sectionTitle': 'Repositories',
'heteroAgent.cloudRepo.notSet': 'No repo selected',
'heteroAgent.cloudRepo.noRepos': 'No repositories configured. Add them in agent settings.',
diff --git a/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/index.tsx b/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/index.tsx
index 57fc4d0cfb2..9d3bd198a61 100644
--- a/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/index.tsx
+++ b/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/index.tsx
@@ -1,7 +1,10 @@
'use client';
+import { Alert, Button, Flexbox } from '@lobehub/ui';
import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useHeteroAgentCloudConfig } from '@/business/client/hooks/useHeteroAgentCloudConfig';
import { type ActionKeys } from '@/features/ChatInput';
import { ChatInput } from '@/features/Conversation';
import { useChatStore } from '@/store/chat';
@@ -20,20 +23,44 @@ const rightActions: ActionKeys[] = [];
* Simplified ChatInput for heterogeneous agents (Claude Code, etc.).
* Keeps only: text input, typo toggle, send button, and a working-directory
* picker — no model/tools/memory/KB/MCP/runtime-mode/upload.
+ *
+ * In cloud (web) mode, shows a configuration prompt and disables the input
+ * until the user sets up their cloud credentials in agent profile.
*/
const HeterogeneousChatInput = memo(() => {
+ const { t } = useTranslation('chat');
+ const { isConfigured, goToConfig } = useHeteroAgentCloudConfig();
+
return (
- <ChatInput
- skipScrollMarginWithList
- leftActions={leftActions}
- rightActions={rightActions}
- runtimeConfigSlot={<WorkingDirectoryBar />}
- sendButtonProps={{ shape: 'round' }}
- onEditorReady={(instance) => {
- // Sync to global ChatStore for compatibility with other features
- useChatStore.setState({ mainInputEditor: instance });
- }}
- />
+ <Flexbox>
+ {!isConfigured && (
+ <Flexbox paddingBlock={'0 6px'} paddingInline={12}>
+ <Alert
+ type={'warning'}
+ title={t('heteroAgent.cloudNotConfigured.title')}
+ description={
+ <Flexbox horizontal align={'center'} justify={'space-between'} gap={8}>
+ <span>{t('heteroAgent.cloudNotConfigured.desc')}</span>
+ <Button size={'small'} type={'primary'} onClick={goToConfig}>
+ {t('heteroAgent.cloudNotConfigured.action')}
+ </Button>
+ </Flexbox>
+ }
+ />
+ </Flexbox>
+ )}
+ <ChatInput
+ skipScrollMarginWithList
+ leftActions={leftActions}
+ rightActions={rightActions}
+ runtimeConfigSlot={<WorkingDirectoryBar />}
+ sendButtonProps={{ disabled: !isConfigured, shape: 'round' }}
+ onEditorReady={(instance) => {
+ // Sync to global ChatStore for compatibility with other features
+ useChatStore.setState({ mainInputEditor: instance });
+ }}
+ />
+ </Flexbox>
);
});