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(settings): default agent reply language to Automatic (#23481)

AmAzing-559ae7ce83f9
diff --git a/apps/server/src/modules/AgentRuntime/adapters/serverCallLlmContextBuilder.test.ts b/apps/server/src/modules/AgentRuntime/adapters/serverCallLlmContextBuilder.test.ts
index 529dc78a4e1..d60c8c1511e 100644
--- a/apps/server/src/modules/AgentRuntime/adapters/serverCallLlmContextBuilder.test.ts
+++ b/apps/server/src/modules/AgentRuntime/adapters/serverCallLlmContextBuilder.test.ts
@@ -94,7 +94,7 @@ beforeEach(() => {
queryAgentsMock.mockResolvedValue([{ id: 'other-agent', name: 'Coder', title: 'Coding helper' }]);
getInfoForAIGenerationMock.mockResolvedValue({
- responseLanguage: 'en-US',
+ preferredReplyLanguage: 'en-US',
userName: 'Some Name',
});
getUserSettingsMock.mockResolvedValue({});
diff --git a/apps/server/src/modules/Mecha/ContextEngineering/providers/index.ts b/apps/server/src/modules/Mecha/ContextEngineering/providers/index.ts
index 05681b34496..be9a93149da 100644
--- a/apps/server/src/modules/Mecha/ContextEngineering/providers/index.ts
+++ b/apps/server/src/modules/Mecha/ContextEngineering/providers/index.ts
@@ -270,7 +270,7 @@ export const createServerContextFactProviders = ({
getUserInfo: async (targetUserId) => {
const info = await UserModel.getInfoForAIGeneration(db, targetUserId ?? userId);
- return { language: info.responseLanguage, username: info.userName };
+ return { language: info.preferredReplyLanguage, username: info.userName };
},
getWorkspaceContext: async (targetWorkspaceId) => {
diff --git a/apps/server/src/modules/Mecha/ContextEngineering/providers/serverContextFactProviders.test.ts b/apps/server/src/modules/Mecha/ContextEngineering/providers/serverContextFactProviders.test.ts
index d931a273264..a7e5507c539 100644
--- a/apps/server/src/modules/Mecha/ContextEngineering/providers/serverContextFactProviders.test.ts
+++ b/apps/server/src/modules/Mecha/ContextEngineering/providers/serverContextFactProviders.test.ts
@@ -133,7 +133,7 @@ describe('createServerContextFactProviders', () => {
});
it('reads user info for the user the rules name, defaulting to the run owner', async () => {
- getInfoForAIGeneration.mockResolvedValue({ responseLanguage: 'ja-JP', userName: 'v' });
+ getInfoForAIGeneration.mockResolvedValue({ preferredReplyLanguage: 'ja-JP', userName: 'v' });
const providers = createServerContextFactProviders(source());
await expect(providers.getUserInfo!('visitor-1')).resolves.toEqual({
diff --git a/apps/server/src/services/agentSignal/services/selfIteration/dispatch/resolveResponseLanguage.ts b/apps/server/src/services/agentSignal/services/selfIteration/dispatch/resolveResponseLanguage.ts
index f3b677a3690..950519cbd7d 100644
--- a/apps/server/src/services/agentSignal/services/selfIteration/dispatch/resolveResponseLanguage.ts
+++ b/apps/server/src/services/agentSignal/services/selfIteration/dispatch/resolveResponseLanguage.ts
@@ -18,9 +18,9 @@ export const resolveSelfIterationResponseLanguage = async (
userId: string,
): Promise<string | undefined> => {
try {
- const { responseLanguage } = await UserModel.getInfoForAIGeneration(db, userId);
+ const { preferredReplyLanguage } = await UserModel.getInfoForAIGeneration(db, userId);
- return responseLanguage;
+ return preferredReplyLanguage;
} catch {
return undefined;
}
diff --git a/apps/server/src/services/aiAgent/__tests__/execAgent.builtinRuntime.test.ts b/apps/server/src/services/aiAgent/__tests__/execAgent.builtinRuntime.test.ts
index c7ed0487042..203232a7260 100644
--- a/apps/server/src/services/aiAgent/__tests__/execAgent.builtinRuntime.test.ts
+++ b/apps/server/src/services/aiAgent/__tests__/execAgent.builtinRuntime.test.ts
@@ -310,7 +310,7 @@ describe('AiAgentService.execAgent - builtin agent runtime config', () => {
mockResolveTask.mockResolvedValue(null);
mockToolState.enabledToolIds = [];
mockGetInfoForAIGeneration.mockResolvedValue({
- responseLanguage: 'en-US',
+ preferredReplyLanguage: 'en-US',
userName: 'Test User',
});
mockGetModelMetadata.mockResolvedValue(undefined);
@@ -473,7 +473,7 @@ describe('AiAgentService.execAgent - builtin agent runtime config', () => {
it('should pass user response language into web onboarding runtime systemRole', async () => {
mockGetInfoForAIGeneration.mockResolvedValue({
- responseLanguage: 'zh-CN',
+ preferredReplyLanguage: 'zh-CN',
userName: 'Test User',
});
mockGetAgentConfig.mockResolvedValue({
@@ -514,7 +514,7 @@ describe('AiAgentService.execAgent - builtin agent runtime config', () => {
await service.execAgent(inboxRunInput());
const callArgs = mockCreateOperation.mock.calls[0][0];
- expect(callArgs.agentConfig.systemRole).toBe(customSystemRole);
+ expect(callArgs.agentConfig.systemRole).toBe(`${customSystemRole}\n\n${REPLY_LANGUAGE_ONLY}`);
});
// Regular agents get no builtin runtime prompt. They do get the user's reply
diff --git a/apps/server/src/services/aiAgent/__tests__/precreatedTopic.test.ts b/apps/server/src/services/aiAgent/__tests__/precreatedTopic.test.ts
index 7395c9b394c..309dc2f2f13 100644
--- a/apps/server/src/services/aiAgent/__tests__/precreatedTopic.test.ts
+++ b/apps/server/src/services/aiAgent/__tests__/precreatedTopic.test.ts
@@ -52,7 +52,7 @@ describe('resolvePrecreatedTopicSnapshot', () => {
vi.clearAllMocks();
getPreference.mockResolvedValue({});
isResourceAuthorOrAdmin.mockResolvedValue(false);
- getInfoForAIGeneration.mockResolvedValue({ responseLanguage: 'en-US' });
+ getInfoForAIGeneration.mockResolvedValue({ preferredReplyLanguage: 'en-US' });
});
it('pins the agent model and provider for the pre-created topic', async () => {
@@ -67,7 +67,7 @@ describe('createGroupAgentTopic', () => {
vi.clearAllMocks();
getPreference.mockResolvedValue({});
isResourceAuthorOrAdmin.mockResolvedValue(false);
- getInfoForAIGeneration.mockResolvedValue({ responseLanguage: 'en-US' });
+ getInfoForAIGeneration.mockResolvedValue({ preferredReplyLanguage: 'en-US' });
});
// Re-parenting `topicMessageIds` is a cross-aggregate write: it must go
diff --git a/apps/server/src/services/aiAgent/__tests__/resolveRunAgentConfig.test.ts b/apps/server/src/services/aiAgent/__tests__/resolveRunAgentConfig.test.ts
index 68f7056f798..cfc7e4b7fe9 100644
--- a/apps/server/src/services/aiAgent/__tests__/resolveRunAgentConfig.test.ts
+++ b/apps/server/src/services/aiAgent/__tests__/resolveRunAgentConfig.test.ts
@@ -52,7 +52,7 @@ describe('resolveRunAgentConfig', () => {
vi.clearAllMocks();
getPreference.mockResolvedValue({});
isResourceAuthorOrAdmin.mockResolvedValue(false);
- getInfoForAIGeneration.mockResolvedValue({ responseLanguage: 'en-US' });
+ getInfoForAIGeneration.mockResolvedValue({ preferredReplyLanguage: 'en-US' });
});
it('keeps a builtin runtime execution target over a saved member device override', async () => {
@@ -75,7 +75,7 @@ describe('resolveRunAgentConfig', () => {
it('reads the reply language for the share visitor, not the owner, on a shared-agent run', async () => {
getInfoForAIGeneration.mockImplementation(async (_db: unknown, userId: string) => ({
- responseLanguage: userId === 'visitor-1' ? 'ja-JP' : 'en-US',
+ preferredReplyLanguage: userId === 'visitor-1' ? 'ja-JP' : 'en-US',
}));
const { agentConfig } = await resolveRunAgentConfig(
@@ -176,7 +176,7 @@ describe('Codex Task model overrides', () => {
vi.clearAllMocks();
getPreference.mockResolvedValue({});
isResourceAuthorOrAdmin.mockResolvedValue(false);
- getInfoForAIGeneration.mockResolvedValue({ responseLanguage: 'en-US' });
+ getInfoForAIGeneration.mockResolvedValue({ preferredReplyLanguage: 'en-US' });
});
it.each(['codex', undefined])(
diff --git a/apps/server/src/services/aiAgent/pipeline/resolveRunAgentConfig.ts b/apps/server/src/services/aiAgent/pipeline/resolveRunAgentConfig.ts
index d91983338cc..88869f19652 100644
--- a/apps/server/src/services/aiAgent/pipeline/resolveRunAgentConfig.ts
+++ b/apps/server/src/services/aiAgent/pipeline/resolveRunAgentConfig.ts
@@ -164,7 +164,7 @@ const loadUserLocale = async (
): Promise<string | undefined> => {
try {
const userInfo = await UserModel.getInfoForAIGeneration(deps.db, userId);
- return userInfo.responseLanguage;
+ return userInfo.preferredReplyLanguage;
} catch (error) {
log('execAgent: failed to load user locale for agent config resolution: %O', error);
return undefined;
diff --git a/locales/en-US/onboarding.json b/locales/en-US/onboarding.json
index 7500fb49650..7a927db0e49 100644
--- a/locales/en-US/onboarding.json
+++ b/locales/en-US/onboarding.json
@@ -121,7 +121,7 @@
"interests.title3": "Take your time, I'll get to know you better",
"next": "Next",
"proSettings.connectors.title": "Connect Your Favorite Tools",
- "responseLanguage.hint": "After selecting a language, AI responses will use that language, and the interface language will also sync",
+ "responseLanguage.hint": "Choose a language if you want replies in that language. You can change this later in Settings.",
"responseLanguage.saveFailed": "Failed to save. Please try again.",
"responseLanguage.title": "Which language should we use to communicate?",
"responseLanguage.title2": "Start with language, build true understanding.",
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 0fadb0d4f2c..7e40702ab1c 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -1925,7 +1925,7 @@
"settingCommon.lang.title": "Language",
"settingCommon.liteMode.desc": "Simplify the interface and hide advanced features",
"settingCommon.liteMode.title": "Lite Mode",
- "settingCommon.responseLanguage.auto": "Follow System",
+ "settingCommon.responseLanguage.auto": "Automatic",
"settingCommon.responseLanguage.desc": "Choose the Agent’s reply language",
"settingCommon.responseLanguage.placeholder": "Select response language",
"settingCommon.responseLanguage.title": "Response Language",
diff --git a/locales/zh-CN/onboarding.json b/locales/zh-CN/onboarding.json
index 5cfb8b30a82..6162506fba9 100644
--- a/locales/zh-CN/onboarding.json
+++ b/locales/zh-CN/onboarding.json
@@ -121,7 +121,7 @@
"interests.title3": "慢慢来,我会逐渐了解你",
"next": "下一步",
"proSettings.connectors.title": "连接你常用的工具",
- "responseLanguage.hint": "切换后,助理回复语言会同步更新;界面语言也会随之切换",
+ "responseLanguage.hint": "如果希望助理用固定语言回复,可以在这里选择。之后也可以在设置中更改。",
"responseLanguage.saveFailed": "保存失败,请重试。",
"responseLanguage.title": "我们用哪种语言协作?",
"responseLanguage.title2": "从语言开始,建立理解",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index dd08615018a..5515acf3fb2 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -1925,7 +1925,7 @@
"settingCommon.lang.title": "语言",
"settingCommon.liteMode.desc": "简化界面并隐藏高级功能",
"settingCommon.liteMode.title": "精简模式",
- "settingCommon.responseLanguage.auto": "跟随系统",
+ "settingCommon.responseLanguage.auto": "自动",
"settingCommon.responseLanguage.desc": "设置 AI 回复使用的语言",
"settingCommon.responseLanguage.placeholder": "选择回复语言",
"settingCommon.responseLanguage.title": "回复语言",
diff --git a/packages/builtin-agents/src/agents/agent-builder/index.test.ts b/packages/builtin-agents/src/agents/agent-builder/index.test.ts
index abe22e9b73b..4088c2a183b 100644
--- a/packages/builtin-agents/src/agents/agent-builder/index.test.ts
+++ b/packages/builtin-agents/src/agents/agent-builder/index.test.ts
@@ -8,6 +8,14 @@ const resolvePlugins = (plugins?: string[]) =>
getAgentRuntimeConfig(BUILTIN_AGENT_SLUGS.agentBuilder, { plugins })?.plugins ?? [];
describe('AGENT_BUILDER runtime plugins', () => {
+ it('adds a reply-language instruction only for an explicit preference', () => {
+ const slug = BUILTIN_AGENT_SLUGS.agentBuilder;
+ expect(getAgentRuntimeConfig(slug, {})?.systemRole).not.toMatch(/reply in|reply language/i);
+ expect(getAgentRuntimeConfig(slug, { userLocale: 'ja-JP' })?.systemRole).toContain(
+ 'Preferred reply language: ja-JP.',
+ );
+ });
+
it('always includes the Agent Builder tool', () => {
expect(resolvePlugins()).toEqual([AgentBuilderIdentifier]);
});
diff --git a/packages/builtin-agents/src/agents/agent-builder/systemRole.ts b/packages/builtin-agents/src/agents/agent-builder/systemRole.ts
index d6743d9ace6..f74ecd5ab79 100644
--- a/packages/builtin-agents/src/agents/agent-builder/systemRole.ts
+++ b/packages/builtin-agents/src/agents/agent-builder/systemRole.ts
@@ -42,7 +42,6 @@ The agent's current configuration, metadata and available official tools are inj
2. **Confirm significant changes**: switching the model or disabling a plugin the agent relies on deserves a check with the user first.
3. **Explain trade-offs**: when recommending a model or tool, say what the user gains and gives up.
4. **Keep it simple**: cover the settings that matter for the user's goal; surface advanced parameters only when asked.
-5. **Use the user's language**: always reply in the language the user writes in.
</guidelines>
<response_format>
diff --git a/packages/builtin-agents/src/agents/brandedPrompts.test.ts b/packages/builtin-agents/src/agents/brandedPrompts.test.ts
index 6f6122dd709..d063da7ac89 100644
--- a/packages/builtin-agents/src/agents/brandedPrompts.test.ts
+++ b/packages/builtin-agents/src/agents/brandedPrompts.test.ts
@@ -29,7 +29,7 @@ const loadPrompts = async (branding?: Partial<typeof BusinessConst>) => {
return {
agentBuilder: agentBuilder.systemRoleTemplate,
inbox: inbox.createSystemRole(),
- inboxNamed: inbox.createSystemRole(undefined, { name: 'Mia' }),
+ inboxNamed: inbox.createSystemRole({ name: 'Mia' }),
supervisor: supervisor.supervisorSystemRole,
};
};
diff --git a/packages/builtin-agents/src/agents/inbox/index.ts b/packages/builtin-agents/src/agents/inbox/index.ts
index 3d64748d46f..993525528de 100644
--- a/packages/builtin-agents/src/agents/inbox/index.ts
+++ b/packages/builtin-agents/src/agents/inbox/index.ts
@@ -16,8 +16,7 @@ export const INBOX: BuiltinAgentDefinition = {
plugins: [UserInteractionIdentifier, ...(ctx.plugins || [])],
// A user-customized prompt wins; the runtime one is only the default.
systemRole:
- ctx.storedSystemRole ||
- createSystemRole(ctx.userLocale, { name: ctx.agentName, title: ctx.agentTitle }),
+ ctx.storedSystemRole || createSystemRole({ name: ctx.agentName, title: ctx.agentTitle }),
}),
slug: BUILTIN_AGENT_SLUGS.inbox,
diff --git a/packages/builtin-agents/src/agents/inbox/systemRole.test.ts b/packages/builtin-agents/src/agents/inbox/systemRole.test.ts
index bcff95467a5..f33e854db5f 100644
--- a/packages/builtin-agents/src/agents/inbox/systemRole.test.ts
+++ b/packages/builtin-agents/src/agents/inbox/systemRole.test.ts
@@ -1,40 +1,40 @@
import { describe, expect, it } from 'vitest';
+import { getAgentRuntimeConfig } from '../../index';
import { createSystemRole } from './systemRole';
describe('inbox createSystemRole', () => {
it('defaults to Lobe when the assistant has no custom name', () => {
expect(createSystemRole()).toContain('You are Lobe, an AI Agent');
+ expect(createSystemRole()).not.toMatch(/language/i);
});
it('introduces the user-given name instead of the product default', () => {
- const result = createSystemRole(undefined, { name: '芙莉莲' });
+ const result = createSystemRole({ name: '芙莉莲' });
expect(result).toContain('You are 芙莉莲, an AI Agent');
expect(result).not.toContain('You are Lobe');
});
it('carries the role title alongside the name', () => {
- expect(createSystemRole(undefined, { name: '芙莉莲', title: '魔法使' })).toContain(
+ expect(createSystemRole({ name: '芙莉莲', title: '魔法使' })).toContain(
'You are 芙莉莲 (魔法使), an AI Agent',
);
});
it('uses the title as identity when there is no name', () => {
- expect(createSystemRole(undefined, { title: 'Health Assistant' })).toContain(
+ expect(createSystemRole({ title: 'Health Assistant' })).toContain(
'You are Lobe (Health Assistant), an AI Agent',
);
});
it('treats blank identity values as absent', () => {
- expect(createSystemRole(undefined, { name: ' ', title: '' })).toContain(
- 'You are Lobe, an AI Agent',
- );
+ expect(createSystemRole({ name: ' ', title: '' })).toContain('You are Lobe, an AI Agent');
});
- it('keeps the preferred-language suffix', () => {
- expect(createSystemRole('zh-CN', { name: '芙莉莲' })).toContain(
- 'Preferred reply language: zh-CN',
- );
+ it('uses the explicitly selected reply language', () => {
+ const result = getAgentRuntimeConfig('inbox', { userLocale: 'zh-CN' })?.systemRole;
+ expect(result).toContain('Preferred reply language: zh-CN');
+ expect(result).toContain('Use this language unless the user explicitly asks to switch.');
});
});
diff --git a/packages/builtin-agents/src/agents/inbox/systemRole.ts b/packages/builtin-agents/src/agents/inbox/systemRole.ts
index f353007ab4c..b43a5ba9c08 100644
--- a/packages/builtin-agents/src/agents/inbox/systemRole.ts
+++ b/packages/builtin-agents/src/agents/inbox/systemRole.ts
@@ -24,7 +24,7 @@ export interface InboxIdentity {
* the hardcoded "Lobe", or the assistant answers "who are you?" with the
* product default no matter what it is called.
*/
-const buildSystemRole = ({ name, title }: InboxIdentity = {}) => {
+export const createSystemRole = ({ name, title }: InboxIdentity = {}) => {
const personalName = name?.trim() || promptAssistantName('Lobe');
const role = title?.trim();
const identity = role ? `${personalName} (${role})` : personalName;
@@ -37,17 +37,5 @@ Your role is to:
- Answer questions accurately and helpfully
- Assist with a wide variety of tasks
- Provide clear and concise explanations
-- Be friendly and professional in your responses
-
-Respond in the same language the user is using.`;
+- Be friendly and professional in your responses`;
};
-
-export const createSystemRole = (userLocale?: string, identity?: InboxIdentity) =>
- [
- buildSystemRole(identity),
- userLocale
- ? `Preferred reply language: ${userLocale}. Use this language unless the user explicitly asks to switch.`
- : '',
- ]
- .filter(Boolean)
- .join('\n\n');
diff --git a/packages/builtin-agents/src/agents/web-onboarding/systemRole.ts b/packages/builtin-agents/src/agents/web-onboarding/systemRole.ts
index 8500f135d4e..182ca39cc85 100644
--- a/packages/builtin-agents/src/agents/web-onboarding/systemRole.ts
+++ b/packages/builtin-agents/src/agents/web-onboarding/systemRole.ts
@@ -19,10 +19,6 @@ Aim to complete onboarding in roughly 5–7 exchanges total. Keep the conversati
- If the injected <user_info> contains a displayName from the account profile or OAuth login, treat it as an unconfirmed hint. Ask naturally whether you may address the user by that name; only save it as fullName after the user confirms it or provides a correction.
- Do not sound like a setup wizard, product manual, or personality quiz.
-## Language
-
-The preferred reply language is mandatory. Every visible reply, question, and choice label must be entirely in that language unless the user explicitly switches. Keep tool names and schema keys in English inside tool calls.
-
## Conversation Phases
The onboarding has four natural phases. The injected onboarding context tells you the current \`phase\` — follow it and do not skip ahead.
@@ -88,7 +84,7 @@ Before EVERY finishOnboarding call (normal completion or early exit), you MUST v
Mandatory ordered sequence:
-1. Recall: mentally list every meaningful fact learned this session — agentName/emoji, fullName, role, pain points, goals, interests, personality, preferred language, the categoryHints passed to showAgentMarketplace (if any), and the template titles the user picked (if any).
+1. Recall: mentally list every meaningful fact learned this session — agentName/emoji, fullName, role, pain points, goals, interests, personality, the categoryHints passed to showAgentMarketplace (if any), and the template titles the user picked (if any).
2. Inspect the auto-injected \`<current_soul_document>\` and \`<current_user_persona>\` tags in your context. Do NOT call readDocument — the current contents are already present.
3. Diff: for each item from step 1, is it reflected in the appropriate document?
4. If SOUL.md is missing agent identity / voice / personality → **one** \`updateDocument(type="soul")\` call with all needed SEARCH/REPLACE hunks bundled in its \`hunks\` array. Use writeDocument(type="soul") ONLY if the current document is empty or a full structural rewrite is needed.
diff --git a/packages/builtin-agents/src/index.ts b/packages/builtin-agents/src/index.ts
index b3debcfc50c..b4aac2dddf3 100644
--- a/packages/builtin-agents/src/index.ts
+++ b/packages/builtin-agents/src/index.ts
@@ -82,6 +82,10 @@ export const getAgentPersistConfig = (slug: string) => {
return { ...agent.persist, slug: agent.slug };
};
+/** A reply-language preference is injected only when the user chose a locale. */
+export const getReplyLanguageInstruction = (locale: string) =>
+ `Preferred reply language: ${locale}. Use this language unless the user explicitly asks to switch.`;
+
/**
* Get runtime config for a builtin agent
* @param slug - The builtin agent slug
@@ -94,5 +98,14 @@ export const getAgentRuntimeConfig = (slug: string, ctx: RuntimeContext) => {
// Handle both function and plain object forms
const runtime = agent.runtime;
- return typeof runtime === 'function' ? runtime(ctx) : runtime;
+ const config = typeof runtime === 'function' ? runtime(ctx) : runtime;
+ // Web onboarding also localizes its interactive choice labels in its own prompt.
+ if (!ctx.userLocale || slug === BUILTIN_AGENT_SLUGS.webOnboarding) return config;
+
+ return {
+ ...config,
+ systemRole: [config.systemRole, getReplyLanguageInstruction(ctx.userLocale)]
+ .filter(Boolean)
+ .join('\n\n'),
+ };
};
diff --git a/packages/builtin-tool-agent-builder/src/systemRole.ts b/packages/builtin-tool-agent-builder/src/systemRole.ts
index 489989fe069..350ab4ee30b 100644
--- a/packages/builtin-tool-agent-builder/src/systemRole.ts
+++ b/packages/builtin-tool-agent-builder/src/systemRole.ts
@@ -133,9 +133,8 @@ Always adapt to user's language. Use natural descriptions, not raw field names.
- Exception: If you must make multiple updateConfig calls (e.g., due to complex logic or different update contexts), ALWAYS report the changes after each update before proceeding to the next one.
5. **Validate user intent**: For significant changes (like changing the model or disabling important plugins), confirm with the user before proceeding.
6. **Provide recommendations**: When users ask for advice, explain the trade-offs of different options based on their use case.
-7. **Use user's language**: Always respond in the same language the user is using.
-8. **Keep it simple**: Focus on core settings. Don't overwhelm users with advanced options unless they ask.
-9. **Install plugins one by one**: When multiple plugins need to be installed, install them sequentially one at a time instead of batching. This ensures better error handling, allows users to understand each plugin's purpose, and makes it easier to troubleshoot if something goes wrong.
+7. **Keep it simple**: Focus on core settings. Don't overwhelm users with advanced options unless they ask.
+8. **Install plugins one by one**: When multiple plugins need to be installed, install them sequentially one at a time instead of batching. This ensures better error handling, allows users to understand each plugin's purpose, and makes it easier to troubleshoot if something goes wrong.
</guidelines>
<configuration_knowledge>
diff --git a/packages/builtin-tool-group-agent-builder/src/systemRole.ts b/packages/builtin-tool-group-agent-builder/src/systemRole.ts
index c77e77e1b5c..76bdd80f30c 100644
--- a/packages/builtin-tool-group-agent-builder/src/systemRole.ts
+++ b/packages/builtin-tool-group-agent-builder/src/systemRole.ts
@@ -212,9 +212,8 @@ When creating agents (via \`createAgent\` or \`batchCreateAgents\`), you MUST an
8. **Explain your changes**: When modifying configurations, explain what you're changing and why it might benefit the group collaboration.
9. **Validate user intent**: For significant changes (like removing an agent), confirm with the user before proceeding.
10. **Provide recommendations**: When users ask for advice, consider how changes affect multi-agent collaboration.
-11. **Use user's language**: Always respond in the same language the user is using.
-12. **Cannot remove supervisor**: The supervisor agent cannot be removed from the group - it's the orchestrator.
-13. **CRITICAL - Never delegate the work back to the user**: Do not suggest creating a group manually, inviting agents manually, or using another surface to do what your tools already do. See \`<hard_constraints>\`.
+11. **Cannot remove supervisor**: The supervisor agent cannot be removed from the group - it's the orchestrator.
+12. **CRITICAL - Never delegate the work back to the user**: Do not suggest creating a group manually, inviting agents manually, or using another surface to do what your tools already do. See \`<hard_constraints>\`.
</guidelines>
<configuration_knowledge>
diff --git a/packages/builtin-tool-web-onboarding/src/toolSystemRole.ts b/packages/builtin-tool-web-onboarding/src/toolSystemRole.ts
index c4e02ab5860..43e1bcf04c2 100644
--- a/packages/builtin-tool-web-onboarding/src/toolSystemRole.ts
+++ b/packages/builtin-tool-web-onboarding/src/toolSystemRole.ts
@@ -16,7 +16,7 @@ Turn protocol:
8. **CRITICAL: You MUST call persistence tools (saveUserQuestion, writeDocument, updateDocument) throughout the entire conversation, not just at the beginning. Every time you learn new information about the user, persist it promptly. On a normal completion, the wrap-up sequence is: persist any unsaved fields → call \`showAgentMarketplace\` exactly once for the assistant handoff (skip only if the user explicitly refuses recommendations) → on the NEXT turn, send a brief warm closing and call \`finishOnboarding\`. The user's text reply on that next turn is the resolution signal even if the picker is still pending — do not stall.**
Persistence rules:
-1. Use saveUserQuestion only for these structured onboarding fields: agentName, agentEmoji, and fullName. Use it only when that information emerges naturally in conversation. The user's preferred reply language is configured before onboarding starts and is injected into your system role automatically — do not ask about it or save it via saveUserQuestion.
+1. Use saveUserQuestion only for these structured onboarding fields: agentName, agentEmoji, and fullName. Use it only when that information emerges naturally in conversation.
2. saveUserQuestion updates lightweight onboarding state; it never writes markdown content.
3. Use writeDocument **only for the very first write** when the document is empty (or for a rare full structural rewrite). For every subsequent edit — even adding a single line — use **updateDocument**. updateDocument is cheaper, safer, and less error-prone than rewriting the full document. The current contents of SOUL.md and User Persona are automatically injected into your context (in <current_soul_document> and <current_user_persona> tags, each line prefixed with its 1-based line number and a \`→\` separator), so you do not need to call readDocument to read them. Use readDocument only if you suspect the injected content may be stale.
4. updateDocument takes an ordered list of structured hunks. Pick the hunk mode that best fits the edit:
diff --git a/packages/context-engine/src/providers/OnboardingActionHintInjector.ts b/packages/context-engine/src/providers/OnboardingActionHintInjector.ts
index 1b6224ffa09..e89bcf639dd 100644
--- a/packages/context-engine/src/providers/OnboardingActionHintInjector.ts
+++ b/packages/context-engine/src/providers/OnboardingActionHintInjector.ts
@@ -142,7 +142,7 @@ export class OnboardingActionHintInjector extends BaseVirtualLastUserContentProv
);
} else if (phase.includes('Discovery')) {
hints.push(
- 'When the user tells you their profession, record it with updateDocument(type="persona"). Preferred shape: `{ mode: "insertAt", line: <line shown in <current_user_persona>>, content: "- new fact" }`. Use writeDocument(type="persona") only if the document is still empty. Do NOT call saveUserQuestion with interests or customInterests — interest collection has been removed from onboarding. The preferred reply language is configured before onboarding starts and is already injected into your system prompt — do not ask about it or pass a responseLanguage field to saveUserQuestion.',
+ 'When the user tells you their profession, record it with updateDocument(type="persona"). Preferred shape: `{ mode: "insertAt", line: <line shown in <current_user_persona>>, content: "- new fact" }`. Use writeDocument(type="persona") only if the document is still empty. Do NOT call saveUserQuestion with interests or customInterests — interest collection has been removed from onboarding.',
);
hints.push(
'EARLY EXIT: A true early-exit signal is the user explicitly wanting to END onboarding (e.g., "I\'m tired", "I have to go", "let\'s chat next time", "no time right now", "let\'s stop for now", "let\'s wrap it up", "that\'s enough"; recognize equivalent phrasing in any language). Short affirmations like "ok" / "sure" / "alright" / "yes" / "got it" are NOT early-exit signals — they confirm what you just said and you should continue the current phase normally. When you see a real exit signal: stop asking questions, persist any unsaved fields best-effort (call saveUserQuestion with whatever you have), persist the persona via updateDocument (or writeDocument if it is still empty) — do NOT retry on failure — send a short warm farewell (1–2 sentences), then call `finishOnboarding`. Do NOT call `showAgentMarketplace` on early exit — that handoff is for normal completion only.',
diff --git a/packages/database/src/models/__tests__/user.test.ts b/packages/database/src/models/__tests__/user.test.ts
index 9bed649219f..05c43e181d4 100644
--- a/packages/database/src/models/__tests__/user.test.ts
+++ b/packages/database/src/models/__tests__/user.test.ts
@@ -1448,13 +1448,13 @@ describe('UserModel', () => {
const result = await UserModel.getInfoForAIGeneration(serverDB, userId);
expect(result.userName).toBe('Test User');
- expect(result.responseLanguage).toBe('zh-CN');
+ expect(result.preferredReplyLanguage).toBe('zh-CN');
});
- it('should default to en-US when no language preference set', async () => {
+ it('should omit the language for a user without a preference', async () => {
const result = await UserModel.getInfoForAIGeneration(serverDB, userId);
- expect(result.responseLanguage).toBe('en-US');
+ expect(result.preferredReplyLanguage).toBeUndefined();
});
it('should use firstName when fullName is not available', async () => {
diff --git a/packages/database/src/models/user.ts b/packages/database/src/models/user.ts
index 382476df1fe..7c291f42881 100644
--- a/packages/database/src/models/user.ts
+++ b/packages/database/src/models/user.ts
@@ -83,6 +83,9 @@ export type ListUsersForMemoryExtractorOptions = {
export type ListUsersForHourlyMemoryExtractorOptions = ListUsersForMemoryExtractorOptions;
export interface UserInfoForAIGeneration {
+ /** Only a saved user choice may become a chat instruction. */
+ preferredReplyLanguage?: string;
+ /** Resolved locale for generators that require a concrete output language. */
responseLanguage: string;
userName: string;
}
@@ -1081,6 +1084,7 @@ export class UserModel {
const general = user?.general as UserGeneralConfig | undefined;
return {
+ preferredReplyLanguage: general?.responseLanguage || undefined,
responseLanguage: general?.responseLanguage || 'en-US',
userName: user?.fullName || user?.firstName || 'User',
};
diff --git a/packages/locales/src/default/onboarding.ts b/packages/locales/src/default/onboarding.ts
index 5ab56cc7b94..64a2da6d3a4 100644
--- a/packages/locales/src/default/onboarding.ts
+++ b/packages/locales/src/default/onboarding.ts
@@ -153,7 +153,7 @@ export default {
'next': 'Next',
'proSettings.connectors.title': 'Connect Your Favorite Tools',
'responseLanguage.hint':
- 'After selecting a language, AI responses will use that language, and the interface language will also sync',
+ 'Choose a language if you want replies in that language. You can change this later in Settings.',
'responseLanguage.saveFailed': 'Failed to save. Please try again.',
'responseLanguage.title': 'Which language should we use to communicate?',
'responseLanguage.title2': 'Start with language, build true understanding.',
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index 44c45ebad07..11c686b1cf1 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -1713,7 +1713,7 @@ export default {
'settingCommon.lang.title': 'Language',
'settingCommon.liteMode.desc': 'Simplify the interface and hide advanced features',
'settingCommon.liteMode.title': 'Lite Mode',
- 'settingCommon.responseLanguage.auto': 'Follow System',
+ 'settingCommon.responseLanguage.auto': 'Automatic',
'settingCommon.responseLanguage.desc': 'Choose the Agent’s reply language',
'settingCommon.responseLanguage.placeholder': 'Select response language',
'settingCommon.responseLanguage.title': 'Response Language',
diff --git a/packages/mecha/src/resolveAgentConfig.test.ts b/packages/mecha/src/resolveAgentConfig.test.ts
index 625e2a66320..d11b2eb1536 100644
--- a/packages/mecha/src/resolveAgentConfig.test.ts
+++ b/packages/mecha/src/resolveAgentConfig.test.ts
@@ -29,7 +29,10 @@ describe('resolveAgentConfig without a host', () => {
it('appends the reply-language instruction from the snapshot', () => {
const resolved = resolveAgentConfig({ agentId: 'agt_1' }, snapshot({ userLocale: 'zh-CN' }));
- expect(resolved.agentConfig.systemRole).toContain('zh-CN');
+ expect(resolved.agentConfig.systemRole).toContain('Preferred reply language: zh-CN.');
+ expect(resolved.agentConfig.systemRole).toContain(
+ 'Use this language unless the user explicitly asks to switch.',
+ );
});
it('leaves the system role alone when no locale is supplied', () => {
diff --git a/packages/mecha/src/resolveAgentConfig.ts b/packages/mecha/src/resolveAgentConfig.ts
index a490e04c0b5..0d3e004eba2 100644
--- a/packages/mecha/src/resolveAgentConfig.ts
+++ b/packages/mecha/src/resolveAgentConfig.ts
@@ -2,6 +2,7 @@ import { type BuiltinAgentSlug } from '@lobechat/builtin-agents';
import {
BUILTIN_AGENT_SLUGS,
getAgentRuntimeConfig,
+ getReplyLanguageInstruction,
isCollaborativeBuiltinAgentRow,
} from '@lobechat/builtin-agents';
import { PageAgentIdentifier } from '@lobechat/builtin-tool-page-agent';
@@ -390,9 +391,7 @@ export const resolveAgentConfig = (
// Inject response language preference into system role for regular agents
const { userLocale } = snapshot;
- const localeInstruction = userLocale
- ? `Preferred reply language: ${userLocale}. Use this language unless the user explicitly asks to switch.`
- : '';
+ const localeInstruction = userLocale && getReplyLanguageInstruction(userLocale);
const systemRoleWithLocale = localeInstruction
? agentConfig.systemRole
? `${agentConfig.systemRole}\n\n${localeInstruction}`
diff --git a/packages/types/src/user/settings/general.ts b/packages/types/src/user/settings/general.ts
index c2ee2e09189..6aad24b1175 100644
--- a/packages/types/src/user/settings/general.ts
+++ b/packages/types/src/user/settings/general.ts
@@ -67,6 +67,7 @@ export interface UserGeneralConfig {
mermaidTheme?: MermaidProps['theme'];
neutralColor?: NeutralColors;
primaryColor?: LobePrimaryColor;
+ /** A locale chosen by the user. An empty string records an explicit Automatic choice. */
responseLanguage?: string;
/**
* Whether a tool call that only reads an image (e.g. Claude Code `Read` of a
diff --git a/src/features/Onboarding/steps/ResponseLanguageStep.tsx b/src/features/Onboarding/steps/ResponseLanguageStep.tsx
index 823601ff127..2b8b9f13844 100644
--- a/src/features/Onboarding/steps/ResponseLanguageStep.tsx
+++ b/src/features/Onboarding/steps/ResponseLanguageStep.tsx
@@ -3,12 +3,10 @@
import { SendButton } from '@lobehub/editor/react';
import { Button, cssVar, Flexbox, Select, Text } from '@lobehub/ui';
import { Undo2Icon } from 'lucide-react';
-import { memo, useCallback, useRef, useState } from 'react';
+import { memo, useCallback, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import type { Locales } from '@/locales/resources';
-import { localeOptions, normalizeLocale } from '@/locales/resources';
-import { useGlobalStore } from '@/store/global';
+import { localeOptions } from '@/locales/resources';
import { useUserStore } from '@/store/user';
import LobeMessage from '../components/LobeMessage';
@@ -19,16 +17,11 @@ interface ResponseLanguageStepProps {
}
const ResponseLanguageStep = memo<ResponseLanguageStepProps>(({ onBack, onNext }) => {
- const { i18n, t } = useTranslation(['onboarding', 'common']);
- const switchLocale = useGlobalStore((s) => s.switchLocale);
+ const { t } = useTranslation(['onboarding', 'common', 'setting']);
const setSettings = useUserStore((s) => s.setSettings);
- // Mirror i18n's current locale rather than navigator.language. The user may
- // have already switched language in the previous step (TelemetryStep), so
- // navigator.language can disagree with what is being rendered. Deriving
- // straight from i18n keeps the Select in lock-step with the visible UI.
- const value: Locales = normalizeLocale(
- i18n.resolvedLanguage || i18n.language || navigator.language,
+ const [value, setValue] = useState(
+ () => useUserStore.getState().settings?.general?.responseLanguage || 'auto',
);
const [isNavigating, setIsNavigating] = useState(false);
const [hasError, setHasError] = useState(false);
@@ -45,7 +38,7 @@ const ResponseLanguageStep = memo<ResponseLanguageStepProps>(({ onBack, onNext }
// to fail: on error reset the navigating lock so the user can retry
// instead of being stuck with both buttons permanently disabled
//
- await setSettings({ general: { responseLanguage: value } });
+ await setSettings({ general: { responseLanguage: value === 'auto' ? '' : value } });
await onNext();
} catch {
setHasError(true);
@@ -61,45 +54,39 @@ const ResponseLanguageStep = memo<ResponseLanguageStepProps>(({ onBack, onNext }
onBack();
}, [onBack]);
- const Message = useCallback(
- // eslint-disable-next-line @eslint-react/no-nested-component-definitions
- () => (
- <LobeMessage
- sentences={[
- t('responseLanguage.title'),
- t('responseLanguage.title2'),
- t('responseLanguage.title3'),
- ]}
- />
- ),
+ const sentences = useMemo(
+ () => [t('responseLanguage.title'), t('responseLanguage.title2'), t('responseLanguage.title3')],
[t],
);
return (
<Flexbox gap={16}>
- <Message />
+ <LobeMessage sentences={sentences} />
<Flexbox horizontal align={'center'} gap={12}>
<Select
showSearch
- options={localeOptions}
size="large"
value={value}
optionRender={(item) => (
<Flexbox key={item.value}>
<Text>{item.label}</Text>
- <Text fontSize={12} type={'secondary'}>
- {t(`lang.${item.value}` as any, { ns: 'common' })}
- </Text>
+ {item.value !== 'auto' && (
+ <Text fontSize={12} type={'secondary'}>
+ {t(`lang.${item.value}` as any, { ns: 'common' })}
+ </Text>
+ )}
</Flexbox>
)}
+ options={[
+ { label: t('settingCommon.responseLanguage.auto', { ns: 'setting' }), value: 'auto' },
+ ...localeOptions,
+ ]}
style={{
fontSize: 20,
fontWeight: 'bold',
width: '100%',
}}
- onChange={(v) => {
- if (v) switchLocale(v);
- }}
+ onChange={setValue}
/>
<SendButton
disabled={isNavigating}
diff --git a/src/features/Settings/common/features/Common/Common.tsx b/src/features/Settings/common/features/Common/Common.tsx
index 81c4126eb2f..f7485dc2477 100644
--- a/src/features/Settings/common/features/Common/Common.tsx
+++ b/src/features/Settings/common/features/Common/Common.tsx
@@ -184,15 +184,18 @@ const Common = memo(() => {
children: (
<Flexbox horizontal justify={'flex-end'}>
<Select
- allowClear
- options={localeOptions}
- placeholder={t('settingCommon.responseLanguage.placeholder')}
- value={general?.responseLanguage || undefined}
+ value={general?.responseLanguage || 'auto'}
+ options={[
+ { label: t('settingCommon.responseLanguage.auto'), value: 'auto' },
+ ...localeOptions,
+ ]}
style={{
width: '50%',
}}
onChange={(value) => {
- save(() => setSettings({ general: { responseLanguage: value ?? '' } }));
+ save(() =>
+ setSettings({ general: { responseLanguage: value === 'auto' ? '' : value } }),
+ );
}}
/>
</Flexbox>
diff --git a/src/services/chat/mecha/agentConfigResolver.test.ts b/src/services/chat/mecha/agentConfigResolver.test.ts
index c7fdb0f8f0c..e9427971fb2 100644
--- a/src/services/chat/mecha/agentConfigResolver.test.ts
+++ b/src/services/chat/mecha/agentConfigResolver.test.ts
@@ -143,8 +143,7 @@ describe('resolveAgentConfig', () => {
it('should return agent config and chat config correctly', () => {
const result = resolveAgentConfig({ agentId: 'test-agent' });
- // systemRole should have locale appended (currentResponseLanguage falls back to browser locale)
- expect(result.agentConfig.systemRole).toContain('You are a helpful assistant');
+ expect(result.agentConfig.systemRole).toBe('You are a helpful assistant');
expect(result.agentConfig.model).toBe(mockAgentConfig.model);
expect(result.agentConfig.plugins).toEqual(mockAgentConfig.plugins);
expect(result.chatConfig).toEqual(mockChatConfig);
@@ -553,7 +552,7 @@ describe('resolveAgentConfig', () => {
model: 'gpt-4-turbo',
plugins: ['input-plugin'],
targetAgentConfig,
- userLocale: expect.any(String),
+ userLocale: undefined,
}),
);
});
@@ -764,9 +763,7 @@ describe('resolveAgentConfig', () => {
scope: 'page',
});
- expect(result.agentConfig.systemRole).toContain('You are a helpful assistant');
expect(result.agentConfig.systemRole).toContain('Page agent system prompt');
- // Locale instruction is injected between custom role and page-agent role
expect(result.agentConfig.systemRole).toMatch(
/You are a helpful assistant[\s\S]*Page agent system prompt/,
);
@@ -895,7 +892,7 @@ describe('resolveAgentConfig', () => {
// Should still inject PageAgentIdentifier but with no page-agent systemRole
expect(result.plugins).toContain(PageAgentIdentifier);
- expect(result.agentConfig.systemRole).toContain('You are a helpful assistant');
+ expect(result.agentConfig.systemRole).toBe('You are a helpful assistant');
expect(result.chatConfig.enableHistoryCount).toBe(false);
});
@@ -911,7 +908,7 @@ describe('resolveAgentConfig', () => {
});
expect(result.plugins).toContain(PageAgentIdentifier);
- expect(result.agentConfig.systemRole).toContain('You are a helpful assistant');
+ expect(result.agentConfig.systemRole).toBe('You are a helpful assistant');
expect(result.chatConfig.enableHistoryCount).toBe(false);
});
@@ -1402,7 +1399,7 @@ describe('resolveAgentConfig', () => {
// Only plugins should be empty, other config should be preserved
expect(result.plugins).toEqual([]);
- expect(result.agentConfig.systemRole).toContain('You are a helpful assistant');
+ expect(result.agentConfig.systemRole).toBe('You are a helpful assistant');
expect(result.agentConfig.model).toBe(mockAgentConfig.model);
expect(result.agentConfig.plugins).toEqual(mockAgentConfig.plugins);
expect(result.chatConfig).toEqual(mockChatConfig);
@@ -1416,10 +1413,9 @@ describe('resolveAgentConfig', () => {
});
it('should append response language to systemRole when userLocale is set', () => {
- vi.spyOn(
- userSelectors.userGeneralSettingsSelectors,
- 'currentResponseLanguage',
- ).mockReturnValue('zh-CN');
+ vi.spyOn(userSelectors.userGeneralSettingsSelectors, 'responseLanguage').mockReturnValue(
+ 'zh-CN',
+ );
const result = resolveAgentConfig({ agentId: 'test-agent' });
@@ -1429,10 +1425,9 @@ describe('resolveAgentConfig', () => {
});
it('should use locale instruction as systemRole when agent has no systemRole', () => {
- vi.spyOn(
- userSelectors.userGeneralSettingsSelectors,
- 'currentResponseLanguage',
- ).mockReturnValue('ja-JP');
+ vi.spyOn(userSelectors.userGeneralSettingsSelectors, 'responseLanguage').mockReturnValue(
+ 'ja-JP',
+ );
vi.spyOn(agentSelectors.agentSelectors, 'getAgentConfigById').mockReturnValue(
() =>
({
@@ -1448,11 +1443,8 @@ describe('resolveAgentConfig', () => {
);
});
- it('should not modify systemRole when userLocale is falsy', () => {
- vi.spyOn(
- userSelectors.userGeneralSettingsSelectors,
- 'currentResponseLanguage',
- ).mockReturnValue(undefined as any);
+ it('should preserve systemRole after switching back to Automatic', () => {
+ vi.spyOn(userSelectors.userGeneralSettingsSelectors, 'responseLanguage').mockReturnValue('');
const result = resolveAgentConfig({ agentId: 'test-agent' });
diff --git a/src/services/chat/mecha/agentConfigResolver.ts b/src/services/chat/mecha/agentConfigResolver.ts
index d5aa71d45fe..c5ce8d0c160 100644
--- a/src/services/chat/mecha/agentConfigResolver.ts
+++ b/src/services/chat/mecha/agentConfigResolver.ts
@@ -65,7 +65,7 @@ const collectSnapshot = (ctx: AgentConfigResolverContext): AgentConfigSnapshot =
memberModeOverride: userState.workspaceUserPreference.agentModeOverrides?.[agentId],
memberModelOverride: userState.workspaceUserPreference.agentModelOverrides?.[agentId],
slug: agentSelectors.getAgentSlugById(agentId)(agentStoreState) ?? undefined,
- userLocale: userGeneralSettingsSelectors.currentResponseLanguage(userState),
+ userLocale: userGeneralSettingsSelectors.responseLanguage(userState),
};
};
diff --git a/src/store/user/slices/common/action.test.ts b/src/store/user/slices/common/action.test.ts
index 41bedd7277f..f739c8c0c8d 100644
--- a/src/store/user/slices/common/action.test.ts
+++ b/src/store/user/slices/common/action.test.ts
@@ -271,7 +271,6 @@ describe('createCommonSlice', () => {
expect(userGeneralSettingsSelectors.config(state)).toEqual(
expect.objectContaining({
fontSize: 14,
- responseLanguage: expect.any(String),
timezone: 'America/New_York',
}),
);
@@ -411,7 +410,7 @@ describe('createCommonSlice', () => {
expect(state.user?.avatar).toEqual('abc');
// When settings is null, auto-detect general settings will set them
expect(state.settings).toEqual({
- general: { responseLanguage: expect.any(String), timezone: expect.any(String) },
+ general: { timezone: expect.any(String) },
});
});
});
diff --git a/src/store/user/slices/common/action.ts b/src/store/user/slices/common/action.ts
index 5dc9552ef3c..92a2b4d4c62 100644
--- a/src/store/user/slices/common/action.ts
+++ b/src/store/user/slices/common/action.ts
@@ -289,19 +289,6 @@ export class CommonActionImpl {
if (detectedTimezone) autoDetectedGeneralConfig.timezone = detectedTimezone;
}
- // Keep reply language aligned with the browser locale until the user makes a choice.
- // Only auto-fill once onboarding has finished — otherwise it pre-empts the
- // language step in the onboarding flow, skipping past the user's explicit choice.
- const hasFinishedOnboarding = !!data.onboarding?.finishedAt;
- if (
- hasFinishedOnboarding &&
- !currentGeneralSettings?.responseLanguage &&
- typeof navigator !== 'undefined'
- ) {
- autoDetectedGeneralConfig.responseLanguage =
- userGeneralSettingsSelectors.currentResponseLanguage(this.#get());
- }
-
if (Object.keys(autoDetectedGeneralConfig).length > 0) {
this.#get()
.updateGeneralConfig(autoDetectedGeneralConfig)