🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat: refactor home (#14266)
Rdmclin25a46c5a97114
diff --git a/e2e/src/features/home/starter.feature b/e2e/src/features/home/starter.featuredeleted file mode 100644index 55bf09951d7..00000000000--- a/e2e/src/features/home/starter.feature+++ /dev/null@@ -1,47 +0,0 @@-@journey @home @starter-Feature: Home 页面 Starter 快捷创建功能- 作为用户,我希望在 Home 页面可以通过 Starter 快捷创建 Agent、Group 或文档,并跳转到对应页面-- Background:- Given 用户已登录系统-- # ============================================- # 创建 Agent 后侧边栏刷新- # ============================================-- @HOME-STARTER-AGENT-001 @P0- Scenario: 通过 Home 页面创建 Agent 后返回首页侧边栏应显示新创建的 Agent- Given 用户在 Home 页面- When 用户点击创建 Agent 按钮- And 用户在输入框中输入 "E2E Test Agent"- And 用户按 Enter 发送- Then 页面应该跳转到 Agent 的 profile 页面- When 用户返回 Home 页面- Then 新创建的 Agent 应该在侧边栏中显示-- # ============================================- # 创建 Group 后侧边栏刷新- # ============================================-- @HOME-STARTER-GROUP-001 @P0- Scenario: 通过 Home 页面创建 Group 后返回首页侧边栏应显示新创建的 Group- Given 用户在 Home 页面- When 用户点击创建 Group 按钮- And 用户在输入框中输入 "E2E Test Group"- And 用户按 Enter 发送- Then 页面应该跳转到 Group 的 profile 页面- When 用户返回 Home 页面- Then 新创建的 Group 应该在侧边栏中显示-- # ============================================- # 创建文档并跳转到写作页面- # ============================================-- @HOME-STARTER-WRITE-001 @P0- Scenario: 通过 Home 页面快捷创建文档并跳转到写作页面- Given 用户在 Home 页面- When 用户点击写作按钮- And 用户在输入框中输入 "帮我写一篇关于人工智能的文章"- And 用户按 Enter 发送创建文档- Then 页面应该跳转到文档编辑页面- And Page Agent 应该收到用户的提示词diff --git a/e2e/src/steps/home/starter.steps.ts b/e2e/src/steps/home/starter.steps.tsdeleted file mode 100644index f7a234e5aad..00000000000--- a/e2e/src/steps/home/starter.steps.ts+++ /dev/null@@ -1,315 +0,0 @@-/* eslint-disable no-console */-/**- * Home Starter Steps- *- * Step definitions for Home page Starter E2E tests- * - Create Agent from Home input- * - Create Group from Home input- * - Create Document (Write) from Home input- * - Verify Agent/Group appears in sidebar after returning to Home- * - Verify Document page navigation and Page Agent interaction- */-import { Given, Then, When } from '@cucumber/cucumber';-import { expect } from '@playwright/test';--import { llmMockManager, presetResponses } from '../../mocks/llm';-import { type CustomWorld, WAIT_TIMEOUT } from '../../support/world';--// Store created IDs for verification-let createdAgentId: string | null = null;-let createdGroupId: string | null = null;-let createdDocumentId: string | null = null;--// ============================================-// Given Steps-// ============================================--Given('用户在 Home 页面', async function (this: CustomWorld) {- console.log(' 📍 Step: 设置 LLM mock...');- // Setup LLM mock before navigation (for agent/group/page builder message)- llmMockManager.setResponse('E2E Test Agent', presetResponses.greeting);- llmMockManager.setResponse('E2E Test Group', presetResponses.greeting);- llmMockManager.setResponse(- '帮我写一篇关于人工智能的文章',- '好的,我来帮你写一篇关于人工智能的文章。\n\n# 人工智能:改变世界的技术\n\n人工智能(AI)是当今最具变革性的技术之一...',- );- await llmMockManager.setup(this.page);-- console.log(' 📍 Step: 导航到 Home 页面...');- await this.page.goto('/');- await this.page.waitForLoadState('networkidle', { timeout: 15_000 });- await this.page.waitForTimeout(1000);-- // Reset IDs for each test- createdAgentId = null;- createdGroupId = null;- createdDocumentId = null;-- console.log(' ✅ 已进入 Home 页面');-});--// ============================================-// When Steps-// ============================================--When('用户点击创建 Agent 按钮', async function (this: CustomWorld) {- console.log(' 📍 Step: 点击创建 Agent 按钮...');-- // Find the "Create Agent" button by text (supports both English and Chinese)- const createAgentButton = this.page- .getByRole('button', { name: /create agent|创建智能体/i })- .first();-- await expect(createAgentButton).toBeVisible({ timeout: WAIT_TIMEOUT });- await createAgentButton.click();-- // Wait for mode switch animation and ChatInput scroll-into-view to settle- await this.page.waitForTimeout(800);-- console.log(' ✅ 已点击创建 Agent 按钮');-});--When('用户点击创建 Group 按钮', async function (this: CustomWorld) {- console.log(' 📍 Step: 点击创建 Group 按钮...');-- // Find the "Create Group" button by text (supports both English and Chinese)- const createGroupButton = this.page- .getByRole('button', { name: /create group|创建群组/i })- .first();-- await expect(createGroupButton).toBeVisible({ timeout: WAIT_TIMEOUT });- await createGroupButton.click();-- // Wait for mode switch animation and ChatInput scroll-into-view to settle- await this.page.waitForTimeout(800);-- console.log(' ✅ 已点击创建 Group 按钮');-});--When('用户点击写作按钮', async function (this: CustomWorld) {- console.log(' 📍 Step: 点击写作按钮...');-- // Find the "Write" button by text (supports both English and Chinese)- const writeButton = this.page.getByRole('button', { name: /write|写作/i }).first();-- await expect(writeButton).toBeVisible({ timeout: WAIT_TIMEOUT });- await writeButton.click();-- // Wait for mode switch animation and ChatInput scroll-into-view to settle- await this.page.waitForTimeout(800);-- console.log(' ✅ 已点击写作按钮');-});--When('用户在输入框中输入 {string}', async function (this: CustomWorld, message: string) {- console.log(` 📍 Step: 在输入框中输入 "${message}"...`);-- // The chat input is a contenteditable editor, need to click first then type.- // Target the contenteditable element INSIDE the ChatInput container directly,- // since clicking the container might hit the action bar/footer area instead.- const chatInputContainer = this.page.locator('[data-testid="chat-input"]').first();- await expect(chatInputContainer).toBeVisible({ timeout: WAIT_TIMEOUT });-- const editor = chatInputContainer.locator('[contenteditable="true"]').first();- await editor.click();- await this.page.waitForTimeout(300);- await this.page.keyboard.type(message, { delay: 30 });-- console.log(` ✅ 已输入 "${message}"`);-});--When('用户按 Enter 发送', { timeout: 30_000 }, async function (this: CustomWorld) {- console.log(' 📍 Step: 按 Enter 发送...');-- // Wait for editor's debounced onChange (100ms default) to sync inputMessage to store.- // The send() function reads directly from the editor as a fallback, but this wait- // ensures maximum reliability.- await this.page.waitForTimeout(200);-- // Listen for navigation to capture the agent/group ID- const navigationPromise = this.page.waitForURL(/\/(agent|group)\/.*\/profile/, {- timeout: 30_000,- });-- await this.page.keyboard.press('Enter');-- // Wait for navigation to profile page- await navigationPromise;- await this.page.waitForLoadState('networkidle', { timeout: 15_000 });-- // Extract agent/group ID from URL- const currentUrl = this.page.url();-- const agentMatch = currentUrl.match(/\/agent\/([^/]+)/);- if (agentMatch) {- createdAgentId = agentMatch[1];- console.log(` 📍 Created agent ID: ${createdAgentId}`);- }-- const groupMatch = currentUrl.match(/\/group\/([^/]+)/);- if (groupMatch) {- createdGroupId = groupMatch[1];- console.log(` 📍 Created group ID: ${createdGroupId}`);- }-- console.log(' ✅ 已发送消息');-});--When('用户按 Enter 发送创建文档', { timeout: 30_000 }, async function (this: CustomWorld) {- console.log(' 📍 Step: 按 Enter 发送创建文档...');-- // Wait for editor's debounced onChange (100ms default) to sync inputMessage to store- await this.page.waitForTimeout(200);-- // Listen for navigation to capture the document ID- const navigationPromise = this.page.waitForURL(/\/page\/[^/]+/, {- timeout: 30_000,- });-- await this.page.keyboard.press('Enter');-- // Wait for navigation to page- await navigationPromise;- await this.page.waitForLoadState('networkidle', { timeout: 15_000 });-- // Extract document ID from URL- const currentUrl = this.page.url();- const pageMatch = currentUrl.match(/\/page\/([^/?]+)/);- if (pageMatch) {- createdDocumentId = pageMatch[1];- console.log(` 📍 Created document ID: ${createdDocumentId}`);- }-- console.log(' ✅ 已发送并创建文档');-});--When('用户返回 Home 页面', async function (this: CustomWorld) {- console.log(' 📍 Step: 返回 Home 页面...');-- await this.page.goto('/');- await this.page.waitForLoadState('networkidle', { timeout: 15_000 });- await this.page.waitForTimeout(1000);-- console.log(' ✅ 已返回 Home 页面');-});--// ============================================-// Then Steps-// ============================================--Then('页面应该跳转到 Agent 的 profile 页面', async function (this: CustomWorld) {- console.log(' 📍 Step: 验证页面跳转到 Agent profile 页面...');-- // Check current URL matches /agent/{id}/profile pattern- const currentUrl = this.page.url();- expect(currentUrl).toMatch(/\/agent\/[^/]+\/profile/);-- console.log(' ✅ 已跳转到 Agent profile 页面');-});--Then('页面应该跳转到 Group 的 profile 页面', async function (this: CustomWorld) {- console.log(' 📍 Step: 验证页面跳转到 Group profile 页面...');-- // Check current URL matches /group/{id}/profile pattern- const currentUrl = this.page.url();- expect(currentUrl).toMatch(/\/group\/[^/]+\/profile/);-- console.log(' ✅ 已跳转到 Group profile 页面');-});--Then('新创建的 Agent 应该在侧边栏中显示', async function (this: CustomWorld) {- console.log(' 📍 Step: 验证 Agent 在侧边栏中显示...');-- // Wait for sidebar to be visible and data to load- await this.page.waitForTimeout(1500);-- // Check if the agent appears in sidebar by its link (primary assertion)- // This proves that refreshAgentList() was called and the sidebar was updated- if (!createdAgentId) {- throw new Error('Agent ID was not captured during creation');- }-- const agentLink = this.page.locator(`a[href="/agent/${createdAgentId}"]`).first();- await expect(agentLink).toBeVisible({ timeout: WAIT_TIMEOUT });- console.log(` ✅ 找到 Agent 链接: /agent/${createdAgentId}`);-- // Get the aria-label or text content to verify it's the correct agent- const ariaLabel = await agentLink.getAttribute('aria-label');- console.log(` 📍 Agent aria-label: ${ariaLabel}`);-- console.log(' ✅ Agent 已在侧边栏中显示');-});--Then('新创建的 Group 应该在侧边栏中显示', async function (this: CustomWorld) {- console.log(' 📍 Step: 验证 Group 在侧边栏中显示...');-- // Wait for sidebar to be visible and data to load- await this.page.waitForTimeout(1500);-- // Check if the group appears in sidebar by its link (primary assertion)- // This proves that refreshAgentList() was called and the sidebar was updated- if (!createdGroupId) {- throw new Error('Group ID was not captured during creation');- }-- const groupLink = this.page.locator(`a[href="/group/${createdGroupId}"]`).first();- await expect(groupLink).toBeVisible({ timeout: WAIT_TIMEOUT });- console.log(` ✅ 找到 Group 链接: /group/${createdGroupId}`);-- // Get the aria-label or text content to verify it's the correct group- const ariaLabel = await groupLink.getAttribute('aria-label');- console.log(` 📍 Group aria-label: ${ariaLabel}`);-- console.log(' ✅ Group 已在侧边栏中显示');-});--Then('页面应该跳转到文档编辑页面', async function (this: CustomWorld) {- console.log(' 📍 Step: 验证页面跳转到文档编辑页面...');-- // Check current URL matches /page/{id} pattern- const currentUrl = this.page.url();- expect(currentUrl).toMatch(/\/page\/[^/?]+/);-- if (!createdDocumentId) {- throw new Error('Document ID was not captured during creation');- }-- console.log(` ✅ 已跳转到文档编辑页面: /page/${createdDocumentId}`);-});--Then('Page Agent 应该收到用户的提示词', async function (this: CustomWorld) {- console.log(' 📍 Step: 验证 Page Agent 收到用户的提示词...');-- // Wait for the page to fully load and Page Agent panel to appear- await this.page.waitForTimeout(2000);-- // Look for the user message in the chat panel (Page Agent Copilot)- // The message should appear in the chat list- const userMessage = this.page.locator('text=帮我写一篇关于人工智能的文章').first();-- // The message might be in the chat panel on the right side- const messageVisible = await userMessage.isVisible().catch(() => false);-- if (messageVisible) {- console.log(' ✅ 找到用户发送的提示词');- } else {- // Alternative: check if there's any chat content indicating the message was sent- console.log(' ⚠️ 用户消息可能在聊天面板中,但未直接可见');- }-- // Verify that the Page Agent responded (mock response should appear)- // Wait a bit longer for the mock LLM response- await this.page.waitForTimeout(3000);-- // Look for AI response content- const aiResponse = this.page.locator('text=人工智能').first();- const responseVisible = await aiResponse.isVisible().catch(() => false);-- if (responseVisible) {- console.log(' ✅ Page Agent 已响应用户的提示词');- } else {- console.log(' ⚠️ Page Agent 响应可能正在生成或在其他位置');- }-- console.log(' ✅ Page Agent 验证完成');-});diff --git a/locales/en-US/common.json b/locales/en-US/common.jsonindex d43362be05a..02d64f931e5 100644--- a/locales/en-US/common.json+++ b/locales/en-US/common.json@@ -28,6 +28,8 @@"back": "Back","batchDelete": "Batch Delete","blog": "Product Blog",+ "botIntegrationBanner.dismiss": "Dismiss",+ "botIntegrationBanner.title": "Add Channels to LobeAI","branching": "Create Subtopic","branchingDisable": "The \"Sub-topic\" feature is unavailable in the current mode. To use this feature, please switch to Postgres/Pglite DB mode or use LobeHub Cloud.","branchingRequiresSavedTopic": "Current topic is not saved, please save it first to use subtopic feature",@@ -425,6 +427,7 @@"tab.discover": "Discover","tab.eval": "Eval Lab","tab.files": "Files",+ "tab.generation": "Generation","tab.home": "Home","tab.image": "Image","tab.knowledgeBase": "Library",diff --git a/locales/en-US/home.json b/locales/en-US/home.jsonindex 28953fcaf1b..83489ec8534 100644--- a/locales/en-US/home.json+++ b/locales/en-US/home.json@@ -30,6 +30,7 @@"starter.developing": "Coming soon","starter.image": "Image","starter.imageGeneration": "GPT Image 2",+ "starter.newLabel": "New","starter.videoGeneration": "Seedance 2.0","starter.write": "Write"}diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.jsonindex b95b46d762e..c2128a3eff8 100644--- a/locales/zh-CN/common.json+++ b/locales/zh-CN/common.json@@ -28,6 +28,8 @@"back": "返回","batchDelete": "批量删除","blog": "产品博客",+ "botIntegrationBanner.dismiss": "关闭",+ "botIntegrationBanner.title": "为 LobeAI 添加渠道","branching": "创建子话题","branchingDisable": "「子话题」功能在当前模式下不可用。如需该功能,请切换到 Postgres/Pglite DB 模式或使用 LobeHub Cloud","branchingRequiresSavedTopic": "当前话题未保存。保存后即可使用子话题",@@ -426,6 +428,7 @@"tab.discover": "发现","tab.eval": "评测实验室","tab.files": "文件",+ "tab.generation": "生成","tab.home": "首页","tab.image": "图片","tab.knowledgeBase": "资源库",diff --git a/locales/zh-CN/home.json b/locales/zh-CN/home.jsonindex c3efd217de6..31d629ebe29 100644--- a/locales/zh-CN/home.json+++ b/locales/zh-CN/home.json@@ -27,9 +27,13 @@"starter.createAgent": "创建助理","starter.createGroup": "创建群组","starter.deepResearch": "探究",+ "starter.deepseekV4Pro": "DeepSeek V4 Pro",+ "starter.deepseekV4ProAlready": "当前已使用 DeepSeek V4 Pro",+ "starter.deepseekV4ProSwitched": "已切换到 DeepSeek V4 Pro","starter.developing": "正在开发中","starter.image": "绘画","starter.imageGeneration": "GPT Image 2",+ "starter.newLabel": "上新","starter.videoGeneration": "Seedance 2.0","starter.write": "写作"}diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.jsonindex 29a944d0786..90ec7ca5f94 100644--- a/locales/zh-CN/plugin.json+++ b/locales/zh-CN/plugin.json@@ -617,7 +617,7 @@"skillDetail.tabs.tools": "技能功能","skillDetail.tools": "工具","skillDetail.trustWarning": "请仅使用您信任的开发者提供的连接器。LobeHub 无法控制开发者提供哪些工具,也无法验证这些工具是否按预期工作或是否会发生变化。",- "skillInstallBanner.dismiss": "不再显示",+ "skillInstallBanner.dismiss": "关闭","skillInstallBanner.title": "为 Lobe AI 添加技能","store.actions.cancel": "取消安装","store.actions.configure": "配置",diff --git a/src/hooks/useNavLayout.ts b/src/hooks/useNavLayout.tsindex c5404005fee..59602d4eb1a 100644--- a/src/hooks/useNavLayout.ts+++ b/src/hooks/useNavLayout.ts@@ -72,6 +72,12 @@ export const useNavLayout = (): NavLayout => {const bottomMenuItems = useMemo(() =>[+ {+ icon: getRouteById('image')!.icon,+ key: SidebarTabKey.Image,+ title: t('tab.generation'),+ url: '/image',+ },{hidden: !showMarket,icon: getRouteById('community')!.icon,diff --git a/src/locales/default/common.ts b/src/locales/default/common.tsindex 6d99fe9f0ab..6db17a273e8 100644--- a/src/locales/default/common.ts+++ b/src/locales/default/common.ts@@ -31,6 +31,8 @@ export default {'back': 'Back','batchDelete': 'Batch Delete','blog': 'Product Blog',+ 'botIntegrationBanner.dismiss': 'Dismiss',+ 'botIntegrationBanner.title': 'Add Channels to LobeAI','branching': 'Create Subtopic','branchingDisable':'The "Sub-topic" feature is unavailable in the current mode. To use this feature, please switch to Postgres/Pglite DB mode or use LobeHub Cloud.',@@ -508,6 +510,7 @@ export default {'tab.discover': 'Discover','tab.eval': 'Eval Lab','tab.files': 'Files',+ 'tab.generation': 'Generation','tab.home': 'Home','tab.knowledgeBase': 'Library','tab.marketplace': 'Marketplace',diff --git a/src/locales/default/home.ts b/src/locales/default/home.tsindex b2a63acddd4..444a791ae5b 100644--- a/src/locales/default/home.ts+++ b/src/locales/default/home.ts@@ -28,9 +28,13 @@ export default {'starter.createAgent': 'Create Agent','starter.createGroup': 'Create Group','starter.deepResearch': 'Deep Research',+ 'starter.deepseekV4Pro': 'DeepSeek V4 Pro',+ 'starter.deepseekV4ProAlready': 'Already using DeepSeek V4 Pro',+ 'starter.deepseekV4ProSwitched': 'Switched to DeepSeek V4 Pro','starter.developing': 'Coming soon','starter.image': 'Image','starter.imageGeneration': 'GPT Image 2',+ 'starter.newLabel': 'New','starter.videoGeneration': 'Seedance 2.0','starter.write': 'Write',};diff --git a/src/routes/(main)/home/_layout/Body/CustomizeSidebarModal.tsx b/src/routes/(main)/home/_layout/Body/CustomizeSidebarModal.tsxindex 4cbb8cc0db5..537d9ae98a5 100644--- a/src/routes/(main)/home/_layout/Body/CustomizeSidebarModal.tsx+++ b/src/routes/(main)/home/_layout/Body/CustomizeSidebarModal.tsx@@ -52,6 +52,7 @@ const ALL_SIDEBAR_ITEMS: SidebarItemConfig[] = [{ id: 'pages', labelKey: 'tab.pages', routeId: 'page' },{ id: 'recents', labelKey: 'recents' },{ alwaysVisible: true, id: 'agent', labelKey: 'navPanel.agent' },+ { id: 'image', labelKey: 'tab.generation', routeId: 'image' },{ id: 'community', labelKey: 'tab.community', routeId: 'community' },{ id: 'resource', labelKey: 'tab.resource', routeId: 'resource' },{ id: 'memory', labelKey: 'tab.memory', routeId: 'memory' },diff --git a/src/routes/(main)/home/features/AgentSelect/AgentList.tsx b/src/routes/(main)/home/features/AgentSelect/AgentList.tsxnew file mode 100644index 00000000000..6abaae03d8f--- /dev/null+++ b/src/routes/(main)/home/features/AgentSelect/AgentList.tsx@@ -0,0 +1,132 @@+'use client';++import { type SidebarAgentItem } from '@lobechat/types';+import { Avatar, Block, Flexbox, Text } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';+import { memo, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++import { DEFAULT_AVATAR, DEFAULT_INBOX_AVATAR } from '@/const/meta';+import SkeletonList from '@/features/NavPanel/components/SkeletonList';+import { useAgentStore } from '@/store/agent';+import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';+import { useHomeStore } from '@/store/home';+import { homeAgentListSelectors } from '@/store/home/selectors';++const styles = createStaticStyles(({ css, cssVar }) => ({+ active: css`+ background: ${cssVar.colorFillTertiary};+ `,+ item: css`+ cursor: pointer;+ padding-block: 6px;+ padding-inline: 8px;+ border-radius: ${cssVar.borderRadius};++ &:hover {+ background: ${cssVar.colorFillSecondary};+ }+ `,+ list: css`+ padding: 8px;+ `,+}));++interface AgentListProps {+ activeAgentId: string;+ onSelect: (agentId: string) => void;+}++interface AgentRow {+ avatar?: string;+ backgroundColor?: string;+ id: string;+ title: string;+}++const AgentList = memo<AgentListProps>(({ activeAgentId, onSelect }) => {+ const { t } = useTranslation('chat');++ const isInit = useHomeStore(homeAgentListSelectors.isAgentListInit);+ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);+ const inboxMeta = useAgentStore(agentSelectors.getAgentMetaById(inboxAgentId ?? ''));+ const allAgents = useHomeStore(homeAgentListSelectors.allAgents);++ // Flat list: inbox first, then all sidebar agents (pinned + grouped + ungrouped)+ // de-duplicated by id (an agent can show in multiple buckets via grouping).+ const rows = useMemo<AgentRow[]>(() => {+ const seen = new Set<string>();+ const out: AgentRow[] = [];++ if (inboxAgentId) {+ out.push({+ avatar:+ (typeof inboxMeta?.avatar === 'string' ? inboxMeta.avatar : undefined) ??+ DEFAULT_INBOX_AVATAR,+ backgroundColor: inboxMeta?.backgroundColor || undefined,+ id: inboxAgentId,+ title: inboxMeta?.title || 'Lobe AI',+ });+ seen.add(inboxAgentId);+ }++ for (const item of allAgents as SidebarAgentItem[]) {+ // Skip chat groups — sendMessage / agent config lookups expect an agent id.+ // Groups go through their own chat-group flow under /group/:gid.+ if (item.type !== 'agent') continue;+ if (seen.has(item.id)) continue;+ seen.add(item.id);+ out.push({+ avatar: typeof item.avatar === 'string' ? item.avatar : undefined,+ backgroundColor: item.backgroundColor || undefined,+ id: item.id,+ title: item.title || t('untitledAgent'),+ });+ }++ return out;+ }, [inboxAgentId, inboxMeta, allAgents, t]);++ if (!isInit) return <SkeletonList rows={6} style={{ padding: 8 }} />;++ return (+ <Flexbox+ className={styles.list}+ gap={2}+ style={{ maxHeight: 360, overflowY: 'auto', width: '100%' }}+ >+ {rows.map((row) => {+ const isActive = row.id === activeAgentId;+ return (+ <Block+ clickable+ horizontal+ align={'center'}+ className={`${styles.item} ${isActive ? styles.active : ''}`}+ gap={8}+ key={row.id}+ variant={'borderless'}+ onClick={() => onSelect(row.id)}+ >+ <Avatar+ avatar={row.avatar || DEFAULT_AVATAR}+ background={row.backgroundColor}+ shape={'square'}+ size={24}+ />+ <Text+ ellipsis+ color={isActive ? cssVar.colorText : cssVar.colorTextSecondary}+ style={{ flex: 1 }}+ weight={isActive ? 600 : 500}+ >+ {row.title}+ </Text>+ </Block>+ );+ })}+ </Flexbox>+ );+});++export default AgentList;diff --git a/src/routes/(main)/home/features/AgentSelect/index.tsx b/src/routes/(main)/home/features/AgentSelect/index.tsxnew file mode 100644index 00000000000..4f35d4a1609--- /dev/null+++ b/src/routes/(main)/home/features/AgentSelect/index.tsx@@ -0,0 +1,128 @@+'use client';++import { ActionIcon, Avatar, Block, Popover, Text } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';+import { ChevronsUpDownIcon } from 'lucide-react';+import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { DEFAULT_AVATAR, DEFAULT_INBOX_AVATAR } from '@/const/meta';+import { SkeletonItem } from '@/features/NavPanel/components/SkeletonList';+import { useFetchAgentList } from '@/hooks/useFetchAgentList';+import { agentService } from '@/services/agent';+import { useAgentStore } from '@/store/agent';+import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';+import { useGlobalStore } from '@/store/global';+import { useHomeStore } from '@/store/home';+import { homeAgentListSelectors } from '@/store/home/selectors';++import AgentList from './AgentList';+import { useResolvedHomeAgentId } from './useResolvedHomeAgentId';++const styles = createStaticStyles(({ css, cssVar }) => ({+ chevron: css`+ opacity: 0;+ transition: opacity 0.2s ${cssVar.motionEaseOut};+ `,+ trigger: css`+ &:hover .agent-select-chevron,+ &[data-popup-open] .agent-select-chevron {+ opacity: 1;+ }++ &[data-popup-open] {+ background: ${cssVar.colorFillTertiary};+ }+ `,+}));++const AgentSelect = memo(() => {+ const { t } = useTranslation(['chat', 'common']);+ const [open, setOpen] = useState(false);++ // Trigger fetching the home agent list so the popover content is ready when opened.+ useFetchAgentList();++ const isLoading = useAgentStore(agentSelectors.isAgentConfigLoading);+ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);+ const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);++ const { agentId: resolvedAgentId, isInbox: isInboxDisplay } = useResolvedHomeAgentId();+ const displayAgentId = resolvedAgentId ?? '';++ // Pull metadata for the displayed agent. Inbox uses agentSelectors directly;+ // non-inbox agents are looked up via the home agent list (sidebar-shaped meta)+ // with a fallback to agentSelectors when the agent map is hydrated for that id.+ const inboxMeta = useAgentStore(agentSelectors.getAgentMetaById(inboxAgentId ?? ''));+ const sidebarItem = useHomeStore(homeAgentListSelectors.getAgentById(displayAgentId));+ const agentMapMeta = useAgentStore(agentSelectors.getAgentMetaById(displayAgentId));++ const displayMeta = isInboxDisplay ? inboxMeta : (sidebarItem ?? agentMapMeta);++ const fallbackTitle = isInboxDisplay ? 'Lobe AI' : t('defaultSession', { ns: 'common' });+ const displayTitle = displayMeta?.title || fallbackTitle;+ const displayAvatar =+ (typeof displayMeta?.avatar === 'string' ? displayMeta.avatar : undefined) ||+ (isInboxDisplay ? DEFAULT_INBOX_AVATAR : DEFAULT_AVATAR);+ const displayBackground = displayMeta?.backgroundColor || undefined;++ const handleSelect = (agentId: string) => {+ // Persist selection (localStorage via systemStatus) so the home ChatInput+ // + send logic uses this agent across reloads. We always store a concrete+ // agent id — including inbox — because lodash `merge` skips `undefined`+ // source values, so we cannot clear the field by passing `undefined`.+ updateSystemStatus({ homeSelectedAgentId: agentId });+ setOpen(false);++ // Eagerly hydrate `agentMap` for the picked agent so the home ChatInput's+ // model/provider/vision selectors reflect the agent's real config, and the+ // upcoming sendMessage doesn't have to wait on a cold fetch. `useSend` also+ // awaits this on send as a safety net for the race-clicker case.+ const agentState = useAgentStore.getState();+ if (agentState.agentMap[agentId]) return;+ agentService+ .getAgentConfigById(agentId)+ .then((config) => {+ if (config) agentState.internal_dispatchAgentMap(agentId, config);+ })+ .catch((e) => console.error('[AgentSelect] failed to prefetch agent config', e));+ };++ if (isLoading) return <SkeletonItem height={40} padding={0} />;++ return (+ <Popover+ classNames={{ trigger: styles.trigger }}+ content={<AgentList activeAgentId={displayAgentId} onSelect={handleSelect} />}+ nativeButton={false}+ open={open}+ placement="bottomLeft"+ styles={{ content: { padding: 0, width: 360 } }}+ trigger="click"+ onOpenChange={setOpen}+ >+ <Block+ clickable+ horizontal+ align={'center'}+ gap={8}+ padding={4}+ style={{ marginInlineStart: -4, width: 'fit-content' }}+ variant={'borderless'}+ >+ <Avatar avatar={displayAvatar} background={displayBackground} shape={'square'} size={32} />+ <Text fontSize={16} weight={600}>+ {displayTitle}+ </Text>+ <ActionIcon+ className={`${styles.chevron} agent-select-chevron`}+ color={cssVar.colorTextDescription}+ icon={ChevronsUpDownIcon}+ size={{ blockSize: 24, size: 14 }}+ />+ </Block>+ </Popover>+ );+});++export default AgentSelect;diff --git a/src/routes/(main)/home/features/AgentSelect/useResolvedHomeAgentId.ts b/src/routes/(main)/home/features/AgentSelect/useResolvedHomeAgentId.tsnew file mode 100644index 00000000000..f03dce68e37--- /dev/null+++ b/src/routes/(main)/home/features/AgentSelect/useResolvedHomeAgentId.ts@@ -0,0 +1,51 @@+import { useEffect } from 'react';++import { useAgentStore } from '@/store/agent';+import { builtinAgentSelectors } from '@/store/agent/selectors';+import { useGlobalStore } from '@/store/global';+import { systemStatusSelectors } from '@/store/global/selectors';+import { useHomeStore } from '@/store/home';+import { homeAgentListSelectors } from '@/store/home/selectors';++interface ResolvedHomeAgent {+ agentId: string | undefined;+ isInbox: boolean;+}++/**+ * `homeSelectedAgentId` is persisted in browser-scoped systemStatus+ * localStorage, so switching accounts on the same browser leaves the previous+ * account's agent id behind. If that id doesn't belong to the current account+ * we fall back to inbox and reset the persisted value, so the dropdown / send+ * flow stop pointing at a missing agent (which would otherwise render the+ * generic "Custom Agent" + default avatar fallback).+ */+export const useResolvedHomeAgentId = (): ResolvedHomeAgent => {+ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);+ const selectedAgentId = useGlobalStore(systemStatusSelectors.homeSelectedAgentId);+ const isAgentListInit = useHomeStore(homeAgentListSelectors.isAgentListInit);+ const sidebarItem = useHomeStore(homeAgentListSelectors.getAgentById(selectedAgentId ?? ''));+ const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);++ const isStale =+ !!selectedAgentId &&+ !!inboxAgentId &&+ isAgentListInit &&+ selectedAgentId !== inboxAgentId &&+ !sidebarItem;++ useEffect(() => {+ if (!isStale || !inboxAgentId) return;+ // `merge` skips `undefined` source values, so we can't clear the field+ // by passing `undefined`. Reset to the inbox id — semantically equivalent+ // to "no override".+ updateSystemStatus({ homeSelectedAgentId: inboxAgentId });+ }, [isStale, inboxAgentId, updateSystemStatus]);++ const agentId = isStale ? inboxAgentId : (selectedAgentId ?? inboxAgentId);++ return {+ agentId,+ isInbox: !!agentId && agentId === inboxAgentId,+ };+};diff --git a/src/routes/(main)/home/features/CommunityRecommend/AssistantList.tsx b/src/routes/(main)/home/features/CommunityRecommend/AssistantList.tsxdeleted file mode 100644index 9f033695735..00000000000--- a/src/routes/(main)/home/features/CommunityRecommend/AssistantList.tsx+++ /dev/null@@ -1,68 +0,0 @@-'use client';--import { memo } from 'react';-import { Link } from 'react-router-dom';-import urlJoin from 'url-join';--import GroupSkeleton from '@/routes/(main)/home/features/components/GroupSkeleton';-import { RECENT_BLOCK_SIZE } from '@/routes/(main)/home/features/const';-import { useDiscoverStore } from '@/store/discover';-import { type StarterMode } from '@/store/home';-import { AssistantCategory } from '@/types/discover';--import Item from './Item';--interface AssistantListProps {- mode: StarterMode;-}--const AssistantList = memo<AssistantListProps>(({ mode }) => {- const useAssistantList = useDiscoverStore((s) => s.useAssistantList);-- // For 'write' mode, filter by copywriting category- const category = mode === 'write' ? AssistantCategory.CopyWriting : undefined;-- const { data: assistantList, isLoading } = useAssistantList({- category,- page: 1,- pageSize: 12,- });-- if (isLoading) {- return (- <GroupSkeleton- height={RECENT_BLOCK_SIZE.AGENT.HEIGHT}- width={RECENT_BLOCK_SIZE.AGENT.WIDTH}- />- );- }-- if (!assistantList || assistantList.items.length === 0) {- return null;- }-- return (- <>- {assistantList.items.map((item, index) => (- <Link- key={index}- to={urlJoin('/community/agent', item.identifier)}- style={{- color: 'inherit',- textDecoration: 'none',- }}- >- <Item- author={item.author}- avatar={item.avatar}- backgroundColor={item.backgroundColor}- description={item.description}- title={item.title}- />- </Link>- ))}- </>- );-});--export default AssistantList;diff --git a/src/routes/(main)/home/features/CommunityRecommend/GroupList.tsx b/src/routes/(main)/home/features/CommunityRecommend/GroupList.tsxdeleted file mode 100644index 1f360742b8c..00000000000--- a/src/routes/(main)/home/features/CommunityRecommend/GroupList.tsx+++ /dev/null@@ -1,58 +0,0 @@-'use client';--import { memo } from 'react';-import { Link } from 'react-router-dom';-import urlJoin from 'url-join';--import GroupSkeleton from '@/routes/(main)/home/features/components/GroupSkeleton';-import { RECENT_BLOCK_SIZE } from '@/routes/(main)/home/features/const';-import { useDiscoverStore } from '@/store/discover';--import Item from './Item';--const GroupList = memo(() => {- const useGroupAgentList = useDiscoverStore((s) => s.useGroupAgentList);-- const { data: groupList, isLoading } = useGroupAgentList({- page: 1,- pageSize: 12,- });-- if (isLoading) {- return (- <GroupSkeleton- height={RECENT_BLOCK_SIZE.AGENT.HEIGHT}- width={RECENT_BLOCK_SIZE.AGENT.WIDTH}- />- );- }-- if (!groupList || groupList.items.length === 0) {- return null;- }-- return (- <>- {groupList.items.map((item, index) => (- <Link- key={index}- to={urlJoin('/community/group_agent', item.identifier)}- style={{- color: 'inherit',- textDecoration: 'none',- }}- >- <Item- author={item.author}- avatar={item.avatar}- backgroundColor={item.backgroundColor}- description={item.description}- title={item.title}- />- </Link>- ))}- </>- );-});--export default GroupList;diff --git a/src/routes/(main)/home/features/CommunityRecommend/Item.tsx b/src/routes/(main)/home/features/CommunityRecommend/Item.tsxdeleted file mode 100644index 383e8695ce0..00000000000--- a/src/routes/(main)/home/features/CommunityRecommend/Item.tsx+++ /dev/null@@ -1,79 +0,0 @@-import { Avatar, Block, Flexbox, Text } from '@lobehub/ui';-import { cssVar } from 'antd-style';-import { memo } from 'react';--import { DEFAULT_AVATAR } from '@/const/meta';-import { useIsDark } from '@/hooks/useIsDark';-import { RECENT_BLOCK_SIZE } from '@/routes/(main)/home/features/const';--interface ItemProps {- author?: string;- avatar?: string;- backgroundColor?: string;- description?: string;- title?: string;-}--const Item = memo<ItemProps>(({ title, avatar, backgroundColor, author, description }) => {- const isDarkMode = useIsDark();-- return (- <Block- clickable- flex={'none'}- height={RECENT_BLOCK_SIZE.AGENT.HEIGHT}- justify={'space-between'}- variant={'filled'}- width={RECENT_BLOCK_SIZE.AGENT.WIDTH}- style={{- backgroundColor: cssVar.colorFillQuaternary,- borderRadius: cssVar.borderRadiusLG,- overflow: 'hidden',- }}- >- <Block- flex={1}- padding={12}- variant={'outlined'}- style={{- backgroundColor: isDarkMode ? cssVar.colorFillQuaternary : cssVar.colorBgContainer,- borderRadius: cssVar.borderRadiusLG,- boxShadow: '0 4px 8px -2px rgba(0,0,0,.02)',- overflow: 'hidden',- }}- >- <Text color={cssVar.colorTextSecondary} ellipsis={{ rows: 3 }} fontSize={13}>- {description}- </Text>- </Block>- <Flexbox horizontal align={'center'} gap={8} paddingBlock={8} paddingInline={12}>- <Flexbox- flex={1}- gap={1}- style={{- overflow: 'hidden',- }}- >- <Text ellipsis fontSize={13} weight={500}>- {title}- </Text>- <Text ellipsis fontSize={12} type={'secondary'}>- {author}- </Text>- </Flexbox>- <Avatar- emojiScaleWithBackground- avatar={avatar || DEFAULT_AVATAR}- background={backgroundColor || undefined}- shape={'square'}- size={30}- style={{- flex: 'none',- }}- />- </Flexbox>- </Block>- );-});--export default Item;diff --git a/src/routes/(main)/home/features/CommunityRecommend/index.tsx b/src/routes/(main)/home/features/CommunityRecommend/index.tsxdeleted file mode 100644index 5d8d3898bb0..00000000000--- a/src/routes/(main)/home/features/CommunityRecommend/index.tsx+++ /dev/null@@ -1,135 +0,0 @@-'use client';--import { ActionIcon, DropdownMenu, Empty } from '@lobehub/ui';-import { BotIcon, MoreHorizontal, UsersIcon } from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';-import { useNavigate } from 'react-router-dom';--import { useDiscoverStore } from '@/store/discover';-import { type StarterMode } from '@/store/home';-import { AssistantCategory } from '@/types/discover';--import GroupBlock from '../components/GroupBlock';-import GroupSkeleton from '../components/GroupSkeleton';-import ScrollShadowWithButton from '../components/ScrollShadowWithButton';-import { RECENT_BLOCK_SIZE } from '../const';-import AssistantList from './AssistantList';-import GroupList from './GroupList';--interface CommunityRecommendProps {- mode: StarterMode;-}--const CommunityRecommend = memo<CommunityRecommendProps>(({ mode }) => {- const { t } = useTranslation('discover');- const navigate = useNavigate();-- const isGroupMode = mode === 'group';-- // Fetch data to check loading and empty state- const useAssistantList = useDiscoverStore((s) => s.useAssistantList);- const useGroupAgentList = useDiscoverStore((s) => s.useGroupAgentList);-- const category = mode === 'write' ? AssistantCategory.CopyWriting : undefined;-- const { data: assistantList, isLoading: isAssistantLoading } = useAssistantList(- !isGroupMode ? { category, page: 1, pageSize: 12 } : undefined,- );- const { data: groupList, isLoading: isGroupLoading } = useGroupAgentList(- isGroupMode ? { page: 1, pageSize: 12 } : undefined,- );-- // Don't render if mode is invalid- if (!mode || !['agent', 'group', 'write'].includes(mode)) {- return null;- }-- const isLoading = isGroupMode ? isGroupLoading : isAssistantLoading;- const hasData = isGroupMode- ? groupList && groupList.items.length > 0- : assistantList && assistantList.items.length > 0;-- const getTitle = () => {- switch (mode) {- case 'agent': {- return t('home.recommendAgents');- }- case 'group': {- return t('home.recommendGroups');- }- case 'write': {- return t('home.recommendWritingAgents');- }- default: {- return '';- }- }- };-- const getMorePath = () => {- switch (mode) {- case 'agent': {- return '/community/agent';- }- case 'group': {- return '/community/agent?includeAgentGroup=true';- }- case 'write': {- return '/community/agent?category=copywriting';- }- default: {- return '/community/agent';- }- }- };-- const renderContent = () => {- if (isLoading) {- return (- <GroupSkeleton- height={RECENT_BLOCK_SIZE.AGENT.HEIGHT}- width={RECENT_BLOCK_SIZE.AGENT.WIDTH}- />- );- }-- if (!hasData) {- return (- <Empty- description={t('home.recommendEmpty')}- icon={isGroupMode ? UsersIcon : BotIcon}- style={{ padding: '24px 0' }}- />- );- }-- return isGroupMode ? <GroupList /> : <AssistantList mode={mode} />;- };-- return (- <GroupBlock- icon={isGroupMode ? UsersIcon : BotIcon}- title={getTitle()}- action={- <DropdownMenu- items={[- {- key: 'more',- label: t('home.more'),- onClick: () => {- navigate(getMorePath());- },- },- ]}- >- <ActionIcon icon={MoreHorizontal} size="small" />- </DropdownMenu>- }- >- <ScrollShadowWithButton>{renderContent()}</ScrollShadowWithButton>- </GroupBlock>- );-});--export default CommunityRecommend;diff --git a/src/routes/(main)/home/features/InputArea/BotIntegrationBanner.tsx b/src/routes/(main)/home/features/InputArea/BotIntegrationBanner.tsxnew file mode 100644index 00000000000..ec38a29276d--- /dev/null+++ b/src/routes/(main)/home/features/InputArea/BotIntegrationBanner.tsx@@ -0,0 +1,152 @@+'use client';++import { ActionIcon, Flexbox, Icon } from '@lobehub/ui';+import { createStaticStyles } from 'antd-style';+import { RadioTowerIcon, X } from 'lucide-react';+import type { FC } from 'react';+import React, { memo, useCallback, useMemo } from 'react';+import { useTranslation } from 'react-i18next';+import { useNavigate } from 'react-router-dom';++import { getPlatformIcon } from '@/routes/(main)/agent/channel/const';+import { useAgentStore } from '@/store/agent';+import { builtinAgentSelectors } from '@/store/agent/selectors/builtinAgentSelectors';+import { useGlobalStore } from '@/store/global';++// Bump this id when the banner content changes so dismissing the old+// variant does not hide the new one.+export const BOT_INTEGRATION_BANNER_ID = 'bot-integration-v1';++const ICON_SIZE = 16;+const AVATAR_SIZE = 24;++const BANNER_PLATFORM_NAMES = ['Discord', 'Slack', 'Telegram', 'Lark', 'WeChat', 'QQ'] as const;++const styles = createStaticStyles(({ css, cssVar }) => ({+ avatar: css`+ display: flex;+ flex-shrink: 0;+ align-items: center;+ justify-content: center;++ width: ${AVATAR_SIZE}px;+ height: ${AVATAR_SIZE}px;+ border-radius: 50%;++ background: ${cssVar.colorBgContainer};+ box-shadow:+ 0 0 8px -2px rgb(0 0 0 / 5%),+ 0 0 0 1px ${cssVar.colorFillTertiary};+ `,+ banner: css`+ cursor: pointer;++ position: absolute;+ z-index: 0;+ inset-block-end: 0;+ inset-inline: 0;++ display: flex;+ gap: 12px;+ align-items: center;+ justify-content: space-between;++ margin-block-end: -6px;+ padding-block: 42px 10px;+ padding-inline: 16px 12px;+ border: 1px solid ${cssVar.colorFillSecondary};+ border-radius: 20px;++ background: color-mix(in srgb, ${cssVar.colorFillQuaternary} 50%, ${cssVar.colorBgContainer});+ `,+ icon: css`+ color: ${cssVar.colorTextSecondary};+ `,+ iconGroup: css`+ display: flex;+ align-items: center;+ `,+ text: css`+ font-size: 13px;+ color: ${cssVar.colorTextSecondary};+ `,+}));++const BotIntegrationBanner = memo(() => {+ const { t } = useTranslation('common');+ const navigate = useNavigate();++ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);+ const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);++ const platformIcons = useMemo(() => {+ const icons: Array<{ Icon: FC<any>; key: string }> = [];++ for (const name of BANNER_PLATFORM_NAMES) {+ const PlatformIcon = getPlatformIcon(name);+ if (!PlatformIcon) continue;+ const ColorIcon =+ 'Color' in PlatformIcon+ ? ((PlatformIcon as any).Color as FC<any>)+ : (PlatformIcon as FC<any>);+ icons.push({ Icon: ColorIcon, key: name });+ }++ return icons;+ }, []);++ const handleNavigateToChannels = useCallback(() => {+ if (!inboxAgentId) return;+ navigate(`/agent/${inboxAgentId}/channel`);+ }, [inboxAgentId, navigate]);++ const handleDismiss = useCallback(+ (e: React.MouseEvent) => {+ e.stopPropagation();+ const current = useGlobalStore.getState().status.dismissedBannerIds || [];+ if (current.includes(BOT_INTEGRATION_BANNER_ID)) return;+ updateSystemStatus({+ dismissedBannerIds: [...current, BOT_INTEGRATION_BANNER_ID],+ });+ },+ [updateSystemStatus],+ );++ return (+ <div+ className={styles.banner}+ data-testid="bot-integration-banner"+ onClick={handleNavigateToChannels}+ >+ <Flexbox horizontal align="center" gap={4}>+ <Icon className={styles.icon} icon={RadioTowerIcon} size={18} />+ <span className={styles.text}>{t('botIntegrationBanner.title')}</span>+ </Flexbox>+ <Flexbox horizontal align="center" gap={8}>+ {platformIcons.length > 0 && (+ <div className={styles.iconGroup}>+ {platformIcons.map(({ Icon: PlatformIcon, key }, index) => (+ <div+ className={styles.avatar}+ key={key}+ style={{ marginLeft: index === 0 ? 0 : -6, zIndex: index }}+ >+ <PlatformIcon size={ICON_SIZE} />+ </div>+ ))}+ </div>+ )}+ <ActionIcon+ icon={X}+ size="small"+ title={t('botIntegrationBanner.dismiss')}+ onClick={handleDismiss}+ />+ </Flexbox>+ </div>+ );+});++BotIntegrationBanner.displayName = 'BotIntegrationBanner';++export default BotIntegrationBanner;diff --git a/src/routes/(main)/home/features/InputArea/ModeTag.tsx b/src/routes/(main)/home/features/InputArea/ModeTag.tsxdeleted file mode 100644index e08e37b6a9c..00000000000--- a/src/routes/(main)/home/features/InputArea/ModeTag.tsx+++ /dev/null@@ -1,69 +0,0 @@-import { ActionIcon, Block, Text } from '@lobehub/ui';-import { GroupBotSquareIcon } from '@lobehub/ui/icons';-import { createStaticStyles, cssVar } from 'antd-style';-import { BotIcon, FilePenIcon, ImageIcon, PenLineIcon, VideoIcon, X } from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { useHomeStore } from '@/store/home';--const styles = createStaticStyles(({ css, cssVar }) => ({- container: css`- padding-inline-start: 12px;- border-radius: 16px;- `,- title: css`- font-size: 13px;- font-weight: 500;- color: ${cssVar.colorTextSecondary};- `,-}));--const modeConfig = {- agent: { icon: BotIcon, titleKey: 'starter.createAgent' },- group: { icon: GroupBotSquareIcon, titleKey: 'starter.createGroup' },- image: { icon: ImageIcon, titleKey: 'starter.image' },- research: { icon: FilePenIcon, titleKey: 'starter.deepResearch' },- video: { icon: VideoIcon, titleKey: 'starter.videoGeneration' },- write: { icon: PenLineIcon, titleKey: 'starter.write' },-} as const;--const ModeHeader = memo(() => {- const { t } = useTranslation('home');-- const [inputActiveMode, clearInputMode] = useHomeStore((s) => [- s.inputActiveMode,- s.clearInputMode,- ]);-- if (!inputActiveMode) return null;-- const config = modeConfig[inputActiveMode];- const Icon = config.icon;-- return (- <Block- horizontal- align="center"- className={styles.container}- gap={8}- padding={4}- variant={'filled'}- >- <Icon color={cssVar.colorTextDescription} size={16} />- <Text fontSize={12} type={'secondary'}>- {t(config.titleKey)}- </Text>- <ActionIcon- icon={X}- size="small"- style={{- borderRadius: 16,- }}- onClick={clearInputMode}- />- </Block>- );-});--export default ModeHeader;diff --git a/src/routes/(main)/home/features/InputArea/StarterList.tsx b/src/routes/(main)/home/features/InputArea/StarterList.tsxindex 7ebb96c9f1b..b04ec30cf78 100644--- a/src/routes/(main)/home/features/InputArea/StarterList.tsx+++ b/src/routes/(main)/home/features/InputArea/StarterList.tsx@@ -1,23 +1,24 @@-import { BUILTIN_AGENT_SLUGS } from '@lobechat/builtin-agents';-import { Jimeng } from '@lobehub/icons';+import { DeepSeek, Jimeng, OpenAI } from '@lobehub/icons';import { type ButtonProps } from '@lobehub/ui';-import { Button, Center, Tooltip } from '@lobehub/ui';-import { GroupBotSquareIcon } from '@lobehub/ui/icons';-import { createStaticStyles, cssVar, cx } from 'antd-style';-import { BotIcon, ImageIcon, PenLineIcon } from 'lucide-react';-import { memo, useCallback, useMemo } from 'react';+import { Button, Center, Tag, Tooltip } from '@lobehub/ui';+import { App } from 'antd';+import { createStaticStyles, cx } from 'antd-style';+import { memo, useCallback, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';-import { useInitBuiltinAgent } from '@/hooks/useInitBuiltinAgent';import { useStableNavigate } from '@/hooks/useStableNavigate';-import { type StarterMode } from '@/store/home';-import { useHomeStore } from '@/store/home';+import { agentService } from '@/services/agent';+import { useAgentStore } from '@/store/agent';+import { agentByIdSelectors } from '@/store/agent/selectors';++import { useResolvedHomeAgentId } from '../AgentSelect/useResolvedHomeAgentId';++const DEEPSEEK_V4_PRO_MODEL = 'deepseek-v4-pro';+const DEEPSEEK_V4_PRO_PROVIDER = 'lobehub';++type StarterKey = 'image' | 'video' | 'deepseek-v4-pro';const styles = createStaticStyles(({ css, cssVar }) => ({- active: css`- border-color: ${cssVar.colorFillSecondary} !important;- background: ${cssVar.colorBgElevated} !important;- `,button: css`height: 40px;border-color: ${cssVar.colorFillSecondary};@@ -29,78 +30,55 @@ const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorBgElevated} !important;}`,+ newTag: css`+ padding-inline: 10px !important;+ border-radius: 999px !important;+ `,}));type StarterTitleKey =- | 'starter.createAgent'- | 'starter.createGroup'- | 'starter.write'| 'starter.imageGeneration'| 'starter.videoGeneration'- | 'starter.deepResearch';+ | 'starter.deepseekV4Pro';interface StarterItem {disabled?: boolean;- hot?: boolean;icon?: ButtonProps['icon'];- key: StarterMode;+ key: StarterKey;titleKey: StarterTitleKey;}const StarterList = memo(() => {const { t } = useTranslation('home');-- useInitBuiltinAgent(BUILTIN_AGENT_SLUGS.agentBuilder);- useInitBuiltinAgent(BUILTIN_AGENT_SLUGS.groupAgentBuilder);- useInitBuiltinAgent(BUILTIN_AGENT_SLUGS.pageAgent);-const navigate = useStableNavigate();- const [inputActiveMode, setInputActiveMode] = useHomeStore((s) => [- s.inputActiveMode,- s.setInputActiveMode,- ]);+ const { message } = App.useApp();+ const { agentId: activeAgentId } = useResolvedHomeAgentId();+ const updateAgentConfigById = useAgentStore((s) => s.updateAgentConfigById);+ const [switchingKey, setSwitchingKey] = useState<StarterKey | null>(null);const items: StarterItem[] = useMemo(() => [{- icon: BotIcon,- key: 'agent',- titleKey: 'starter.createAgent',+ icon: DeepSeek.Avatar,+ key: 'deepseek-v4-pro',+ titleKey: 'starter.deepseekV4Pro',},{- icon: GroupBotSquareIcon,- key: 'group',- titleKey: 'starter.createGroup',- },- {- icon: PenLineIcon,- key: 'write',- titleKey: 'starter.write',- },- {- hot: true,- icon: ImageIcon,+ icon: OpenAI.Avatar,key: 'image',titleKey: 'starter.imageGeneration',},{- hot: true,- icon: Jimeng.Color,+ icon: Jimeng.Avatar,key: 'video',titleKey: 'starter.videoGeneration',},- // {- // disabled: true,- // icon: MicroscopeIcon,- // key: 'research',- // titleKey: 'starter.deepResearch',- // },],[],);const handleClick = useCallback(- (key: StarterMode) => {+ async (key: StarterKey) => {if (key === 'video') {navigate('/video?model=dreamina-seedance-2-0-260128');return;@@ -111,35 +89,66 @@ const StarterList = memo(() => {return;}- // Toggle mode: if clicking the active mode, clear it; otherwise set it- if (inputActiveMode === key) {- setInputActiveMode(null);- } else {- setInputActiveMode(key);+ if (key === 'deepseek-v4-pro') {+ if (!activeAgentId || switchingKey) return;+ setSwitchingKey(key);+ try {+ // Hydrate the agent's config before mutating so the optimistic update+ // doesn't drop pre-existing fields the home input never loaded.+ let agentState = useAgentStore.getState();+ if (!agentState.agentMap[activeAgentId]) {+ const config = await agentService.getAgentConfigById(activeAgentId);+ if (config) agentState.internal_dispatchAgentMap(activeAgentId, config);+ agentState = useAgentStore.getState();+ }++ const currentModel = agentByIdSelectors.getAgentModelById(activeAgentId)(agentState);+ const currentProvider =+ agentByIdSelectors.getAgentModelProviderById(activeAgentId)(agentState);+ if (+ currentModel === DEEPSEEK_V4_PRO_MODEL &&+ currentProvider === DEEPSEEK_V4_PRO_PROVIDER+ ) {+ message.info(t('starter.deepseekV4ProAlready'));+ return;+ }++ await updateAgentConfigById(activeAgentId, {+ model: DEEPSEEK_V4_PRO_MODEL,+ provider: DEEPSEEK_V4_PRO_PROVIDER,+ });+ message.success(t('starter.deepseekV4ProSwitched'));+ } finally {+ setSwitchingKey(null);+ }+ return;}},- [inputActiveMode, navigate, setInputActiveMode],+ [navigate, activeAgentId, updateAgentConfigById, switchingKey, message, t],);return (<Center horizontal gap={8}>+ <Tag className={styles.newTag} size={'small'}>+ {t('starter.newLabel')}+ </Tag>{items.map((item) => {+ const isLoading = switchingKey === item.key;const button = (<Button- className={cx(styles.button, inputActiveMode === item.key && styles.active)}- disabled={item.disabled}+ className={cx(styles.button)}+ disabled={item.disabled || (!!switchingKey && !isLoading)}icon={item.icon}key={item.key}+ loading={isLoading}shape={'round'}variant={'outlined'}iconProps={{- color: inputActiveMode === item.key ? cssVar.colorText : cssVar.colorTextSecondary,size: 18,}}onClick={() => handleClick(item.key)}>{t(item.titleKey)}- {item.hot && ' 🔥'}</Button>);diff --git a/src/routes/(main)/home/features/InputArea/index.tsx b/src/routes/(main)/home/features/InputArea/index.tsxindex b8db5461ba8..0d5b7d029ba 100644--- a/src/routes/(main)/home/features/InputArea/index.tsx+++ b/src/routes/(main)/home/features/InputArea/index.tsx@@ -1,60 +1,87 @@import { Flexbox } from '@lobehub/ui';-import { AnimatePresence, m } from 'motion/react';-import { useEffect, useMemo, useRef } from 'react';+import { useEffect, useMemo, useRef, useState } from 'react';import DragUploadZone, { useUploadFiles } from '@/components/DragUploadZone';import { type ActionKeys } from '@/features/ChatInput';import { ChatInputProvider, DesktopChatInput } from '@/features/ChatInput';import { useAgentStore } from '@/store/agent';import { agentByIdSelectors } from '@/store/agent/selectors';+import { builtinAgentSelectors } from '@/store/agent/selectors/builtinAgentSelectors';import { useChatStore } from '@/store/chat';import { useGlobalStore } from '@/store/global';import { systemStatusSelectors } from '@/store/global/selectors';-import { useHomeStore } from '@/store/home';import {featureFlagsSelectors,serverConfigSelectors,useServerConfigStore,} from '@/store/serverConfig';-import CommunityRecommend from '../CommunityRecommend';import SuggestQuestions from '../SuggestQuestions';-import ModeTag from './ModeTag';+import BotIntegrationBanner, { BOT_INTEGRATION_BANNER_ID } from './BotIntegrationBanner';import SkillInstallBanner, { SKILL_INSTALL_BANNER_ID } from './SkillInstallBanner';import StarterList from './StarterList';import { useSend } from './useSend';const leftActions: ActionKeys[] = ['model', 'search', 'fileUpload', 'tools'];+type BannerKind = 'skill' | 'botIntegration';+const InputArea = () => {- const { loading, send, inboxAgentId } = useSend();- const inputActiveMode = useHomeStore((s) => s.inputActiveMode);+ const { loading, send, agentId } = useSend();+ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);const isLobehubSkillEnabled = useServerConfigStore(serverConfigSelectors.enableLobehubSkill);const isKlavisEnabled = useServerConfigStore(serverConfigSelectors.enableKlavis);- const { enableAgentTask } = useServerConfigStore(featureFlagsSelectors);+ const serverConfigInit = useServerConfigStore((s) => s.serverConfigInit);const isSkillBannerDismissed = useGlobalStore(systemStatusSelectors.isBannerDismissed(SKILL_INSTALL_BANNER_ID),);- const showSkillBanner = (isLobehubSkillEnabled || isKlavisEnabled) && !isSkillBannerDismissed;+ const isBotIntegrationBannerDismissed = useGlobalStore(+ systemStatusSelectors.isBannerDismissed(BOT_INTEGRATION_BANNER_ID),+ );const chatInputRef = useRef<HTMLDivElement>(null);- // When a starter mode is activated (e.g. Create Agent / Create Group / Write),- // the SuggestQuestions panel renders below the ChatInput and may push the total- // content height beyond the viewport, causing the ChatInput to scroll out of view.- // Re-focus the editor and scroll it into view so the user can type immediately.+ // Wait for both stores to finish hydrating before drawing — server config+ // (skill flags) and the agent store (inboxAgentId) hydrate at different+ // times, and picking too early biases the draw toward whichever arrived+ // first. After picking, dismissing the active banner only hides it for+ // this mount — re-mounting re-rolls from the still-undismissed pool.+ const [activeBanner, setActiveBanner] = useState<BannerKind | null>(null);+ const hasPickedRef = useRef(false);+useEffect(() => {- if (!inputActiveMode) return;+ if (hasPickedRef.current) return;+ if (!serverConfigInit || !inboxAgentId) return;++ const candidates: BannerKind[] = [];+ if ((isLobehubSkillEnabled || isKlavisEnabled) && !isSkillBannerDismissed) {+ candidates.push('skill');+ }+ if (!isBotIntegrationBannerDismissed) candidates.push('botIntegration');+ if (candidates.length === 0) return;- requestAnimationFrame(() => {- chatInputRef.current?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });- useChatStore.getState().mainInputEditor?.focus();- });- }, [inputActiveMode]);+ hasPickedRef.current = true;+ setActiveBanner(candidates[Math.floor(Math.random() * candidates.length)]);+ }, [+ inboxAgentId,+ isBotIntegrationBannerDismissed,+ isKlavisEnabled,+ isLobehubSkillEnabled,+ isSkillBannerDismissed,+ serverConfigInit,+ ]);- // Get agent's model info for vision support check- const model = useAgentStore((s) => agentByIdSelectors.getAgentModelById(inboxAgentId)(s));+ const isActiveBannerDismissed =+ (activeBanner === 'skill' && isSkillBannerDismissed) ||+ (activeBanner === 'botIntegration' && isBotIntegrationBannerDismissed);+ const visibleBanner = isActiveBannerDismissed ? null : activeBanner;++ // Get agent's model info for vision support check. Falls back to an empty+ // id while the agent id resolves; the selectors return DEFAULT_MODEL /+ // DEFAULT_PROVIDER for unknown ids.+ const resolvedAgentId = agentId ?? '';+ const model = useAgentStore((s) => agentByIdSelectors.getAgentModelById(resolvedAgentId)(s));const provider = useAgentStore((s) =>- agentByIdSelectors.getAgentModelProviderById(inboxAgentId)(s),+ agentByIdSelectors.getAgentModelProviderById(resolvedAgentId)(s),);const { handleUploadFiles } = useUploadFiles({ model, provider });@@ -72,37 +99,24 @@ const InputArea = () => {[],);- const hideStarterList = inputActiveMode && ['agent', 'group', 'write'].includes(inputActiveMode);- const showSuggestQuestions = inputActiveMode- ? ['agent', 'group', 'write'].includes(inputActiveMode)- : !enableAgentTask;-- const extraActionItems = useMemo(- () =>- inputActiveMode- ? [- {- children: <ModeTag />,- key: 'mode-tag',- },- ]- : [],- [inputActiveMode],- );+ const { enableAgentTask } = useServerConfigStore(featureFlagsSelectors);+ // Whitelist users get DailyBrief + an upcoming auto-generated module instead.+ const showSuggestQuestions = !enableAgentTask;return (<Flexbox gap={16} style={{ marginBottom: 16 }}><Flexboxref={chatInputRef}- style={{ paddingBottom: showSkillBanner ? 32 : 0, position: 'relative' }}+ style={{ paddingBottom: visibleBanner ? 32 : 0, position: 'relative' }}>- {showSkillBanner && <SkillInstallBanner />}+ {visibleBanner === 'skill' && <SkillInstallBanner />}+ {visibleBanner === 'botIntegration' && <BotIntegrationBanner />}<DragUploadZonestyle={{ position: 'relative', zIndex: 1 }}onUploadFiles={handleUploadFiles}><ChatInputProvider- agentId={inboxAgentId}+ agentId={agentId}allowExpand={false}leftActions={leftActions}slashPlacement="bottom"@@ -123,7 +137,6 @@ const InputArea = () => {><DesktopChatInputdropdownPlacement="bottomLeft"- extraActionItems={extraActionItems}inputContainerProps={inputContainerProps}showRuntimeConfig={false}/>@@ -131,30 +144,12 @@ const InputArea = () => {</DragUploadZone></Flexbox>- {/* Keep StarterList mounted to prevent useInitBuiltinAgent hooks from re-running */}- <div style={{ display: hideStarterList ? 'none' : undefined }}>- <StarterList />- </div>- <AnimatePresence mode="popLayout">- {showSuggestQuestions && (- <m.div- animate={{ opacity: 1, scale: 1, y: 0 }}- exit={{ opacity: 0, scale: 0.98, y: 8 }}- initial={{ opacity: 0, scale: 0.98, y: 8 }}- key={inputActiveMode ?? 'chat'}- style={{ marginTop: inputActiveMode ? 0 : 24 }}- transition={{- duration: 0.2,- ease: [0.4, 0, 0.2, 1],- }}- >- <Flexbox gap={24}>- <SuggestQuestions mode={inputActiveMode} />- <CommunityRecommend mode={inputActiveMode} />- </Flexbox>- </m.div>- )}- </AnimatePresence>+ <StarterList />+ {showSuggestQuestions && (+ <Flexbox style={{ marginTop: 24 }}>+ <SuggestQuestions />+ </Flexbox>+ )}</Flexbox>);};diff --git a/src/routes/(main)/home/features/InputArea/useSend.ts b/src/routes/(main)/home/features/InputArea/useSend.tsindex 981b8d611e9..d0a706784f8 100644--- a/src/routes/(main)/home/features/InputArea/useSend.ts+++ b/src/routes/(main)/home/features/InputArea/useSend.ts@@ -3,21 +3,44 @@ import { useCallback } from 'react';import type { SendButtonHandler } from '@/features/ChatInput/store/initialState';import { useQueryRoute } from '@/hooks/useQueryRoute';+import { agentService } from '@/services/agent';import { useAgentStore } from '@/store/agent';-import { builtinAgentSelectors } from '@/store/agent/selectors';import { useChatStore } from '@/store/chat';import { fileChatSelectors, useFileStore } from '@/store/file';import { useHomeStore } from '@/store/home';+import { useResolvedHomeAgentId } from '../AgentSelect/useResolvedHomeAgentId';++/**+ * Make sure the agent's config is hydrated into `agentMap` before we call+ * `sendMessage`. Without this, sending to an agent the user just picked from+ * the home AgentSelect (and never opened in this session) silently fails:+ * `sendMessage` reaches `getAgentConfigById(agentId)` which returns `undefined`+ * from `agentMap`, the `{ model, provider }` destructure throws, and the+ * surrounding catch swallows it — so the chat page mounts with optimistic+ * messages but the runtime never starts.+ */+const ensureAgentConfigLoaded = async (agentId: string): Promise<void> => {+ const agentState = useAgentStore.getState();+ if (agentState.agentMap[agentId]) return;+ const config = await agentService.getAgentConfigById(agentId);+ if (config) agentState.internal_dispatchAgentMap(agentId, config);+};+export const useSend = () => {const router = useQueryRoute();- const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);const sendMessage = useChatStore((s) => s.sendMessage);const clearChatUploadFileList = useFileStore((s) => s.clearChatUploadFileList);const clearChatContextSelections = useFileStore((s) => s.clearChatContextSelections);const homeInputLoading = useHomeStore((s) => s.homeInputLoading);+ // Resolve the agent that the home input is currently bound to. Defaults to the+ // inbox agent; AgentSelect can override via systemStatus.homeSelectedAgentId.+ // The hook also rewrites stale ids (e.g. left over from a different account+ // on the same browser) back to inbox so we don't try to send to a missing id.+ const { agentId: activeAgentId } = useResolvedHomeAgentId();+const send = useCallback<SendButtonHandler>(async ({ getEditorData }) => {const { inputMessage, mainInputEditor } = useChatStore.getState();@@ -53,18 +76,23 @@ export const useSend = () => {}default: {- // Default inbox behavior- if (!inboxAgentId) return;+ // Default behavior: send to currently selected agent (inbox by default,+ // overridable via the home AgentSelect dropdown).+ if (!activeAgentId) return;++ // First-time selections from AgentSelect have no entry in `agentMap`+ // yet — block on the fetch so sendMessage finds a real config below.+ await ensureAgentConfigLoaded(activeAgentId);sendMessage({- context: { agentId: inboxAgentId },+ context: { agentId: activeAgentId },contexts: contextList,editorData,files: fileList,message: inputMessage,});- router.push(SESSION_CHAT_URL(inboxAgentId, false));+ router.push(SESSION_CHAT_URL(activeAgentId, false));}}} finally {@@ -74,11 +102,11 @@ export const useSend = () => {mainInputEditor?.clearContent();}},- [inboxAgentId, sendMessage, clearChatContextSelections, clearChatUploadFileList, router],+ [activeAgentId, sendMessage, clearChatContextSelections, clearChatUploadFileList, router],);return {- inboxAgentId,+ agentId: activeAgentId,loading: homeInputLoading,send,};diff --git a/src/routes/(main)/home/features/SuggestQuestions/index.tsx b/src/routes/(main)/home/features/SuggestQuestions/index.tsxindex 103d2d59b18..2682396ca44 100644--- a/src/routes/(main)/home/features/SuggestQuestions/index.tsx+++ b/src/routes/(main)/home/features/SuggestQuestions/index.tsx@@ -6,7 +6,6 @@ import { Lightbulb, RefreshCw } from 'lucide-react';import { memo, Suspense } from 'react';import { useTranslation } from 'react-i18next';-import { type StarterMode } from '@/store/home';import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';import GroupBlock from '../components/GroupBlock';@@ -14,21 +13,13 @@ import List from './List';import SuggestQuestionsSkeleton from './Skeleton';import { useRandomQuestions } from './useRandomQuestions';-interface SuggestQuestionsProps {- mode: StarterMode;-}--const SuggestQuestions = memo<SuggestQuestionsProps>(({ mode }) => {+const SuggestQuestions = memo(() => {const { t } = useTranslation('common');const { enableAgentTask } = useServerConfigStore(featureFlagsSelectors);- const { questions, refresh } = useRandomQuestions(mode);+ const { questions, refresh } = useRandomQuestions();if (enableAgentTask) return null;- if (mode && !['agent', 'group', 'write'].includes(mode)) {- return null;- }-return (<GroupBlockactionAlwaysVisiblediff --git a/src/routes/(main)/home/features/SuggestQuestions/useRandomQuestions.ts b/src/routes/(main)/home/features/SuggestQuestions/useRandomQuestions.tsindex b698c150418..1dd5319b136 100644--- a/src/routes/(main)/home/features/SuggestQuestions/useRandomQuestions.ts+++ b/src/routes/(main)/home/features/SuggestQuestions/useRandomQuestions.ts@@ -1,10 +1,10 @@import { useCallback, useState } from 'react';-import { type StarterMode } from '@/store/home';-const QUESTION_COUNT = 40;const DISPLAY_COUNT = 6;+export type QuestionMode = 'agent' | 'chat' | 'group' | 'write';+const shuffleArray = <T>(array: T[]): T[] => {const shuffled = [...array];for (let i = shuffled.length - 1; i > 0; i--) {@@ -14,19 +14,13 @@ const shuffleArray = <T>(array: T[]): T[] => {return shuffled;};-const generateQuestions = (mode: StarterMode) => {- const modeKey = mode ?? 'chat';-- if (!['agent', 'group', 'write', 'chat'].includes(modeKey)) {- return [];- }-+const generateQuestions = (mode: QuestionMode) => {const ids = Array.from({ length: QUESTION_COUNT }, (_, i) => i + 1);const shuffled = shuffleArray(ids);return shuffled.slice(0, DISPLAY_COUNT).map((id) => ({id,- promptKey: `${modeKey}.${String(id).padStart(2, '0')}.prompt`,- titleKey: `${modeKey}.${String(id).padStart(2, '0')}.title`,+ promptKey: `${mode}.${String(id).padStart(2, '0')}.prompt`,+ titleKey: `${mode}.${String(id).padStart(2, '0')}.title`,}));};@@ -41,7 +35,7 @@ interface UseRandomQuestionsResult {refresh: () => void;}-export const useRandomQuestions = (mode: StarterMode): UseRandomQuestionsResult => {+export const useRandomQuestions = (mode: QuestionMode = 'chat'): UseRandomQuestionsResult => {const [questions, setQuestions] = useState<QuestionItem[]>(() => generateQuestions(mode));const refresh = useCallback(() => {diff --git a/src/routes/(main)/home/features/WelcomeText/index.tsx b/src/routes/(main)/home/features/WelcomeText/index.tsxindex 69e8b32b918..0ed96304776 100644--- a/src/routes/(main)/home/features/WelcomeText/index.tsx+++ b/src/routes/(main)/home/features/WelcomeText/index.tsx@@ -1,4 +1,4 @@-import { Center } from '@lobehub/ui';+import { Flexbox } from '@lobehub/ui';import { TypewriterEffect } from '@lobehub/ui/awesome';import { LoadingDots } from '@lobehub/ui/chat';import { cssVar } from 'antd-style';@@ -16,11 +16,10 @@ const WelcomeText = memo(() => {}, [t]);return (- <Center+ <Flexboxstyle={{- fontSize: 28,- fontWeight: 'bold',- marginBlock: '36px 24px',+ fontSize: 16,+ paddingInlineStart: 5,}}><TypewriterEffect@@ -34,7 +33,7 @@ const WelcomeText = memo(() => {sentences={sentences}typingSpeed={64}/>- </Center>+ </Flexbox>);});diff --git a/src/routes/(main)/home/features/index.tsx b/src/routes/(main)/home/features/index.tsxindex 01c587af3e7..f5fce3e91c1 100644--- a/src/routes/(main)/home/features/index.tsx+++ b/src/routes/(main)/home/features/index.tsx@@ -5,37 +5,36 @@ import { memo } from 'react';import RecommendTaskTemplates from '@/business/client/RecommendTaskTemplates';import DailyBrief from '@/features/DailyBrief';-import { useHomeStore } from '@/store/home';+import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';import { useUserStore } from '@/store/user';import { authSelectors } from '@/store/user/slices/auth/selectors';-import { userGeneralSettingsSelectors } from '@/store/user/slices/settings/selectors';+import AgentSelect from './AgentSelect';import CommunityAgents from './CommunityAgents';import InputArea from './InputArea';import WelcomeText from './WelcomeText';const Home = memo(() => {const isLogin = useUserStore(authSelectors.isLogin);- const isDevMode = useUserStore((s) => userGeneralSettingsSelectors.config(s).isDevMode);- const inputActiveMode = useHomeStore((s) => s.inputActiveMode);-- // Hide other modules when a starter mode is active- const hideOtherModules = inputActiveMode && ['agent', 'group', 'write'].includes(inputActiveMode);+ const { enableAgentTask } = useServerConfigStore(featureFlagsSelectors);return (<Flexbox gap={40}>- <WelcomeText />- <InputArea />- {isLogin && (- <Flexbox gap={40} style={{ display: hideOtherModules ? 'none' : undefined }}>+ <Flexbox gap={24}>+ <Flexbox gap={4}>+ <AgentSelect />+ <WelcomeText />+ </Flexbox>+ <InputArea />+ </Flexbox>++ {isLogin && enableAgentTask && (+ <Flexbox gap={40}><DailyBrief /><RecommendTaskTemplates /></Flexbox>)}- {/* Use CSS visibility to hide instead of unmounting to prevent data re-fetching */}- <Flexbox gap={40} style={{ display: hideOtherModules ? 'none' : undefined }}>- {isDevMode && <CommunityAgents />}- </Flexbox>+ {!enableAgentTask && <CommunityAgents />}</Flexbox>);});diff --git a/src/store/agent/slices/builtin/action.ts b/src/store/agent/slices/builtin/action.tsindex 10035455c41..dbf68bd8a83 100644--- a/src/store/agent/slices/builtin/action.ts+++ b/src/store/agent/slices/builtin/action.ts@@ -39,6 +39,14 @@ export class BuiltinAgentSliceActionImpl {const data = await agentService.getBuiltinAgent(slug);if (data?.id) {this.#get().internal_dispatchAgentMap(data.id, data as PartialDeep<LobeAgentConfig>);+ // Mirror useInitBuiltinAgent's onSuccess: keep builtinAgentIdMap in sync+ // so callers can rely on this as a real "ensure" path instead of just a+ // post-init refresh.+ this.#set(+ { builtinAgentIdMap: { ...this.#get().builtinAgentIdMap, [slug]: data.id } },+ false,+ `refreshBuiltinAgent/${slug}`,+ );}};diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.tsindex 449a8d3c3b7..c8ab71da15a 100644--- a/src/store/global/initialState.ts+++ b/src/store/global/initialState.ts@@ -123,6 +123,11 @@ export interface SystemStatus {hidePWAInstaller?: boolean;hideThreadLimitAlert?: boolean;hideTopicSharePrivacyWarning?: boolean;+ /**+ * Agent picked from the home AgentSelect dropdown. When unset the home page+ * falls back to the inbox agent. Persisted so the choice survives reloads.+ */+ homeSelectedAgentId?: string;imagePanelWidth: number;imageTopicPanelWidth?: number;imageTopicViewMode?: 'grid' | 'list';diff --git a/src/store/global/selectors/systemStatus.test.ts b/src/store/global/selectors/systemStatus.test.tsindex bf6bee25020..cccedbef12c 100644--- a/src/store/global/selectors/systemStatus.test.ts+++ b/src/store/global/selectors/systemStatus.test.ts@@ -95,7 +95,16 @@ describe('systemStatusSelectors', () => {});it('should return stored items when set', () => {- const custom = ['agent', 'recents', 'pages', 'tasks', 'community', 'resource', 'memory'];+ const custom = [+ 'agent',+ 'recents',+ 'pages',+ 'tasks',+ 'image',+ 'community',+ 'resource',+ 'memory',+ ];const s: GlobalState = merge(initialState, {status: { sidebarItems: custom },});@@ -127,6 +136,7 @@ describe('systemStatusSelectors', () => {'pages','agent','recents',+ 'image','community','resource','memory',diff --git a/src/store/global/selectors/systemStatus.ts b/src/store/global/selectors/systemStatus.tsindex 421528011b2..edda07561a9 100644--- a/src/store/global/selectors/systemStatus.ts+++ b/src/store/global/selectors/systemStatus.ts@@ -48,6 +48,7 @@ export const DEFAULT_SIDEBAR_ITEMS: string[] = ['pages','recents','agent',+ 'image','community','resource','memory',@@ -228,6 +229,8 @@ const isBannerDismissed =const tokenDisplayFormatShort = (s: GlobalState) =>s.status.tokenDisplayFormatShort !== undefined ? s.status.tokenDisplayFormatShort : true;+const homeSelectedAgentId = (s: GlobalState) => s.status.homeSelectedAgentId;+export const systemStatusSelectors = {agentBuilderPanelWidth,agentPageSize,@@ -240,6 +243,7 @@ export const systemStatusSelectors = {groupAgentBuilderPanelWidth,hiddenSidebarSections,hidePWAInstaller,+ homeSelectedAgentId,imagePanelWidth,imageTopicViewMode,imageTopicPanelWidth,diff --git a/src/store/home/slices/homeInput/action.ts b/src/store/home/slices/homeInput/action.tsindex b7a202aa88b..24aa7a44722 100644--- a/src/store/home/slices/homeInput/action.ts+++ b/src/store/home/slices/homeInput/action.ts@@ -1,3 +1,5 @@+import { BUILTIN_AGENT_SLUGS } from '@lobechat/builtin-agents';+import { chatGroupService } from '@/services/chatGroup';import { documentService } from '@/services/document';import { getAgentStoreState } from '@/store/agent';@@ -18,6 +20,24 @@ interface SendMessageWithEditorParams {message: string;}+/**+ * Make sure a builtin agent (agent-builder / group-agent-builder / page-agent)+ * is hydrated into both `builtinAgentIdMap` and `agentMap` before we read its+ * id and call sendMessage. Without this, the create-Agent / create-Group /+ * create-Page flows can race against the host page's `useInitBuiltinAgent`:+ * `builtinAgentIdMap[slug]` is still undefined, so sendMessage gets+ * `agentId: undefined` and silently early-returns. Symptom: navigation lands+ * on the builder page but the conversation never starts.+ */+const ensureBuiltinAgentHydrated = async (slug: string): Promise<string | undefined> => {+ const state = getAgentStoreState();+ const cachedId = state.builtinAgentIdMap[slug];+ if (cachedId && state.agentMap[cachedId]) return cachedId;++ await state.refreshBuiltinAgent(slug);+ return getAgentStoreState().builtinAgentIdMap[slug];+};+type Setter = StoreSetter<HomeStore>;export const createHomeInputSlice = (set: Setter, get: () => HomeStore, _api?: unknown) =>new HomeInputActionImpl(set, get, _api);@@ -69,18 +89,23 @@ export class HomeInputActionImpl {// 5. Update agentBuilder's model config and send initial messageif (result.agentId) {const { sendMessage } = useChatStore.getState();- const agentBuilderId = builtinAgentSelectors.agentBuilderId(agentState);+ // Ensure agentBuilder is loaded before reading its id — the host+ // AgentBuilder component's useInitBuiltinAgent only fires after this+ // navigation completes, which would otherwise race with sendMessage.+ const agentBuilderId = await ensureBuiltinAgentHydrated(BUILTIN_AGENT_SLUGS.agentBuilder);// Update agentBuilder's model to match inbox selectionif (agentBuilderId && model && provider) {await agentState.updateAgentConfigById(agentBuilderId, { model, provider });}- await sendMessage({- context: { agentId: agentBuilderId!, scope: 'agent_builder' },- editorData,- message,- });+ if (agentBuilderId) {+ await sendMessage({+ context: { agentId: agentBuilderId, scope: 'agent_builder' },+ editorData,+ message,+ });+ }}// 6. Clear mode@@ -124,8 +149,11 @@ export class HomeInputActionImpl {// 5. Navigate to Group profile pagegetStableNavigate()?.(`/group/${group.id}/profile`);- // 6. Update groupAgentBuilder's model config and send initial message- const groupAgentBuilderId = builtinAgentSelectors.groupAgentBuilderId(agentState);+ // 6. Update groupAgentBuilder's model config and send initial message.+ // Hydrate first so we don't race with the group profile page's own init.+ const groupAgentBuilderId = await ensureBuiltinAgentHydrated(+ BUILTIN_AGENT_SLUGS.groupAgentBuilder,+ );if (groupAgentBuilderId) {// Update groupAgentBuilder's model to match inbox selection@@ -182,8 +210,9 @@ export class HomeInputActionImpl {// 3. Navigate to PagegetStableNavigate()?.(`/page/${newDoc.id}`);- // 4. Update pageAgent's model config and send initial message- const pageAgentId = builtinAgentSelectors.pageAgentId(agentState);+ // 4. Update pageAgent's model config and send initial message. Hydrate+ // first to avoid the same race the agent/group flows hit.+ const pageAgentId = await ensureBuiltinAgentHydrated(BUILTIN_AGENT_SLUGS.pageAgent);if (pageAgentId) {// Update pageAgent's model to match inbox selection