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: make the default assistant name and translated brand copy white-label aware (#21882)

LiJian4a4a3fe1c0a6
diff --git a/apps/auth/app/shell/createAuthI18n.ts b/apps/auth/app/shell/createAuthI18n.ts
index 6ead0e723c3..6f6c14e6354 100644
--- a/apps/auth/app/shell/createAuthI18n.ts
+++ b/apps/auth/app/shell/createAuthI18n.ts
@@ -3,6 +3,7 @@ import resourcesToBackend from 'i18next-resources-to-backend';
import { initReactI18next } from 'react-i18next';
import { DEFAULT_LANG } from '@/const/locale';
+import { brandPostProcessOptions, withBrandPostProcessor } from '@/locales/brandPostProcessor';
import { normalizeLocale } from '@/locales/resources';
import type { AuthResourceBundle } from './i18nScript';
@@ -19,8 +20,7 @@ interface CreateAuthI18nOptions {
// switcher reaches afterwards arrives through the on-demand backend.
export const createAuthI18n = ({ locale, resources }: CreateAuthI18nOptions) => {
const lng = normalizeLocale(locale);
- const instance = i18next
- .createInstance()
+ const instance = withBrandPostProcessor(i18next.createInstance())
.use(initReactI18next)
.use(resourcesToBackend(loadAuthNamespace));
@@ -48,6 +48,7 @@ export const createAuthI18n = ({ locale, resources }: CreateAuthI18nOptions) =>
},
resources: { [lng]: resources },
showSupportNotice: false,
+ ...brandPostProcessOptions,
}),
instance,
};
diff --git a/apps/share/src/features/topic/topicByline.ts b/apps/share/src/features/topic/topicByline.ts
index cb6c679d444..d9ca2e9919b 100644
--- a/apps/share/src/features/topic/topicByline.ts
+++ b/apps/share/src/features/topic/topicByline.ts
@@ -1,7 +1,9 @@
+import { DEFAULT_INBOX_TITLE } from '@lobechat/const';
+
import { type SharedTopicData } from '@/types/topic';
export const buildTopicByline = (data: SharedTopicData) => {
const isInboxAgent = !data.groupId && data.agentMeta?.slug === 'inbox';
- return data.groupMeta?.title || (isInboxAgent ? 'Lobe AI' : data.agentMeta?.title);
+ return data.groupMeta?.title || (isInboxAgent ? DEFAULT_INBOX_TITLE : data.agentMeta?.title);
};
diff --git a/apps/share/src/shell/createShareI18n.ts b/apps/share/src/shell/createShareI18n.ts
index 2a996633742..52744f8e584 100644
--- a/apps/share/src/shell/createShareI18n.ts
+++ b/apps/share/src/shell/createShareI18n.ts
@@ -3,6 +3,7 @@ import resourcesToBackend from 'i18next-resources-to-backend';
import { initReactI18next } from 'react-i18next';
import { DEFAULT_LANG } from '@/const/locale';
+import { brandPostProcessOptions, withBrandPostProcessor } from '@/locales/brandPostProcessor';
import { normalizeLocale } from '@/locales/resources';
import { unwrapESMModule } from '@/utils/esm/unwrapESMModule';
import { loadI18nNamespaceModule } from '@/utils/i18n/loadI18nNamespaceModule';
@@ -40,12 +41,13 @@ const translationOptions = {
interpolation: { escapeValue: false },
keySeparator: false,
showSupportNotice: false,
+ ...brandPostProcessOptions,
} as const;
// Loader-side copy: a bare instance, so react-i18next's global instance stays the one rendering.
export const createShareT = (lang: string | undefined, resources: ShareResources) => {
const locale = normalizeLocale(lang);
- const instance = i18next.createInstance();
+ const instance = withBrandPostProcessor(i18next.createInstance());
void instance.init({
...translationOptions,
@@ -64,8 +66,7 @@ export const createShareI18n = (lang?: string, bundledResources?: ShareResources
const locale = normalizeLocale(lang);
const resources = bundledResources ? { [locale]: bundledResources } : undefined;
- const instance = i18next
- .createInstance()
+ const instance = withBrandPostProcessor(i18next.createInstance())
.use(initReactI18next)
.use(resourcesToBackend(loadShareNamespace));
diff --git a/apps/workbench/src/shell/createWorkbenchI18n.ts b/apps/workbench/src/shell/createWorkbenchI18n.ts
index fd9a72e97aa..6db044b70af 100644
--- a/apps/workbench/src/shell/createWorkbenchI18n.ts
+++ b/apps/workbench/src/shell/createWorkbenchI18n.ts
@@ -3,6 +3,7 @@ import resourcesToBackend from 'i18next-resources-to-backend';
import { initReactI18next } from 'react-i18next';
import { DEFAULT_LANG } from '@/const/locale';
+import { brandPostProcessOptions, withBrandPostProcessor } from '@/locales/brandPostProcessor';
import { normalizeLocale } from '@/locales/resources';
import { unwrapESMModule } from '@/utils/esm/unwrapESMModule';
import { loadI18nNamespaceModule } from '@/utils/i18n/loadI18nNamespaceModule';
@@ -35,8 +36,7 @@ export const createWorkbenchI18n = (lang?: string, bundledResources?: Record<str
const locale = normalizeLocale(lang);
const resources = bundledResources ? { [locale]: bundledResources } : undefined;
- const instance = i18next
- .createInstance()
+ const instance = withBrandPostProcessor(i18next.createInstance())
.use(initReactI18next)
.use(resourcesToBackend(loadWorkbenchNamespace));
let languageRequest = 0;
@@ -69,6 +69,7 @@ export const createWorkbenchI18n = (lang?: string, bundledResources?: Record<str
},
resources,
showSupportNotice: false,
+ ...brandPostProcessOptions,
}),
instance,
};
diff --git a/packages/builtin-agents/src/agents/agent-builder/index.ts b/packages/builtin-agents/src/agents/agent-builder/index.ts
index 0db97ecd9ce..488360804c0 100644
--- a/packages/builtin-agents/src/agents/agent-builder/index.ts
+++ b/packages/builtin-agents/src/agents/agent-builder/index.ts
@@ -1,6 +1,6 @@
import { AgentBuilderIdentifier } from '@lobechat/builtin-tool-agent-builder';
import { DEFAULT_PROVIDER } from '@lobechat/business-const';
-import { DEFAULT_MODEL } from '@lobechat/const';
+import { DEFAULT_AGENT_BUILDER_AVATAR, DEFAULT_MODEL } from '@lobechat/const';
import type { BuiltinAgentDefinition } from '../../types';
import { BUILTIN_AGENT_SLUGS } from '../../types';
@@ -41,7 +41,7 @@ const AGENT_BUILDER_CONFLICTING_TOOLS = new Set<string>([
* Agent Builder - used for configuring AI agents through natural conversation
*/
export const AGENT_BUILDER: BuiltinAgentDefinition = {
- avatar: '/avatars/agent-builder.png',
+ avatar: DEFAULT_AGENT_BUILDER_AVATAR,
// Persist config - stored in database
persist: {
diff --git a/packages/builtin-agents/src/agents/builtinAvatars.test.ts b/packages/builtin-agents/src/agents/builtinAvatars.test.ts
new file mode 100644
index 00000000000..f454d16bf5f
--- /dev/null
+++ b/packages/builtin-agents/src/agents/builtinAvatars.test.ts
@@ -0,0 +1,78 @@
+import type * as BusinessConst from '@lobechat/business-const';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+// Each case re-imports the agent modules from cold after `vi.resetModules()`,
+// and that graph reaches the builtin-tool packages. The first one routinely
+// exceeds the 5s default while the rest run warm β€” a timeout here would say
+// nothing about the avatars.
+vi.setConfig({ testTimeout: 30_000 });
+
+/**
+ * Built-in agents must not keep the upstream mascot on a rebranded deployment.
+ *
+ * These avatars were literal `/avatars/*.png` paths, so they survived a rebrand
+ * that had already replaced the inbox agent sitting next to them in the same
+ * picker β€” the mismatch is only visible when the two are listed together, which
+ * is exactly where users saw it.
+ *
+ * Checked from the agent definitions rather than the constants, because the
+ * defect was never in the constants: it was three call sites not using them.
+ */
+const loadAvatars = async (brandingLogoUrl: string) => {
+ vi.resetModules();
+ vi.doMock('@lobechat/business-const', async (importOriginal) => ({
+ ...(await importOriginal<typeof BusinessConst>()),
+ BRANDING_LOGO_URL: brandingLogoUrl,
+ }));
+ // Import the mocked module from the test file first. Under vitest 5 a
+ // `doMock` only lands once the test file itself imports something, so modules
+ // reached transitively below would otherwise see the previous case's mock.
+ await import('@lobechat/business-const');
+
+ const [agentBuilder, groupAgentBuilder, pageAgent, inbox] = await Promise.all([
+ import('./agent-builder'),
+ import('./group-agent-builder'),
+ import('./page-agent'),
+ import('./inbox'),
+ ]);
+
+ return {
+ agentBuilder: agentBuilder.AGENT_BUILDER.avatar,
+ groupAgentBuilder: groupAgentBuilder.GROUP_AGENT_BUILDER.avatar,
+ inbox: inbox.INBOX.avatar,
+ pageAgent: pageAgent.PAGE_AGENT.avatar,
+ };
+};
+
+afterEach(() => {
+ vi.doUnmock('@lobechat/business-const');
+ vi.resetModules();
+});
+
+describe('built-in agent avatars', () => {
+ it('all follow the branded logo when one is configured', async () => {
+ const avatars = await loadAvatars('/branding/logo.png');
+
+ // Including the inbox: the point is that they agree, not that three of them
+ // changed.
+ for (const [agent, avatar] of Object.entries(avatars))
+ expect(avatar, agent).toBe('/branding/logo.png');
+ });
+
+ it('leaves no upstream mascot behind under custom branding', async () => {
+ const avatars = await loadAvatars('/branding/logo.png');
+
+ for (const [agent, avatar] of Object.entries(avatars))
+ expect(avatar, agent).not.toMatch(/\/avatars\//);
+ });
+
+ // Upstream ships no logo, and each agent's own artwork is worth keeping there.
+ it('keeps each agent distinct when no logo is configured', async () => {
+ const avatars = await loadAvatars('');
+
+ expect(avatars.agentBuilder).toBe('/avatars/agent-builder.png');
+ expect(avatars.groupAgentBuilder).toBe('/avatars/agent-builder.png');
+ expect(avatars.pageAgent).toBe('/avatars/doc-copilot.png');
+ expect(avatars.inbox).toBe('/avatars/lobe-ai.png');
+ });
+});
diff --git a/packages/builtin-agents/src/agents/group-agent-builder/index.ts b/packages/builtin-agents/src/agents/group-agent-builder/index.ts
index 208cbe77c0f..94651acc06c 100644
--- a/packages/builtin-agents/src/agents/group-agent-builder/index.ts
+++ b/packages/builtin-agents/src/agents/group-agent-builder/index.ts
@@ -1,6 +1,6 @@
import { GroupAgentBuilderIdentifier } from '@lobechat/builtin-tool-group-agent-builder';
import { DEFAULT_PROVIDER } from '@lobechat/business-const';
-import { DEFAULT_MODEL } from '@lobechat/const';
+import { DEFAULT_AGENT_BUILDER_AVATAR, DEFAULT_MODEL } from '@lobechat/const';
import type { BuiltinAgentDefinition } from '../../types';
import { BUILTIN_AGENT_SLUGS } from '../../types';
@@ -10,7 +10,7 @@ import { systemRoleTemplate } from './systemRole';
* Group Agent Builder - used for configuring group chat settings and managing group members
*/
export const GROUP_AGENT_BUILDER: BuiltinAgentDefinition = {
- avatar: '/avatars/agent-builder.png',
+ avatar: DEFAULT_AGENT_BUILDER_AVATAR,
// Persist config - stored in database
persist: {
diff --git a/packages/builtin-agents/src/agents/inbox/index.ts b/packages/builtin-agents/src/agents/inbox/index.ts
index 49383f1748d..871a3ecbafc 100644
--- a/packages/builtin-agents/src/agents/inbox/index.ts
+++ b/packages/builtin-agents/src/agents/inbox/index.ts
@@ -1,5 +1,6 @@
import { AgentDocumentsIdentifier } from '@lobechat/builtin-tool-agent-documents';
import { UserInteractionIdentifier } from '@lobechat/builtin-tool-user-interaction';
+import { DEFAULT_INBOX_AVATAR } from '@lobechat/const';
import type { BuiltinAgentDefinition } from '../../types';
import { BUILTIN_AGENT_SLUGS } from '../../types';
@@ -11,7 +12,7 @@ import { createSystemRole } from './systemRole';
* Note: model and provider are intentionally undefined to use user's default settings
*/
export const INBOX: BuiltinAgentDefinition = {
- avatar: '/avatars/lobe-ai.png',
+ avatar: DEFAULT_INBOX_AVATAR,
runtime: (ctx) => ({
plugins: [AgentDocumentsIdentifier, UserInteractionIdentifier, ...(ctx.plugins || [])],
// A user-customized prompt wins; the runtime one is only the default.
diff --git a/packages/builtin-agents/src/agents/page-agent/index.ts b/packages/builtin-agents/src/agents/page-agent/index.ts
index ab8b762a661..467cdee4ad2 100644
--- a/packages/builtin-agents/src/agents/page-agent/index.ts
+++ b/packages/builtin-agents/src/agents/page-agent/index.ts
@@ -1,5 +1,5 @@
import { DEFAULT_PROVIDER } from '@lobechat/business-const';
-import { DEFAULT_MODEL } from '@lobechat/const';
+import { DEFAULT_MODEL, DEFAULT_PAGE_AGENT_AVATAR } from '@lobechat/const';
import type { BuiltinAgentDefinition } from '../../types';
import { BUILTIN_AGENT_SLUGS } from '../../types';
@@ -9,7 +9,7 @@ import { systemRoleTemplate } from './systemRole';
* Page Agent - used for document editing assistance
*/
export const PAGE_AGENT: BuiltinAgentDefinition = {
- avatar: '/avatars/doc-copilot.png',
+ avatar: DEFAULT_PAGE_AGENT_AVATAR,
// Persist config - stored in database
persist: {
model: DEFAULT_MODEL,
diff --git a/packages/builtin-agents/src/agents/task-agent/index.ts b/packages/builtin-agents/src/agents/task-agent/index.ts
index 113aae8d8e3..2303edc81bd 100644
--- a/packages/builtin-agents/src/agents/task-agent/index.ts
+++ b/packages/builtin-agents/src/agents/task-agent/index.ts
@@ -1,13 +1,13 @@
import { TaskIdentifier } from '@lobechat/builtin-tool-task';
import { DEFAULT_PROVIDER } from '@lobechat/business-const';
-import { DEFAULT_MODEL } from '@lobechat/const';
+import { DEFAULT_INBOX_AVATAR, DEFAULT_MODEL } from '@lobechat/const';
import type { BuiltinAgentDefinition } from '../../types';
import { BUILTIN_AGENT_SLUGS } from '../../types';
import { systemRoleTemplate } from './systemRole';
export const TASK_AGENT: BuiltinAgentDefinition = {
- avatar: '/avatars/lobe-ai.png',
+ avatar: DEFAULT_INBOX_AVATAR,
persist: {
model: DEFAULT_MODEL,
provider: DEFAULT_PROVIDER,
diff --git a/packages/builtin-agents/src/agents/verify-agent/index.ts b/packages/builtin-agents/src/agents/verify-agent/index.ts
index bcdb240d2a3..4cc5b38346f 100644
--- a/packages/builtin-agents/src/agents/verify-agent/index.ts
+++ b/packages/builtin-agents/src/agents/verify-agent/index.ts
@@ -1,13 +1,13 @@
import { VerifyToolIdentifier } from '@lobechat/builtin-tool-verify';
import { DEFAULT_PROVIDER } from '@lobechat/business-const';
-import { DEFAULT_MODEL } from '@lobechat/const';
+import { DEFAULT_INBOX_AVATAR, DEFAULT_MODEL } from '@lobechat/const';
import type { BuiltinAgentDefinition } from '../../types';
import { BUILTIN_AGENT_SLUGS } from '../../types';
import { systemRoleTemplate } from './systemRole';
export const VERIFY_AGENT: BuiltinAgentDefinition = {
- avatar: '/avatars/lobe-ai.png',
+ avatar: DEFAULT_INBOX_AVATAR,
persist: {
// Custom tool mode: the verifier's toolset is EXACTLY its declared plugins
// (its writeback tool + any investigation tools the run injects), with no
diff --git a/packages/builtin-agents/src/agents/web-onboarding/index.ts b/packages/builtin-agents/src/agents/web-onboarding/index.ts
index 83ae42d8f22..1ca16ab2df5 100644
--- a/packages/builtin-agents/src/agents/web-onboarding/index.ts
+++ b/packages/builtin-agents/src/agents/web-onboarding/index.ts
@@ -1,5 +1,6 @@
import { UserInteractionIdentifier } from '@lobechat/builtin-tool-user-interaction';
import { DEFAULT_ONBOARDING_MODEL, DEFAULT_ONBOARDING_PROVIDER } from '@lobechat/business-const';
+import { DEFAULT_INBOX_AVATAR } from '@lobechat/const';
import type { BuiltinAgentDefinition } from '../../types';
import { BUILTIN_AGENT_SLUGS } from '../../types';
@@ -9,7 +10,7 @@ import { createSystemRole } from './systemRole';
const WebOnboardingIdentifier = 'lobe-web-onboarding';
export const WEB_ONBOARDING: BuiltinAgentDefinition = {
- avatar: '/avatars/lobe-ai.png',
+ avatar: DEFAULT_INBOX_AVATAR,
persist: {
model: DEFAULT_ONBOARDING_MODEL,
provider: DEFAULT_ONBOARDING_PROVIDER,
diff --git a/packages/business/const/src/branding.ts b/packages/business/const/src/branding.ts
index 3ebab947643..a78e5f36043 100644
--- a/packages/business/const/src/branding.ts
+++ b/packages/business/const/src/branding.ts
@@ -7,6 +7,17 @@ export const LOBE_CHAT_CLOUD = 'LobeHub Cloud';
export const BRANDING_NAME = 'LobeHub';
export const BRANDING_LOGO_URL = '';
+/**
+ * Display name of the built-in default assistant (the inbox agent).
+ *
+ * Kept separate from `BRANDING_NAME` because it reads as a persona, not a
+ * product: white-label deployments usually want something like
+ * `'<Brand> AI'` rather than the bare product name. Drives
+ * `DEFAULT_INBOX_TITLE` and the i18n brand post-processor, so overriding this
+ * one constant renames the assistant everywhere.
+ */
+export const BRANDING_INBOX_TITLE = 'Lobe AI';
+
export const ORG_NAME = 'LobeHub';
export const BRANDING_URL = {
diff --git a/packages/const/src/meta.ts b/packages/const/src/meta.ts
index d546c6a6111..468b76a44f6 100644
--- a/packages/const/src/meta.ts
+++ b/packages/const/src/meta.ts
@@ -1,4 +1,4 @@
-import { BRANDING_LOGO_URL } from '@lobechat/business-const';
+import { BRANDING_INBOX_TITLE, BRANDING_LOGO_URL } from '@lobechat/business-const';
import type { MetaData } from '@lobechat/types';
export const DEFAULT_AVATAR = '/avatars/agent-default.png';
@@ -7,6 +7,21 @@ export const DEFAULT_SUPERVISOR_AVATAR = 'πŸŽ™οΈ';
export const DEFAULT_SUPERVISOR_ID = 'supervisor';
export const DEFAULT_BACKGROUND_COLOR = undefined;
export const DEFAULT_AGENT_META: MetaData = {};
-export const DEFAULT_INBOX_TITLE = 'Lobe AI';
+export const DEFAULT_INBOX_TITLE = BRANDING_INBOX_TITLE;
export const DEFAULT_INBOX_AVATAR = BRANDING_LOGO_URL || '/avatars/lobe-ai.png';
export const DEFAULT_USER_AVATAR_URL = BRANDING_LOGO_URL || '/app-icons/icon-192x192.png';
+
+/**
+ * Avatars for the remaining built-in agents.
+ *
+ * `/avatars/*.png` are drawings of the LobeHub mascot, and the agents that use
+ * them referenced those paths as literals β€” so they kept the upstream character
+ * on a distribution that had rebranded everything else, including the agents
+ * sitting next to them in the same picker. Routing them through the same slot as
+ * DEFAULT_INBOX_AVATAR is what makes the branding complete rather than partial.
+ *
+ * Upstream is unaffected: BRANDING_LOGO_URL is empty there, so the fallback
+ * keeps each agent's own artwork.
+ */
+export const DEFAULT_AGENT_BUILDER_AVATAR = BRANDING_LOGO_URL || '/avatars/agent-builder.png';
+export const DEFAULT_PAGE_AGENT_AVATAR = BRANDING_LOGO_URL || '/avatars/doc-copilot.png';
diff --git a/packages/const/src/version.ts b/packages/const/src/version.ts
index d468fe52068..d15f9b34725 100644
--- a/packages/const/src/version.ts
+++ b/packages/const/src/version.ts
@@ -1,4 +1,4 @@
-import { BRANDING_NAME, ORG_NAME } from '@lobechat/business-const';
+import { BRANDING_NAME, LOBE_CHAT_CLOUD, ORG_NAME } from '@lobechat/business-const';
import pkg from '../../../package.json';
// type-only: loads ./global.d.ts so `__ELECTRON__` exists even when this
@@ -13,3 +13,9 @@ export const isDesktop = typeof __ELECTRON__ !== 'undefined' && !!__ELECTRON__;
export const isCustomBranding = BRANDING_NAME !== 'LobeHub';
// @ts-ignore
export const isCustomORG = ORG_NAME !== 'LobeHub';
+
+// Re-exported so packages that deliberately do not depend on the business-const
+// slot β€” @lobechat/locales, which only needs the names to rewrite brand strings
+// baked into translations β€” can resolve them through the same adaptation layer
+// this package already provides for BRANDING_INBOX_TITLE (see ./meta).
+export { BRANDING_NAME, LOBE_CHAT_CLOUD };
diff --git a/packages/locales/src/brandPostProcessor.test.ts b/packages/locales/src/brandPostProcessor.test.ts
new file mode 100644
index 00000000000..b3b82dfbac5
--- /dev/null
+++ b/packages/locales/src/brandPostProcessor.test.ts
@@ -0,0 +1,137 @@
+import type * as Const from '@lobechat/const';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+interface Branding {
+ BRANDING_NAME: string;
+ DEFAULT_INBOX_TITLE: string;
+ LOBE_CHAT_CLOUD: string;
+}
+
+const UPSTREAM: Branding = {
+ BRANDING_NAME: 'LobeHub',
+ DEFAULT_INBOX_TITLE: 'Lobe AI',
+ LOBE_CHAT_CLOUD: 'LobeHub Cloud',
+};
+
+const ACME: Branding = {
+ BRANDING_NAME: 'Acme',
+ DEFAULT_INBOX_TITLE: 'Acme AI',
+ LOBE_CHAT_CLOUD: 'Acme Cloud',
+};
+
+// The replacement table is built at module scope from the branding constants,
+// so each config needs a fresh copy of the module.
+const loadWith = async (branding: Branding) => {
+ vi.resetModules();
+ vi.doMock('@lobechat/const', async (importOriginal) => ({
+ ...(await importOriginal<typeof Const>()),
+ ...branding,
+ }));
+ // Under vitest 5 a `doMock` only lands once the test file itself imports
+ // something, so pull the mocked module in before the one under test.
+ await import('@lobechat/const');
+
+ return import('./brandPostProcessor');
+};
+
+afterEach(() => {
+ vi.doUnmock('@lobechat/const');
+});
+
+describe('brandPostProcessor', () => {
+ describe('under default branding', () => {
+ it('is not enabled, so i18next never registers it', async () => {
+ const { brandPostProcessOptions, isBrandPostProcessorEnabled } = await loadWith(UPSTREAM);
+
+ expect(isBrandPostProcessorEnabled).toBe(false);
+ expect(brandPostProcessOptions).toEqual({});
+ });
+
+ it('leaves every upstream literal as translated, including the pre-rename name', async () => {
+ const { applyBrandStrings } = await loadWith(UPSTREAM);
+ const copy = 'Ask Lobe AI Β· Sign in to LobeHub Β· LobeHub Cloud Β· LobeChat';
+
+ expect(applyBrandStrings(copy)).toBe(copy);
+ });
+ });
+
+ describe('under custom branding', () => {
+ it('is enabled and asks i18next to run it', async () => {
+ const { BRAND_POST_PROCESSOR, brandPostProcessOptions, isBrandPostProcessorEnabled } =
+ await loadWith(ACME);
+
+ expect(isBrandPostProcessorEnabled).toBe(true);
+ expect(brandPostProcessOptions).toEqual({ postProcess: [BRAND_POST_PROCESSOR] });
+ });
+
+ it('rewrites the assistant name', async () => {
+ const { applyBrandStrings } = await loadWith(ACME);
+
+ expect(applyBrandStrings('Ask Lobe AI')).toBe('Ask Acme AI');
+ });
+
+ it('rewrites the product name', async () => {
+ const { applyBrandStrings } = await loadWith(ACME);
+
+ expect(applyBrandStrings('Sign in to LobeHub')).toBe('Sign in to Acme');
+ });
+
+ it('rewrites the pre-rename product name, still present in stale translations', async () => {
+ const { applyBrandStrings } = await loadWith(ACME);
+
+ expect(applyBrandStrings('LobeChat supports custom API keys')).toBe(
+ 'Acme supports custom API keys',
+ );
+ });
+
+ it('prefers the hosted-service name over the bare product name', async () => {
+ // Longest-first ordering: matching 'LobeHub' first would leave a dangling
+ // ' Cloud' and make LOBE_CHAT_CLOUD unreachable from translated copy.
+ const { applyBrandStrings } = await loadWith(ACME);
+
+ expect(applyBrandStrings('or just use LobeHub Cloud')).toBe('or just use Acme Cloud');
+ });
+
+ it('falls back to "<brand> Cloud" when only the product was renamed', async () => {
+ // The Cloud pair is then at its upstream default and gets dropped, so the
+ // shorter rule takes over. Degraded, but still not a leak.
+ const { applyBrandStrings } = await loadWith({ ...UPSTREAM, BRANDING_NAME: 'Acme' });
+
+ expect(applyBrandStrings('or just use LobeHub Cloud')).toBe('or just use Acme Cloud');
+ });
+
+ it('rewrites only what was renamed', async () => {
+ const { applyBrandStrings } = await loadWith({ ...UPSTREAM, DEFAULT_INBOX_TITLE: 'Acme AI' });
+
+ expect(applyBrandStrings('Ask Lobe AI in LobeHub')).toBe('Ask Acme AI in LobeHub');
+ });
+
+ it('rewrites every occurrence in one string', async () => {
+ const { applyBrandStrings } = await loadWith(ACME);
+
+ expect(applyBrandStrings('Lobe AI and Lobe AI')).toBe('Acme AI and Acme AI');
+ });
+
+ it('leaves social handles alone', async () => {
+ // '@LobeHub' is a Slack account that only exists under the upstream brand;
+ // rewriting it would hand the user an address that does not resolve.
+ const { applyBrandStrings } = await loadWith(ACME);
+
+ expect(applyBrandStrings('DM @LobeHub on Slack to link your account')).toBe(
+ 'DM @LobeHub on Slack to link your account',
+ );
+ });
+
+ it('leaves unrelated copy untouched', async () => {
+ const { applyBrandStrings } = await loadWith(ACME);
+
+ expect(applyBrandStrings('Start a new topic')).toBe('Start a new topic');
+ });
+
+ it('rewrites through the i18next post-processor entry point', async () => {
+ const { brandPostProcessor } = await loadWith(ACME);
+
+ expect(brandPostProcessor.process('Ask Lobe AI', '', {}, {} as any)).toBe('Ask Acme AI');
+ });
+ });
+});
diff --git a/packages/locales/src/brandPostProcessor.ts b/packages/locales/src/brandPostProcessor.ts
new file mode 100644
index 00000000000..1881e6c52dc
--- /dev/null
+++ b/packages/locales/src/brandPostProcessor.ts
@@ -0,0 +1,104 @@
+// Imported via @lobechat/const (already a dependency) rather than
+// @lobechat/business-const, which this package does not depend on.
+import { BRANDING_NAME, DEFAULT_INBOX_TITLE, LOBE_CHAT_CLOUD } from '@lobechat/const';
+import type { i18n as I18n, InitOptions, PostProcessorModule } from 'i18next';
+
+/**
+ * Upstream brand literals baked into the locale files, each paired with the
+ * constant a white-label deployment overrides.
+ *
+ * Several hundred copy strings name the product or the default assistant inline
+ * (`'Ask Lobe AI'`, `'Sign in to LobeHub'`, …) instead of interpolating a brand
+ * variable, across ~18 locales. Rewriting the JSON per deployment would touch a
+ * thousand tracked files and conflict on every upgrade, so white-label
+ * deployments patch the strings as they are translated instead.
+ *
+ * ORDER MATTERS β€” entries are matched longest-first, so `LobeHub Cloud` has to
+ * come before `LobeHub`, or a deployment that renamed the hosted service could
+ * never see its own LOBE_CHAT_CLOUD in translated copy. A deployment that
+ * renames only BRANDING_NAME drops the (now identity) Cloud pair and falls
+ * through to the shorter rule, yielding `<brand> Cloud` β€” degraded, but still
+ * not a leak.
+ *
+ * `LobeChat` is the pre-rename product name. It still appears in locales that
+ * have not been retranslated since the rename (ja-JP, ko-KR, zh-TW, …), so a
+ * deployment that rewrote only `LobeHub` would keep leaking it.
+ *
+ * The third column is the upstream default of the constant. A literal is only
+ * rewritten once the deployment moved that constant off its default, which
+ * keeps default branding a strict no-op β€” including `LobeChat`, which upstream
+ * leaves as translated.
+ */
+const BRAND_LITERALS: [from: string, to: string, upstream: string][] = [
+ ['LobeHub Cloud', LOBE_CHAT_CLOUD, 'LobeHub Cloud'],
+ ['LobeHub', BRANDING_NAME, 'LobeHub'],
+ ['LobeChat', BRANDING_NAME, 'LobeHub'],
+ ['Lobe AI', DEFAULT_INBOX_TITLE, 'Lobe AI'],
+];
+
+/** Only the literals this deployment actually renamed. */
+const replacements = BRAND_LITERALS.filter(([, to, upstream]) => to !== upstream).map(
+ ([from, to]) => [from, to] as const,
+);
+
+const lookup = new Map(replacements);
+
+/**
+ * Every literal above starts with this, which is what makes the pre-filter in
+ * applyBrandStrings sound. Kept beside BRAND_LITERALS so the two cannot drift.
+ */
+const COMMON_PREFIX = 'Lobe';
+
+/**
+ * One alternation covering every active literal, rather than a replaceAll pass
+ * per entry: this runs on every single t() call, so the work has to stay
+ * proportional to the string rather than to the size of the table.
+ *
+ * The `from` values are the literals defined above β€” letters and spaces only β€”
+ * so they need no regex escaping.
+ *
+ * `(?<!@)` leaves social handles such as `@LobeHub` alone (see the Slack copy in
+ * messenger.json). A handle names an account that exists under the upstream
+ * brand and has no counterpart in a white-label deployment, so rewriting it
+ * would hand the user an address that does not resolve. Keeping the handle is
+ * the honest failure mode; making it configurable is a separate upstream change.
+ */
+const pattern = replacements.length
+ ? new RegExp(`(?<!@)(${replacements.map(([from]) => from).join('|')})`, 'g')
+ : undefined;
+
+export const isBrandPostProcessorEnabled = replacements.length > 0;
+
+export const BRAND_POST_PROCESSOR = 'brandStrings';
+
+/** Apply the brand rewrites to one translated string. */
+export const applyBrandStrings = (value: string): string => {
+ // Fast path: the overwhelming majority of translated strings never mention the
+ // brand, and one substring scan is much cheaper than running the regex.
+ if (!pattern || !value.includes(COMMON_PREFIX)) return value;
+
+ return value.replaceAll(pattern, (match) => lookup.get(match) ?? match);
+};
+
+/**
+ * Rewrite hardcoded brand strings in translated copy so white-label
+ * deployments never surface the upstream product's names. A no-op (and never
+ * registered) under default branding.
+ */
+export const brandPostProcessor: PostProcessorModule = {
+ name: BRAND_POST_PROCESSOR,
+ process: (value) => (typeof value === 'string' ? applyBrandStrings(value) : value),
+ type: 'postProcessor',
+};
+
+/** Init options that turn the processor on; empty under default branding. */
+export const brandPostProcessOptions: Pick<InitOptions, 'postProcess'> = isBrandPostProcessorEnabled
+ ? { postProcess: [BRAND_POST_PROCESSOR] }
+ : {};
+
+/**
+ * Register the processor on an i18next instance (no-op under default branding).
+ * Pair with `brandPostProcessOptions` in `init()`, otherwise i18next never runs it.
+ */
+export const withBrandPostProcessor = <T extends I18n>(instance: T): T =>
+ isBrandPostProcessorEnabled ? (instance.use(brandPostProcessor) as T) : instance;
diff --git a/packages/locales/src/create.ts b/packages/locales/src/create.ts
index 3a57c317cef..59fdd4b1e77 100644
--- a/packages/locales/src/create.ts
+++ b/packages/locales/src/create.ts
@@ -16,6 +16,12 @@ import { isOnServerSide } from '@/utils/env';
import { unwrapESMModule } from '@/utils/esm/unwrapESMModule';
import { loadI18nNamespaceModule } from '@/utils/i18n/loadI18nNamespaceModule';
+import {
+ BRAND_POST_PROCESSOR,
+ brandPostProcessor,
+ isBrandPostProcessorEnabled,
+} from './brandPostProcessor';
+
const createBundledResources = () => ({
chat: defaultChat,
common: defaultCommon,
@@ -51,7 +57,10 @@ const { I18N_DEBUG, I18N_DEBUG_BROWSER, I18N_DEBUG_SERVER } = getDebugConfig();
const debugMode = (I18N_DEBUG ?? isOnServerSide) ? I18N_DEBUG_SERVER : I18N_DEBUG_BROWSER;
export const createI18nNext = (lang?: string) => {
- const instance = i18n
+ let instance = i18n;
+ if (isBrandPostProcessorEnabled) instance = instance.use(brandPostProcessor);
+
+ instance = instance
.use(initReactI18next)
.use(LanguageDetector)
.use(
@@ -118,6 +127,8 @@ export const createI18nNext = (lang?: string) => {
keySeparator: false,
lng: initialLang,
+ // Rewrite brand strings baked into the locale copy (white-label only).
+ ...(isBrandPostProcessorEnabled ? { postProcess: [BRAND_POST_PROCESSOR] } : {}),
// Silence the Locize promotional console.info printed on init (i18next >= 25)
showSupportNotice: false,
});
diff --git a/src/features/AgentHome/AgentInfo.tsx b/src/features/AgentHome/AgentInfo.tsx
index 0bb794141c3..63e90cfe591 100644
--- a/src/features/AgentHome/AgentInfo.tsx
+++ b/src/features/AgentHome/AgentInfo.tsx
@@ -7,7 +7,7 @@ import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import AgentAvatar from '@/components/AgentAvatar';
-import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
+import { DEFAULT_INBOX_AVATAR, DEFAULT_INBOX_TITLE } from '@/const/meta';
import { contextSelectors, useConversationStore } from '@/features/Conversation/store';
import { useAgentStore } from '@/store/agent';
import { agentByIdSelectors, agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
@@ -31,7 +31,7 @@ const AgentInfo = memo(() => {
const fontSize = useUserStore(userGeneralSettingsSelectors.fontSize);
const displayTitle = isInbox
- ? agentDisplayName(meta, 'Lobe AI')
+ ? agentDisplayName(meta, DEFAULT_INBOX_TITLE)
: agentDisplayName(meta, t('defaultSession', { ns: 'common' }));
const message = useMemo(() => {
diff --git a/src/features/AgentSidebar/Header/Agent/index.tsx b/src/features/AgentSidebar/Header/Agent/index.tsx
index 28de185c349..0f63b918d75 100644
--- a/src/features/AgentSidebar/Header/Agent/index.tsx
+++ b/src/features/AgentSidebar/Header/Agent/index.tsx
@@ -1,5 +1,6 @@
'use client';
+import { DEFAULT_INBOX_TITLE } from '@lobechat/const';
import type { PropsWithChildren } from 'react';
import React, { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -26,7 +27,7 @@ const Agent = memo<PropsWithChildren>(() => {
]);
const displayTitle = isInbox
- ? title || 'Lobe AI'
+ ? title || DEFAULT_INBOX_TITLE
: title || t('defaultSession', { ns: 'common' });
if (isLoading) return <SkeletonItem height={32} padding={0} />;
diff --git a/src/features/AuthShell/createAuthI18n.ts b/src/features/AuthShell/createAuthI18n.ts
index eda16b06352..a4c45658a43 100644
--- a/src/features/AuthShell/createAuthI18n.ts
+++ b/src/features/AuthShell/createAuthI18n.ts
@@ -3,6 +3,11 @@ import resourcesToBackend from 'i18next-resources-to-backend';
import { initReactI18next } from 'react-i18next';
import { DEFAULT_LANG } from '@/const/locale';
+import {
+ BRAND_POST_PROCESSOR,
+ brandPostProcessor,
+ isBrandPostProcessorEnabled,
+} from '@/locales/brandPostProcessor';
import defaultAuth from '@/locales/default/auth';
import defaultAuthError from '@/locales/default/authError';
import defaultCommon from '@/locales/default/common';
@@ -64,10 +69,10 @@ const loadAuthNamespace = async (lng: string, ns: string) => {
};
export const createAuthI18n = (lang?: string) => {
- const instance = i18next
- .createInstance()
- .use(initReactI18next)
- .use(resourcesToBackend(loadAuthNamespace));
+ let instance = i18next.createInstance();
+ if (isBrandPostProcessorEnabled) instance = instance.use(brandPostProcessor);
+
+ instance = instance.use(initReactI18next).use(resourcesToBackend(loadAuthNamespace));
// With ns: [] and the en-US fallback bundled, i18next considers every namespace
// "loaded" and never asks the backend after a language switch β€” fetch explicitly.
@@ -94,6 +99,8 @@ export const createAuthI18n = (lang?: string) => {
// retry of the initial mount re-creates this instance and the auth SPA
// remounts forever with a blank #root.
partialBundledLanguages: true,
+ // Rewrite brand strings baked into the locale copy (white-label only).
+ ...(isBrandPostProcessorEnabled ? { postProcess: [BRAND_POST_PROCESSOR] } : {}),
react: {
bindI18nStore: 'added',
useSuspense: false,
diff --git a/src/features/CommandMenu/AskAIMenu.tsx b/src/features/CommandMenu/AskAIMenu.tsx
index 412352e095a..248c85718b1 100644
--- a/src/features/CommandMenu/AskAIMenu.tsx
+++ b/src/features/CommandMenu/AskAIMenu.tsx
@@ -1,4 +1,4 @@
-import { DEFAULT_INBOX_AVATAR } from '@lobechat/const';
+import { DEFAULT_INBOX_AVATAR, DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { agentDisplayName } from '@lobechat/types';
import { GroupBotSquareIcon } from '@lobehub/ui/icons';
import { Command } from 'cmdk';
@@ -64,7 +64,7 @@ const AskAIMenu = memo(() => {
<Command.Item value="lobe-ai" onSelect={handleAskLobeAI}>
<Avatar emojiScaleWithBackground avatar={DEFAULT_INBOX_AVATAR} shape="square" size={18} />
<div className={styles.itemContent}>
- <div className={styles.itemLabel}>Lobe AI</div>
+ <div className={styles.itemLabel}>{DEFAULT_INBOX_TITLE}</div>
</div>
</Command.Item>
<Command.Item value="agent-builder" onSelect={handleAgentBuilder}>
diff --git a/src/features/CommandMenu/AskAgentCommands.tsx b/src/features/CommandMenu/AskAgentCommands.tsx
index a85af1f8b33..b080d284a8e 100644
--- a/src/features/CommandMenu/AskAgentCommands.tsx
+++ b/src/features/CommandMenu/AskAgentCommands.tsx
@@ -1,4 +1,4 @@
-import { DEFAULT_INBOX_AVATAR } from '@lobechat/const';
+import { DEFAULT_INBOX_AVATAR, DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { agentDisplayName } from '@lobechat/types';
import { preventDefault } from '@lobehub/ui';
import { Command } from 'cmdk';
@@ -57,21 +57,24 @@ const AskAgentCommands = memo(() => {
// Only show when user types "@"
if (!isAtMention) return null;
- // Check if Lobe AI matches the query
- const showLobeAI = !mentionQuery || 'lobe ai'.includes(mentionQuery);
+ // Check if the default assistant matches the query
+ const showLobeAI =
+ !mentionQuery || DEFAULT_INBOX_TITLE.toLowerCase().includes(mentionQuery.toLowerCase());
return (
<Command.Group heading={t('cmdk.mentionAgent')}>
- {/* @Lobe AI option */}
+ {/* @<default assistant> option */}
{showLobeAI && (
<Command.Item
value="@lobe-ai"
onMouseDown={preventDefault}
- onSelect={() => handleAgentSelect(inboxAgentId, 'Lobe AI', DEFAULT_INBOX_AVATAR)}
+ onSelect={() =>
+ handleAgentSelect(inboxAgentId, DEFAULT_INBOX_TITLE, DEFAULT_INBOX_AVATAR)
+ }
>
<Avatar emojiScaleWithBackground avatar={DEFAULT_INBOX_AVATAR} shape="square" size={18} />
<div className={styles.itemContent}>
- <div className={styles.itemLabel}>@Lobe AI</div>
+ <div className={styles.itemLabel}>@{DEFAULT_INBOX_TITLE}</div>
</div>
</Command.Item>
)}
diff --git a/src/features/Conversation/hooks/useAgentMeta.test.ts b/src/features/Conversation/hooks/useAgentMeta.test.ts
index cf836bea6a9..e5562f77939 100644
--- a/src/features/Conversation/hooks/useAgentMeta.test.ts
+++ b/src/features/Conversation/hooks/useAgentMeta.test.ts
@@ -1,3 +1,4 @@
+import { DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { act, renderHook } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
@@ -85,7 +86,7 @@ describe('useAgentMeta', () => {
expect(result.current.description).toBe('Inbox description');
});
- it('should fallback to Lobe AI title for builtin agent without custom title', () => {
+ it('should fallback to the default inbox title for builtin agent without custom title', () => {
const mockInboxAgentId = 'inbox-agent-id';
const mockMeta = {
avatar: '/icons/icon-lobe.png',
@@ -111,7 +112,7 @@ describe('useAgentMeta', () => {
const { result } = renderHook(() => useAgentMeta());
expect(result.current.avatar).toBe('/icons/icon-lobe.png');
- expect(result.current.title).toBe('Lobe AI');
+ expect(result.current.title).toBe(DEFAULT_INBOX_TITLE);
});
it('should preserve custom title for page agent (builtin)', () => {
diff --git a/src/features/Conversation/hooks/useAgentMeta.ts b/src/features/Conversation/hooks/useAgentMeta.ts
index 3204f747b99..67ffb6eca14 100644
--- a/src/features/Conversation/hooks/useAgentMeta.ts
+++ b/src/features/Conversation/hooks/useAgentMeta.ts
@@ -1,3 +1,4 @@
+import { DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { type MetaData } from '@lobechat/types';
import { useMemo } from 'react';
@@ -6,7 +7,7 @@ import { agentSelectors } from '@/store/agent/selectors';
import { contextSelectors, useConversationStore } from '../store';
-const LOBE_AI_TITLE = 'Lobe AI';
+const LOBE_AI_TITLE = DEFAULT_INBOX_TITLE;
/**
* Hook to get agent meta data for a specific agent or the current conversation.
diff --git a/src/features/DesktopOnboarding/steps/WelcomeStep.tsx b/src/features/DesktopOnboarding/steps/WelcomeStep.tsx
index 1de9b5fffa2..f79fc393d79 100644
--- a/src/features/DesktopOnboarding/steps/WelcomeStep.tsx
+++ b/src/features/DesktopOnboarding/steps/WelcomeStep.tsx
@@ -1,5 +1,6 @@
'use client';
+import { DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { type IconProps } from '@lobehub/ui';
import { Block, Button, cssVar, Flexbox, Icon, Steps, Text } from '@lobehub/ui';
import { TypewriterEffect } from '@lobehub/ui/awesome';
@@ -58,7 +59,7 @@ const WelcomeStep = memo<WelcomeStepProps>(({ onNext }) => {
pauseDuration={16_000}
typingSpeed={64}
sentences={[
- t('telemetry.title', { name: 'Lobe AI' }),
+ t('telemetry.title', { name: DEFAULT_INBOX_TITLE }),
t('telemetry.title2'),
t('telemetry.title3'),
]}
diff --git a/src/features/DevPanel/RenderGallery/fixtures/index.ts b/src/features/DevPanel/RenderGallery/fixtures/index.ts
index bdd0661e60d..190a4fe5911 100644
--- a/src/features/DevPanel/RenderGallery/fixtures/index.ts
+++ b/src/features/DevPanel/RenderGallery/fixtures/index.ts
@@ -1,7 +1,7 @@
'use client';
import { builtinTools } from '@lobechat/builtin-tools';
-import { DEFAULT_INBOX_AVATAR } from '@lobechat/const';
+import { DEFAULT_INBOX_AVATAR, DEFAULT_INBOX_TITLE } from '@lobechat/const';
import type { BuiltinToolManifest, LobeChatPluginApi } from '@lobechat/types';
import type { ToolRenderFixture } from '../lifecycleMode';
@@ -58,7 +58,7 @@ export const DEVTOOLS_AGENT_ID = 'devtools-render-gallery';
export const DEVTOOLS_AGENT_META = {
avatar: DEFAULT_INBOX_AVATAR,
- title: 'Lobe AI',
+ title: DEFAULT_INBOX_TITLE,
};
export const DEVTOOLS_GROUP_DETAIL = {
diff --git a/src/features/Electron/ScreenCapture/overlaySnapshot.test.ts b/src/features/Electron/ScreenCapture/overlaySnapshot.test.ts
index 1f5c63d4a3f..52727539a69 100644
--- a/src/features/Electron/ScreenCapture/overlaySnapshot.test.ts
+++ b/src/features/Electron/ScreenCapture/overlaySnapshot.test.ts
@@ -1,4 +1,4 @@
-import { DEFAULT_AVATAR, DEFAULT_INBOX_AVATAR } from '@lobechat/const';
+import { DEFAULT_AVATAR, DEFAULT_INBOX_AVATAR, DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { describe, expect, it } from 'vitest';
import { resolveOverlayAgentOptions, resolveOverlayDefaultAgentId } from './overlaySnapshot';
@@ -16,7 +16,7 @@ describe('overlaySnapshot', () => {
avatar: DEFAULT_INBOX_AVATAR,
backgroundColor: undefined,
id: 'inbox-agent',
- title: 'Lobe AI',
+ title: DEFAULT_INBOX_TITLE,
},
{
avatar: 'A',
diff --git a/src/features/Electron/ScreenCapture/overlaySnapshot.ts b/src/features/Electron/ScreenCapture/overlaySnapshot.ts
index f56ef0f7092..9ff5b38aee9 100644
--- a/src/features/Electron/ScreenCapture/overlaySnapshot.ts
+++ b/src/features/Electron/ScreenCapture/overlaySnapshot.ts
@@ -1,8 +1,8 @@
-import { DEFAULT_AVATAR, DEFAULT_INBOX_AVATAR } from '@lobechat/const';
+import { DEFAULT_AVATAR, DEFAULT_INBOX_AVATAR, DEFAULT_INBOX_TITLE } from '@lobechat/const';
import type { ScreenCaptureAgentOption } from '@lobechat/electron-client-ipc';
import { agentDisplayName } from '@lobechat/types';
-const LOBE_AI_TITLE = 'Lobe AI';
+const LOBE_AI_TITLE = DEFAULT_INBOX_TITLE;
const UNTITLED_AGENT_TITLE = 'Untitled Agent';
interface OverlayAgentSource {
diff --git a/src/features/Home/AgentSelect/index.tsx b/src/features/Home/AgentSelect/index.tsx
index 96e8bb9855d..fb17c7a9838 100644
--- a/src/features/Home/AgentSelect/index.tsx
+++ b/src/features/Home/AgentSelect/index.tsx
@@ -16,7 +16,7 @@ import { memo, useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
import AgentAvatar from '@/components/AgentAvatar';
-import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
+import { DEFAULT_INBOX_AVATAR, DEFAULT_INBOX_TITLE } from '@/const/meta';
import { useFetchAgentList } from '@/hooks/useFetchAgentList';
import { agentService } from '@/services/agent';
import { useAgentStore } from '@/store/agent';
@@ -86,7 +86,7 @@ const AgentSelect = memo(() => {
const displayMeta = showInboxFallback ? inboxMeta : (sidebarItem ?? agentMapMeta);
const displayTitle = agentDisplayName(
displayMeta,
- showInboxFallback ? 'Lobe AI' : t('defaultSession', { ns: 'common' }),
+ showInboxFallback ? DEFAULT_INBOX_TITLE : t('defaultSession', { ns: 'common' }),
);
const displayAvatar =
(typeof displayMeta?.avatar === 'string' ? displayMeta.avatar : undefined) ||
diff --git a/src/features/Home/AgentSelect/useHomeAgentRows.ts b/src/features/Home/AgentSelect/useHomeAgentRows.ts
index 2660355518b..34736c06bd1 100644
--- a/src/features/Home/AgentSelect/useHomeAgentRows.ts
+++ b/src/features/Home/AgentSelect/useHomeAgentRows.ts
@@ -10,7 +10,7 @@ import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
-import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
+import { DEFAULT_INBOX_AVATAR, DEFAULT_INBOX_TITLE } from '@/const/meta';
import {
useKeepSidebarGroupsListed,
useKeepSidebarListed,
@@ -110,7 +110,7 @@ export const useHomeAgentRows = (): HomeAgentRows => {
DEFAULT_INBOX_AVATAR,
backgroundColor: inboxMeta?.backgroundColor || undefined,
id: inboxAgentId,
- title: agentDisplayName(inboxMeta, 'Lobe AI'),
+ title: agentDisplayName(inboxMeta, DEFAULT_INBOX_TITLE),
});
}
workspaceRows.push(
diff --git a/src/features/HomeSidebar/Body/Agent/List/InboxItem.tsx b/src/features/HomeSidebar/Body/Agent/List/InboxItem.tsx
index b41cc7f6dd0..c9c779e06b0 100644
--- a/src/features/HomeSidebar/Body/Agent/List/InboxItem.tsx
+++ b/src/features/HomeSidebar/Body/Agent/List/InboxItem.tsx
@@ -1,6 +1,6 @@
'use client';
-import { DEFAULT_INBOX_AVATAR } from '@lobechat/const';
+import { DEFAULT_INBOX_AVATAR, DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { agentDisplayName } from '@lobechat/types';
import { Avatar, createStaticStyles, Spin } from '@lobehub/ui';
import { type CSSProperties } from 'react';
@@ -58,7 +58,7 @@ const InboxItem = memo<InboxItemProps>(({ className, style }) => {
inboxAgentId ? operationSelectors.isAgentVisiblyRunning(inboxAgentId) : () => false,
);
const prefetchAgent = usePrefetchAgent();
- const inboxAgentTitle = agentDisplayName(inboxMeta, 'Lobe AI');
+ const inboxAgentTitle = agentDisplayName(inboxMeta, DEFAULT_INBOX_TITLE);
const inboxAgentAvatar = inboxMeta.avatar || DEFAULT_INBOX_AVATAR;
const inboxUrl = usePreservedAgentUrl(inboxRouteAgentId);
diff --git a/src/features/MobileHome/SessionListContent/Inbox/index.tsx b/src/features/MobileHome/SessionListContent/Inbox/index.tsx
index 10fd2767866..423f05afc2e 100644
--- a/src/features/MobileHome/SessionListContent/Inbox/index.tsx
+++ b/src/features/MobileHome/SessionListContent/Inbox/index.tsx
@@ -1,4 +1,4 @@
-import { AGENT_CHAT_URL } from '@lobechat/const';
+import { AGENT_CHAT_URL, DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { memo } from 'react';
import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
@@ -21,7 +21,7 @@ const Inbox = memo(() => {
return (
<WorkspaceLink
- aria-label={'Lobe AI'}
+ aria-label={DEFAULT_INBOX_TITLE}
to={AGENT_CHAT_URL(inboxRouteAgentId, mobile)}
onClick={(e) => {
e.preventDefault();
@@ -32,7 +32,7 @@ const Inbox = memo(() => {
active={isInboxActive}
avatar={DEFAULT_INBOX_AVATAR}
key={'inbox'}
- title={'Lobe AI'}
+ title={DEFAULT_INBOX_TITLE}
styles={{
container: {
gap: 12,
diff --git a/src/features/Onboarding/steps/TelemetryStep.tsx b/src/features/Onboarding/steps/TelemetryStep.tsx
index a15722add46..e61146ac725 100644
--- a/src/features/Onboarding/steps/TelemetryStep.tsx
+++ b/src/features/Onboarding/steps/TelemetryStep.tsx
@@ -1,6 +1,7 @@
'use client';
import { BRANDING_NAME } from '@lobechat/business-const';
+import { DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { type IconProps } from '@lobehub/ui';
import {
Block,
@@ -88,7 +89,7 @@ const TelemetryStep = memo<TelemetryStepProps>(({ onNext }) => {
pauseDuration={16_000}
typingSpeed={64}
sentences={[
- t('telemetry.title', { name: 'Lobe AI' }),
+ t('telemetry.title', { name: DEFAULT_INBOX_TITLE }),
t('telemetry.title2'),
t('telemetry.title3'),
]}
diff --git a/src/features/ShareModal/ShareImage/Preview.tsx b/src/features/ShareModal/ShareImage/Preview.tsx
index 6fa4db381bc..9468d778b24 100644
--- a/src/features/ShareModal/ShareImage/Preview.tsx
+++ b/src/features/ShareModal/ShareImage/Preview.tsx
@@ -1,3 +1,4 @@
+import { DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { agentDisplayName, type ConversationContext, type UIChatMessage } from '@lobechat/types';
import { cx, Flexbox, Markdown, Text } from '@lobehub/ui';
import { memo } from 'react';
@@ -81,7 +82,7 @@ const Preview = memo<PreviewProps>(
const displayTitle =
(isHeaderInbox ?? isInbox)
- ? 'Lobe AI'
+ ? DEFAULT_INBOX_TITLE
: agentDisplayName(headerMeta) || title || currentTitle;
const resolvedAgentId = (headerMeta && headerAgentId) || activeAgentId;
const displayAvatar = headerMeta?.avatar || currentAvatar;
diff --git a/src/libs/i18n/serverTranslation.ts b/src/libs/i18n/serverTranslation.ts
index 1205c74935f..3dac4c019b8 100644
--- a/src/libs/i18n/serverTranslation.ts
+++ b/src/libs/i18n/serverTranslation.ts
@@ -1,4 +1,5 @@
import { DEFAULT_LANG } from '@/const/locale';
+import { applyBrandStrings } from '@/locales/brandPostProcessor';
import { type Locales, type NS } from '@/locales/resources';
import { normalizeLocale } from '@/locales/resources';
import { unwrapESMModule } from '@/utils/esm/unwrapESMModule';
@@ -52,7 +53,9 @@ export const translation = async (ns: NS = 'common', hl: string) => {
content = content.replace(`{{${k}}}`, value);
});
}
- return content;
+ // Mirror the client's brand post-processor (packages/locales/src/create.ts)
+ // so SSR copy does not leak the upstream product's names either.
+ return applyBrandStrings(content);
},
};
};
diff --git a/src/routes/(main)/agent/profile/features/AgentSettings/Content.tsx b/src/routes/(main)/agent/profile/features/AgentSettings/Content.tsx
index 8c6af2d59e0..23c9fffc891 100644
--- a/src/routes/(main)/agent/profile/features/AgentSettings/Content.tsx
+++ b/src/routes/(main)/agent/profile/features/AgentSettings/Content.tsx
@@ -1,5 +1,6 @@
'use client';
+import { DEFAULT_INBOX_TITLE } from '@lobechat/const';
import isEqual from 'fast-deep-equal';
import { GitBranchIcon, MessageSquareHeartIcon } from 'lucide-react';
import { memo, useEffect, useMemo, useState } from 'react';
@@ -73,7 +74,9 @@ const Content = memo(() => {
[availableTabs, t],
);
- const displayTitle = isInbox ? 'Lobe AI' : meta.title || t('defaultSession', { ns: 'common' });
+ const displayTitle = isInbox
+ ? DEFAULT_INBOX_TITLE
+ : meta.title || t('defaultSession', { ns: 'common' });
return (
<SettingsModalLayout
diff --git a/src/routes/(main)/group/features/Conversation/AgentWelcome/index.tsx b/src/routes/(main)/group/features/Conversation/AgentWelcome/index.tsx
index 6189a4f93ab..b149f3ce7ca 100644
--- a/src/routes/(main)/group/features/Conversation/AgentWelcome/index.tsx
+++ b/src/routes/(main)/group/features/Conversation/AgentWelcome/index.tsx
@@ -1,5 +1,6 @@
'use client';
+import { DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { Flexbox, Markdown, Text } from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
import React, { memo, useMemo } from 'react';
@@ -75,7 +76,9 @@ const InboxWelcome = memo(() => {
</Text>
<Flexbox width={'min(100%, 640px)'}>
<Markdown fontSize={fontSize} variant={'chat'}>
- {isInbox ? t('guide.defaultMessageWithoutCreate', { appName: 'Lobe AI' }) : message}
+ {isInbox
+ ? t('guide.defaultMessageWithoutCreate', { appName: DEFAULT_INBOX_TITLE })
+ : message}
</Markdown>
</Flexbox>
{openingQuestions.length > 0 && (
diff --git a/src/routes/(mobile)/chat/features/ChatHeader/ChatHeaderTitle.tsx b/src/routes/(mobile)/chat/features/ChatHeader/ChatHeaderTitle.tsx
index fbfb5d03129..614cbeb1a0d 100644
--- a/src/routes/(mobile)/chat/features/ChatHeader/ChatHeaderTitle.tsx
+++ b/src/routes/(mobile)/chat/features/ChatHeader/ChatHeaderTitle.tsx
@@ -1,3 +1,4 @@
+import { DEFAULT_INBOX_TITLE } from '@lobechat/const';
import { ActionIcon, cssVar, Flexbox } from '@lobehub/ui';
import { ChatHeader } from '@lobehub/ui/mobile';
import { ChevronDown } from 'lucide-react';
@@ -25,7 +26,7 @@ const ChatHeaderTitle = memo(() => {
// id so the title doesn't degrade to the "new topic" placeholder.
useFetchActiveTopicDetail();
- const displayTitle = isInbox ? 'Lobe AI' : title;
+ const displayTitle = isInbox ? DEFAULT_INBOX_TITLE : title;
return (
<ChatHeader.Title