🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(settings): improve settings search matching and index coverage (#18390)
YuTengjing3e9c965b6da7
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.jsonindex b0f41e4127d..79fb2e2e4dd 100644--- a/locales/en-US/setting.json+++ b/locales/en-US/setting.json@@ -1084,8 +1084,8 @@"settingsSearch.placeholder": "Search settings...","settingsSearch.tabKeywords.about": "about, version, changelog, feedback, help","settingsSearch.tabKeywords.advanced": "advanced, developer, labs, experiment, beta",- "settingsSearch.tabKeywords.apikey": "api key, apikey, token, secret",- "settingsSearch.tabKeywords.appearance": "appearance, theme, dark mode, light mode, font, language, color",+ "settingsSearch.tabKeywords.apikey": "api, api key, apikey, token, secret, personal key",+ "settingsSearch.tabKeywords.appearance": "appearance, theme, dark mode, light mode, font, language, color, background","settingsSearch.tabKeywords.billing": "billing, payment, invoice, card, transaction","settingsSearch.tabKeywords.connector": "connectors, integrations, mcp","settingsSearch.tabKeywords.credits": "credits, balance, top up, recharge, buy credits",@@ -1093,19 +1093,21 @@"settingsSearch.tabKeywords.devices": "devices, sessions, logged in devices","settingsSearch.tabKeywords.hotkey": "hotkey, shortcut, keyboard","settingsSearch.tabKeywords.labels": "labels, tags, grouping",+ "settingsSearch.tabKeywords.labs": "labs, experiment, beta, preview, developer","settingsSearch.tabKeywords.memory": "memory, memories, personalization",- "settingsSearch.tabKeywords.messenger": "messenger, chat platform, bot",- "settingsSearch.tabKeywords.notification": "notification, email, push, alerts",+ "settingsSearch.tabKeywords.messenger": "messenger, chat platform, bot, telegram, slack, discord, wechat",+ "settingsSearch.tabKeywords.notification": "notification, email, push, alerts, inbox, telegram, slack, discord, wechat",+ "settingsSearch.tabKeywords.oauthApps": "oauth, oauth apps, developer apps","settingsSearch.tabKeywords.plans": "subscription, plan, upgrade, pricing, membership","settingsSearch.tabKeywords.profile": "profile, account, avatar, username, password, email, sign out, logout",- "settingsSearch.tabKeywords.provider": "provider, model, llm, api key, apikey, byok, bring your own key, endpoint",- "settingsSearch.tabKeywords.proxy": "proxy, network, connection",+ "settingsSearch.tabKeywords.provider": "provider, model, llm, api, api key, apikey, byok, bring your own key, endpoint, model provider, language model, custom provider",+ "settingsSearch.tabKeywords.proxy": "proxy, network, connection, proxy settings","settingsSearch.tabKeywords.referral": "referral, invite, rewards, bonus",- "settingsSearch.tabKeywords.serviceModel": "service model, model assignment, topic naming, translation, tts, voice, speech, image, image generation, embedding, prompt rewrite, suggestion",+ "settingsSearch.tabKeywords.serviceModel": "service model, model assignment, topic naming, translation, tts, tts settings, voice, speech, image, image generation, embedding, prompt rewrite, suggestion, search, search model","settingsSearch.tabKeywords.skill": "skills, plugins, tools","settingsSearch.tabKeywords.stats": "analytics, statistics, stats",- "settingsSearch.tabKeywords.storage": "storage, files, import, export, backup, reset, clear data, account deletion, delete account",- "settingsSearch.tabKeywords.systemTools": "system tools, built-in tools",+ "settingsSearch.tabKeywords.storage": "storage, files, import, export, backup, reset, clear data, clear storage, knowledge base, account deletion, delete account",+ "settingsSearch.tabKeywords.systemTools": "system tools, built-in tools, system, node, python, cli, environment","settingsSearch.tabKeywords.usage": "usage, consumption, quota, spend, statistics","skillGroup.agentConnectors": "Agent Connectors","skillGroup.builtinSkills": "Built-in Skills",diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.jsonindex 6e24de728ff..83d8ed363fb 100644--- a/locales/zh-CN/setting.json+++ b/locales/zh-CN/setting.json@@ -1084,8 +1084,8 @@"settingsSearch.placeholder": "搜索设置...","settingsSearch.tabKeywords.about": "关于,版本,更新日志,反馈,帮助","settingsSearch.tabKeywords.advanced": "高级,开发者,实验室,实验功能",- "settingsSearch.tabKeywords.apikey": "密钥,令牌,API Key,apikey",- "settingsSearch.tabKeywords.appearance": "外观,主题,深色模式,浅色模式,字体,语言,颜色",+ "settingsSearch.tabKeywords.apikey": "密钥,令牌,个人密钥,API Key,apikey,api",+ "settingsSearch.tabKeywords.appearance": "外观,主题,深色模式,浅色模式,字体,语言,颜色,背景","settingsSearch.tabKeywords.billing": "账单,支付,付款,发票,交易记录,银行卡","settingsSearch.tabKeywords.connector": "连接器,集成,MCP","settingsSearch.tabKeywords.credits": "积分,余额,充值,购买积分",@@ -1093,19 +1093,21 @@"settingsSearch.tabKeywords.devices": "设备,会话,登录设备","settingsSearch.tabKeywords.hotkey": "快捷键,键盘,热键","settingsSearch.tabKeywords.labels": "标签, 分组, 标记",+ "settingsSearch.tabKeywords.labs": "实验室,实验功能","settingsSearch.tabKeywords.memory": "记忆,个性化",- "settingsSearch.tabKeywords.messenger": "聊天平台,机器人,消息",- "settingsSearch.tabKeywords.notification": "通知,推送,邮件提醒",+ "settingsSearch.tabKeywords.messenger": "聊天平台,机器人,消息,telegram,slack,discord,微信",+ "settingsSearch.tabKeywords.notification": "通知,推送,邮件提醒,收件箱,telegram,slack,discord,微信",+ "settingsSearch.tabKeywords.oauthApps": "OAuth,应用授权,开发者应用","settingsSearch.tabKeywords.plans": "订阅,套餐,升级,价格,会员","settingsSearch.tabKeywords.profile": "个人资料,账号,头像,用户名,密码,邮箱,退出登录",- "settingsSearch.tabKeywords.provider": "服务商,模型,大模型,密钥,接入点,apikey,byok",- "settingsSearch.tabKeywords.proxy": "代理,网络,连接",+ "settingsSearch.tabKeywords.provider": "服务商,模型,大模型,语言模型,模型服务商,自定义服务商,密钥,接入点,apikey,byok,model provider",+ "settingsSearch.tabKeywords.proxy": "代理,网络,连接,代理设置","settingsSearch.tabKeywords.referral": "推荐,邀请,奖励,返利",- "settingsSearch.tabKeywords.serviceModel": "服务模型,模型分配,话题命名,翻译,语音,语音合成,图片,图片生成,向量化,提示词改写,输入建议,跟进建议",+ "settingsSearch.tabKeywords.serviceModel": "服务模型,模型分配,话题命名,翻译,语音,语音合成,语音设置,图片,图片生成,向量化,提示词改写,输入建议,跟进建议,搜索,搜索模型","settingsSearch.tabKeywords.skill": "技能,插件,工具","settingsSearch.tabKeywords.stats": "数据统计,统计,分析",- "settingsSearch.tabKeywords.storage": "存储,文件,导入,导出,备份,重置,清除数据,注销,删除账号",- "settingsSearch.tabKeywords.systemTools": "系统工具,内置工具",+ "settingsSearch.tabKeywords.storage": "存储,文件,导入,导出,备份,重置,清除数据,清理存储,知识库,资源,注销,删除账号",+ "settingsSearch.tabKeywords.systemTools": "系统工具,内置工具,系统,node,python,cli,环境","settingsSearch.tabKeywords.usage": "用量,消耗,配额,花费,统计","skillGroup.agentConnectors": "助理连接器","skillGroup.builtinSkills": "内置技能",diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.tsindex f8abfe1d5a6..8b4c874db29 100644--- a/packages/locales/src/default/setting.ts+++ b/packages/locales/src/default/setting.ts@@ -1157,9 +1157,9 @@ export default {'settingsSearch.placeholder': 'Search settings...','settingsSearch.tabKeywords.about': 'about, version, changelog, feedback, help','settingsSearch.tabKeywords.advanced': 'advanced, developer, labs, experiment, beta',- 'settingsSearch.tabKeywords.apikey': 'api key, apikey, token, secret',+ 'settingsSearch.tabKeywords.apikey': 'api, api key, apikey, token, secret, personal key','settingsSearch.tabKeywords.appearance':- 'appearance, theme, dark mode, light mode, font, language, color',+ 'appearance, theme, dark mode, light mode, font, language, color, background','settingsSearch.tabKeywords.billing': 'billing, payment, invoice, card, transaction','settingsSearch.tabKeywords.connector': 'connectors, integrations, mcp','settingsSearch.tabKeywords.credits': 'credits, balance, top up, recharge, buy credits',@@ -1167,23 +1167,28 @@ export default {'settingsSearch.tabKeywords.devices': 'devices, sessions, logged in devices','settingsSearch.tabKeywords.hotkey': 'hotkey, shortcut, keyboard','settingsSearch.tabKeywords.labels': 'labels, tags, grouping',+ 'settingsSearch.tabKeywords.labs': 'labs, experiment, beta, preview, developer','settingsSearch.tabKeywords.memory': 'memory, memories, personalization',- 'settingsSearch.tabKeywords.messenger': 'messenger, chat platform, bot',- 'settingsSearch.tabKeywords.notification': 'notification, email, push, alerts',+ 'settingsSearch.tabKeywords.messenger':+ 'messenger, chat platform, bot, telegram, slack, discord, wechat',+ 'settingsSearch.tabKeywords.notification':+ 'notification, email, push, alerts, inbox, telegram, slack, discord, wechat',+ 'settingsSearch.tabKeywords.oauthApps': 'oauth, oauth apps, developer apps','settingsSearch.tabKeywords.plans': 'subscription, plan, upgrade, pricing, membership','settingsSearch.tabKeywords.profile':'profile, account, avatar, username, password, email, sign out, logout','settingsSearch.tabKeywords.provider':- 'provider, model, llm, api key, apikey, byok, bring your own key, endpoint',- 'settingsSearch.tabKeywords.proxy': 'proxy, network, connection',+ 'provider, model, llm, api, api key, apikey, byok, bring your own key, endpoint, model provider, language model, custom provider',+ 'settingsSearch.tabKeywords.proxy': 'proxy, network, connection, proxy settings','settingsSearch.tabKeywords.referral': 'referral, invite, rewards, bonus','settingsSearch.tabKeywords.serviceModel':- 'service model, model assignment, topic naming, translation, tts, voice, speech, image, image generation, embedding, prompt rewrite, suggestion',+ 'service model, model assignment, topic naming, translation, tts, tts settings, voice, speech, image, image generation, embedding, prompt rewrite, suggestion, search, search model','settingsSearch.tabKeywords.skill': 'skills, plugins, tools','settingsSearch.tabKeywords.stats': 'analytics, statistics, stats','settingsSearch.tabKeywords.storage':- 'storage, files, import, export, backup, reset, clear data, account deletion, delete account',- 'settingsSearch.tabKeywords.systemTools': 'system tools, built-in tools',+ 'storage, files, import, export, backup, reset, clear data, clear storage, knowledge base, account deletion, delete account',+ 'settingsSearch.tabKeywords.systemTools':+ 'system tools, built-in tools, system, node, python, cli, environment','settingsSearch.tabKeywords.usage': 'usage, consumption, quota, spend, statistics','settingSystem.oauth.info.desc': 'Logged in','settingSystem.oauth.info.title': 'Account Information',diff --git a/src/features/Settings/labs/features.ts b/src/features/Settings/labs/features.tsnew file mode 100644index 00000000000..11e61bd378a--- /dev/null+++ b/src/features/Settings/labs/features.ts@@ -0,0 +1,141 @@+import { type labPreferSelectors } from '@/store/user/slices/preference/selectors/labPrefer';++/**+ * Maturity stage of a lab experiment:+ * - alpha: internal testing only, not recommended for daily use yet+ * - beta: relatively usable — core flow works, details still being polished+ */+export type LabStage = 'alpha' | 'beta';++/**+ * Locale key stems under the `labs` namespace (`features.${stem}.title|desc`),+ * listed as literals so the dynamic `t()` calls stay inside the typed key union.+ */+type LabFeatureI18nKey =+ | 'agentGraphConfig'+ | 'artifactDeployment'+ | 'claudeCodeSdk'+ | 'codexAppServer'+ | 'desktopSplitView'+ | 'heteroSessionImport'+ | 'imessage'+ | 'inAppBrowser'+ | 'inputMarkdown'+ | 'messageTextSelectionActions'+ | 'oauthApps'+ | 'projects'+ | 'selfLearning'+ | 'topicAcceptance';++export interface LabFeatureItem {+ /** Only rendered (and searchable) in the Electron shell */+ desktopOnly?: boolean;+ /** Lab flag, also the search anchor suffix (`labs-${flag}`) */+ flag: keyof typeof labPreferSelectors;+ /** Locale key stem in the `labs` namespace: `features.${i18nKey}.title|desc` */+ i18nKey: LabFeatureI18nKey;+ /** Extra untranslated English synonyms for the settings search index */+ searchKeywords: string[];+ stage: LabStage;+}++/**+ * Single source of truth for the lab experiments: the Labs settings page+ * renders this list (general first, then desktop-only), and the settings+ * search index derives its entries from it — adding a flag here makes it both+ * visible and searchable without a second registration.+ */+export const LAB_FEATURES: LabFeatureItem[] = [+ {+ flag: 'enableAgentGraphConfig',+ i18nKey: 'agentGraphConfig',+ searchKeywords: ['agent graph', 'graph runtime'],+ stage: 'alpha',+ },+ {+ flag: 'enableInputMarkdown',+ i18nKey: 'inputMarkdown',+ searchKeywords: ['markdown', 'input markdown'],+ stage: 'beta',+ },+ {+ flag: 'enableMessageTextSelectionActions',+ i18nKey: 'messageTextSelectionActions',+ searchKeywords: ['text selection', 'quote'],+ stage: 'alpha',+ },+ {+ flag: 'enableSelfLearning',+ i18nKey: 'selfLearning',+ searchKeywords: ['self-evolving', 'self learning', 'rule base'],+ stage: 'alpha',+ },+ {+ flag: 'enableTopicAcceptance',+ i18nKey: 'topicAcceptance',+ searchKeywords: ['acceptance', 'checklist'],+ stage: 'alpha',+ },+ {+ flag: 'enableProjects',+ i18nKey: 'projects',+ searchKeywords: ['project', 'workspace'],+ stage: 'alpha',+ },+ {+ flag: 'enableOAuthApps',+ i18nKey: 'oauthApps',+ searchKeywords: ['oauth', 'oauth apps'],+ stage: 'beta',+ },+ {+ flag: 'enableArtifactDeployment',+ i18nKey: 'artifactDeployment',+ searchKeywords: ['artifact', 'deploy', 'publish'],+ stage: 'beta',+ },+ {+ desktopOnly: true,+ flag: 'enableDesktopSplitView',+ i18nKey: 'desktopSplitView',+ searchKeywords: ['split view', 'split tab'],+ stage: 'alpha',+ },+ {+ desktopOnly: true,+ flag: 'enableImessage',+ i18nKey: 'imessage',+ searchKeywords: ['imessage', 'bluebubbles'],+ stage: 'alpha',+ },+ {+ desktopOnly: true,+ flag: 'enableClaudeCodeSdk',+ i18nKey: 'claudeCodeSdk',+ searchKeywords: ['claude code', 'claude sdk'],+ stage: 'alpha',+ },+ {+ desktopOnly: true,+ flag: 'enableCodexAppServer',+ i18nKey: 'codexAppServer',+ searchKeywords: ['codex', 'app server'],+ stage: 'alpha',+ },+ // rides on the Claude Code hetero-agent stack: scans local CLI transcripts+ // via the Electron main process — desktop only+ {+ desktopOnly: true,+ flag: 'enableHeteroSessionImport',+ i18nKey: 'heteroSessionImport',+ searchKeywords: ['import session', 'claude code', 'codex'],+ stage: 'beta',+ },+ {+ desktopOnly: true,+ flag: 'enableInAppBrowser',+ i18nKey: 'inAppBrowser',+ searchKeywords: ['in-app browser', 'inapp browser', 'embedded browser', 'browser tab'],+ stage: 'beta',+ },+];diff --git a/src/features/Settings/labs/index.tsx b/src/features/Settings/labs/index.tsxindex aeccef8251e..b55523d8222 100644--- a/src/features/Settings/labs/index.tsx+++ b/src/features/Settings/labs/index.tsx@@ -12,9 +12,11 @@ import { useTranslation } from 'react-i18next';import AsyncError from '@/components/AsyncError';import { FORM_STYLE } from '@/const/layoutTokens';import SettingHeader from '@/features/Settings/features/SettingHeader';+import { SettingsSearchAnchor } from '@/features/SettingsSearch/anchor';import { useUserStore } from '@/store/user';import { labPreferSelectors, preferenceSelectors } from '@/store/user/selectors';-import { type UserLab } from '@/types/user';++import { LAB_FEATURES, type LabFeatureItem, type LabStage } from './features';const styles = createStaticStyles(({ css }) => ({labItem: css`@@ -24,13 +26,6 @@ const styles = createStaticStyles(({ css }) => ({`,}));-/**- * Maturity stage of a lab experiment:- * - alpha: internal testing only, not recommended for daily use yet- * - beta: relatively usable — core flow works, details still being polished- */-type LabStage = 'alpha' | 'beta';-const StageTag = memo<{ stage: LabStage }>(({ stage }) => {const { t } = useTranslation('labs');@@ -43,58 +38,20 @@ const StageTag = memo<{ stage: LabStage }>(({ stage }) => {);});-interface LabToggle {- checked: boolean;- desc: string;- flag: keyof UserLab;- stage: LabStage;- title: string;-}-const LabsForm = memo(() => {const { t: tLabs } = useTranslation('labs');- const [- isPreferenceInit,- isUserStateInit,- isUserStateInitError,- refreshUserState,- enableAgentGraphConfig,- enableInputMarkdown,- enableImessage,- enableClaudeCodeSdk,- enableCodexAppServer,- enableDesktopSplitView,- enableHeteroSessionImport,- enableMessageTextSelectionActions,- enableOAuthApps,- enableProjects,- enableInAppBrowser,- enableArtifactDeployment,- enableTopicAcceptance,- enableSelfLearning,- updateLab,- ] = useUserStore((s) => [- preferenceSelectors.isPreferenceInit(s),- s.isUserStateInit,- s.isUserStateInitError,- s.refreshUserState,- labPreferSelectors.enableAgentGraphConfig(s),- labPreferSelectors.enableInputMarkdown(s),- labPreferSelectors.enableImessage(s),- labPreferSelectors.enableClaudeCodeSdk(s),- labPreferSelectors.enableCodexAppServer(s),- labPreferSelectors.enableDesktopSplitView(s),- labPreferSelectors.enableHeteroSessionImport(s),- labPreferSelectors.enableMessageTextSelectionActions(s),- labPreferSelectors.enableOAuthApps(s),- labPreferSelectors.enableProjects(s),- labPreferSelectors.enableInAppBrowser(s),- labPreferSelectors.enableArtifactDeployment(s),- labPreferSelectors.enableTopicAcceptance(s),- labPreferSelectors.enableSelfLearning(s),- s.updateLab,- ]);+ const [isPreferenceInit, isUserStateInit, isUserStateInitError, refreshUserState, updateLab] =+ useUserStore((s) => [+ preferenceSelectors.isPreferenceInit(s),+ s.isUserStateInit,+ s.isUserStateInitError,+ s.refreshUserState,+ s.updateLab,+ ]);+ const labChecked = useUserStore((s) =>+ LAB_FEATURES.map(({ flag }) => labPreferSelectors[flag](s)),+ );if (!isUserStateInit) {// A failed user-state init must show error + Retry, not a permanent skeleton@@ -109,134 +66,37 @@ const LabsForm = memo(() => {return <Skeleton active paragraph={{ rows: 5 }} title={false} />;}- const toFormItem = ({ checked, desc, flag, stage, title }: LabToggle): FormItemProps => ({+ const checkedByFlag = Object.fromEntries(+ LAB_FEATURES.map(({ flag }, index) => [flag, labChecked[index]]),+ );++ const toFormItem = ({ flag, i18nKey, stage }: LabFeatureItem): FormItemProps => ({children: (<Switch- checked={checked}+ checked={checkedByFlag[flag]}loading={!isPreferenceInit}onChange={(next: boolean) => updateLab({ [flag]: next })}/>),className: styles.labItem,- desc,+ desc: tLabs(`features.${i18nKey}.desc`),label: (- <Flexbox horizontal align={'center'} gap={8}>- {title}- <StageTag stage={stage} />- </Flexbox>+ <SettingsSearchAnchor id={`labs-${flag}`}>+ <Flexbox horizontal align={'center'} gap={8}>+ {tLabs(`features.${i18nKey}.title`)}+ <StageTag stage={stage} />+ </Flexbox>+ </SettingsSearchAnchor>),minWidth: undefined,});// Cross-surface experiments. Platform-specific ones (Electron main-process// features) live in the Desktop group below; everything else is General.- const generalItems: LabToggle[] = [- {- checked: enableAgentGraphConfig,- desc: tLabs('features.agentGraphConfig.desc'),- flag: 'enableAgentGraphConfig',- stage: 'alpha',- title: tLabs('features.agentGraphConfig.title'),- },- {- checked: enableInputMarkdown,- desc: tLabs('features.inputMarkdown.desc'),- flag: 'enableInputMarkdown',- stage: 'beta',- title: tLabs('features.inputMarkdown.title'),- },- {- checked: enableMessageTextSelectionActions,- desc: tLabs('features.messageTextSelectionActions.desc'),- flag: 'enableMessageTextSelectionActions',- stage: 'alpha',- title: tLabs('features.messageTextSelectionActions.title'),- },- {- checked: enableSelfLearning,- desc: tLabs('features.selfLearning.desc'),- flag: 'enableSelfLearning',- stage: 'alpha',- title: tLabs('features.selfLearning.title'),- },- {- checked: enableTopicAcceptance,- desc: tLabs('features.topicAcceptance.desc'),- flag: 'enableTopicAcceptance',- stage: 'alpha',- title: tLabs('features.topicAcceptance.title'),- },- {- checked: enableProjects,- desc: tLabs('features.projects.desc'),- flag: 'enableProjects',- stage: 'alpha',- title: tLabs('features.projects.title'),- },- {- checked: enableOAuthApps,- desc: tLabs('features.oauthApps.desc'),- flag: 'enableOAuthApps',- stage: 'beta',- title: tLabs('features.oauthApps.title'),- },- {- checked: enableArtifactDeployment,- desc: tLabs('features.artifactDeployment.desc'),- flag: 'enableArtifactDeployment',- stage: 'beta',- title: tLabs('features.artifactDeployment.title'),- },- ];-+ const generalItems = LAB_FEATURES.filter((feature) => !feature.desktopOnly);// Desktop-only experiments: local agent runtimes, iMessage bridge, and the// in-app browser (renderer-retained Electron webviews).- const desktopItems: LabToggle[] = [- {- checked: enableDesktopSplitView,- desc: tLabs('features.desktopSplitView.desc'),- flag: 'enableDesktopSplitView',- stage: 'alpha',- title: tLabs('features.desktopSplitView.title'),- },- {- checked: enableImessage,- desc: tLabs('features.imessage.desc'),- flag: 'enableImessage',- stage: 'alpha',- title: tLabs('features.imessage.title'),- },- {- checked: enableClaudeCodeSdk,- desc: tLabs('features.claudeCodeSdk.desc'),- flag: 'enableClaudeCodeSdk',- stage: 'alpha',- title: tLabs('features.claudeCodeSdk.title'),- },- {- checked: enableCodexAppServer,- desc: tLabs('features.codexAppServer.desc'),- flag: 'enableCodexAppServer',- stage: 'alpha',- title: tLabs('features.codexAppServer.title'),- },- // rides on the Claude Code hetero-agent stack: scans local CLI- // transcripts via the Electron main process — desktop only- {- checked: enableHeteroSessionImport,- desc: tLabs('features.heteroSessionImport.desc'),- flag: 'enableHeteroSessionImport',- stage: 'beta',- title: tLabs('features.heteroSessionImport.title'),- },- {- checked: enableInAppBrowser,- desc: tLabs('features.inAppBrowser.desc'),- flag: 'enableInAppBrowser',- stage: 'beta',- title: tLabs('features.inAppBrowser.title'),- },- ];+ const desktopItems = LAB_FEATURES.filter((feature) => feature.desktopOnly);const items: FormGroupItemType[] = [{diff --git a/src/features/SettingsSearch/items.test.ts b/src/features/SettingsSearch/items.test.tsnew file mode 100644index 00000000000..0fcf2c67116--- /dev/null+++ b/src/features/SettingsSearch/items.test.ts@@ -0,0 +1,72 @@+import { describe, expect, it } from 'vitest';++import { LAB_FEATURES } from '@/features/Settings/labs/features';+import { SettingsTabs } from '@/store/global/initialState';++import {+ SETTINGS_SEARCH_ITEMS,+ type SettingsSearchContext,+ TAB_SEARCH_EN_KEYWORDS,+ TAB_SEARCH_KEYWORDS_KEYS,+} from './items';++const webContext: SettingsSearchContext = {+ disableEmailPassword: false,+ enableBusinessFeatures: true,+ enableComposio: true,+ enableGatewayMode: true,+ enableSTT: true,+ hasEmail: true,+ hideDocs: false,+ isDesktop: false,+ isLogin: true,+ isWindows: false,+ showAiImage: true,+};++describe('settings search index', () => {+ it('derives one search item per lab feature in catalog order', () => {+ const labsItems = SETTINGS_SEARCH_ITEMS.filter((item) => item.tab === SettingsTabs.Labs);++ expect(labsItems.map((item) => item.anchor)).toEqual(+ LAB_FEATURES.map(({ flag }) => `labs-${flag}`),+ );+ });++ it('hides desktop-only lab features from web search results', () => {+ const labsItems = SETTINGS_SEARCH_ITEMS.filter((item) => item.tab === SettingsTabs.Labs);++ for (const feature of LAB_FEATURES) {+ const item = labsItems.find(({ anchor }) => anchor === `labs-${feature.flag}`)!;+ expect(item.visible?.(webContext) ?? true).toBe(!feature.desktopOnly);+ }+ });++ it('indexes the inbox notification channel', () => {+ expect(SETTINGS_SEARCH_ITEMS.some((item) => item.anchor === 'notification-inbox')).toBe(true);+ });++ it('keeps an English floor for labs and oauth apps tabs', () => {+ expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.Labs]).toContain('experiment');+ expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.OAuthApps]).toContain('oauth');+ expect(TAB_SEARCH_KEYWORDS_KEYS[SettingsTabs.Labs]).toBe('settingsSearch.tabKeywords.labs');+ expect(TAB_SEARCH_KEYWORDS_KEYS[SettingsTabs.OAuthApps]).toBe(+ 'settingsSearch.tabKeywords.oauthApps',+ );+ });++ it('covers the high-volume zero-result phrases as tab keywords', () => {+ expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.Provider]).toEqual(+ expect.arrayContaining(['api', 'model provider', 'language model', 'custom provider']),+ );+ expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.Messenger]).toEqual(+ expect.arrayContaining(['telegram', 'slack', 'discord', 'wechat']),+ );+ expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.ServiceModel]).toEqual(+ expect.arrayContaining(['search', 'tts settings']),+ );+ expect(TAB_SEARCH_EN_KEYWORDS[SettingsTabs.Storage]).toEqual(+ expect.arrayContaining(['knowledge base']),+ );+ });+});diff --git a/src/features/SettingsSearch/items.ts b/src/features/SettingsSearch/items.tsindex fea15b686c1..5a07464c558 100644--- a/src/features/SettingsSearch/items.ts+++ b/src/features/SettingsSearch/items.ts@@ -1,3 +1,4 @@+import { LAB_FEATURES } from '@/features/Settings/labs/features';import { SettingsTabs } from '@/store/global/initialState';export interface SettingsSearchContext {@@ -49,7 +50,7 @@ export interface SettingsSearchItem {export const TAB_SEARCH_EN_KEYWORDS: Partial<Record<SettingsTabs, string[]>> = {[SettingsTabs.About]: ['about', 'version', 'changelog', 'feedback', 'help'],[SettingsTabs.Advanced]: ['advanced', 'developer', 'diagnostics'],- [SettingsTabs.APIKey]: ['api key', 'apikey', 'token', 'secret'],+ [SettingsTabs.APIKey]: ['api', 'api key', 'apikey', 'token', 'secret', 'personal key'],[SettingsTabs.Labels]: ['label', 'labels', 'tag', 'tags', 'group', 'grouping'],[SettingsTabs.Appearance]: ['appearance',@@ -59,6 +60,7 @@ export const TAB_SEARCH_EN_KEYWORDS: Partial<Record<SettingsTabs, string[]>> = {'font','language','color',+ 'background',],[SettingsTabs.Billing]: ['billing', 'payment', 'invoice', 'card', 'transaction'],[SettingsTabs.Connector]: ['connectors', 'integrations', 'mcp', 'oauth'],@@ -68,8 +70,27 @@ export const TAB_SEARCH_EN_KEYWORDS: Partial<Record<SettingsTabs, string[]>> = {[SettingsTabs.Hotkey]: ['hotkey', 'shortcut', 'keyboard'],[SettingsTabs.Labs]: ['labs', 'experiment', 'beta', 'preview', 'developer'],[SettingsTabs.Memory]: ['memory', 'memories', 'personalization'],- [SettingsTabs.Messenger]: ['messenger', 'chat platform', 'bot'],- [SettingsTabs.Notification]: ['notification', 'email', 'push', 'alerts'],+ [SettingsTabs.Messenger]: [+ 'messenger',+ 'chat platform',+ 'bot',+ 'telegram',+ 'slack',+ 'discord',+ 'wechat',+ ],+ [SettingsTabs.Notification]: [+ 'notification',+ 'email',+ 'push',+ 'alerts',+ 'inbox',+ 'telegram',+ 'slack',+ 'discord',+ 'wechat',+ ],+ [SettingsTabs.OAuthApps]: ['oauth', 'oauth apps', 'developer apps'],[SettingsTabs.Plans]: ['subscription', 'plan', 'upgrade', 'pricing', 'membership'],[SettingsTabs.Profile]: ['profile',@@ -85,13 +106,17 @@ export const TAB_SEARCH_EN_KEYWORDS: Partial<Record<SettingsTabs, string[]>> = {'provider','model','llm',+ 'api','api key','apikey','byok','bring your own key','endpoint',+ 'model provider',+ 'language model',+ 'custom provider',],- [SettingsTabs.Proxy]: ['proxy', 'network', 'connection'],+ [SettingsTabs.Proxy]: ['proxy', 'network', 'connection', 'proxy settings'],[SettingsTabs.Referral]: ['referral', 'invite', 'rewards', 'bonus'],[SettingsTabs.ServiceModel]: ['service model',@@ -99,6 +124,7 @@ export const TAB_SEARCH_EN_KEYWORDS: Partial<Record<SettingsTabs, string[]>> = {'topic naming','translation','tts',+ 'tts settings','voice','speech','image',@@ -106,6 +132,8 @@ export const TAB_SEARCH_EN_KEYWORDS: Partial<Record<SettingsTabs, string[]>> = {'embedding','prompt rewrite','suggestion',+ 'search',+ 'search model',],[SettingsTabs.Skill]: ['skill', 'skills', 'plugins', 'tools'],[SettingsTabs.Stats]: ['analytics', 'statistics', 'stats'],@@ -117,10 +145,20 @@ export const TAB_SEARCH_EN_KEYWORDS: Partial<Record<SettingsTabs, string[]>> = {'backup','reset','clear data',+ 'clear storage',+ 'knowledge base','account deletion','delete account',],- [SettingsTabs.SystemTools]: ['system tools', 'built-in tools'],+ [SettingsTabs.SystemTools]: [+ 'system tools',+ 'built-in tools',+ 'system',+ 'node',+ 'python',+ 'cli',+ 'environment',+ ],[SettingsTabs.Usage]: ['usage', 'consumption', 'quota', 'spend', 'statistics'],};@@ -143,9 +181,11 @@ export const TAB_SEARCH_KEYWORDS_KEYS: Partial<Record<SettingsTabs, string>> = {[SettingsTabs.Devices]: 'settingsSearch.tabKeywords.devices',[SettingsTabs.Labels]: 'settingsSearch.tabKeywords.labels',[SettingsTabs.Hotkey]: 'settingsSearch.tabKeywords.hotkey',+ [SettingsTabs.Labs]: 'settingsSearch.tabKeywords.labs',[SettingsTabs.Memory]: 'settingsSearch.tabKeywords.memory',[SettingsTabs.Messenger]: 'settingsSearch.tabKeywords.messenger',[SettingsTabs.Notification]: 'settingsSearch.tabKeywords.notification',+ [SettingsTabs.OAuthApps]: 'settingsSearch.tabKeywords.oauthApps',[SettingsTabs.Plans]: 'settingsSearch.tabKeywords.plans',[SettingsTabs.Profile]: 'settingsSearch.tabKeywords.profile',[SettingsTabs.Provider]: 'settingsSearch.tabKeywords.provider',@@ -351,6 +391,18 @@ export const SETTINGS_SEARCH_ITEMS: SettingsSearchItem[] = [tab: SettingsTabs.Advanced,visible: (ctx) => ctx.isDesktop,},+ // Labs — derived from the LAB_FEATURES catalog the page renders, so a new+ // lab flag becomes searchable without a second registration. Anchors use+ // `labs-${flag}`, matching the SettingsSearchAnchor wrap on each toggle.+ ...LAB_FEATURES.map(({ desktopOnly, flag, i18nKey, searchKeywords }): SettingsSearchItem => ({+ anchor: `labs-${flag}`,+ descKey: `features.${i18nKey}.desc`,+ keywords: searchKeywords,+ labelKey: `features.${i18nKey}.title`,+ ns: 'labs',+ tab: SettingsTabs.Labs,+ ...(desktopOnly ? { visible: (ctx: SettingsSearchContext) => ctx.isDesktop } : {}),+ })),// Service Model{anchor: 'service-model-assignments',@@ -372,7 +424,7 @@ export const SETTINGS_SEARCH_ITEMS: SettingsSearchItem[] = [},{anchor: 'service-model-tts',- keywords: ['tts', 'voice', 'speech', 'text to speech'],+ keywords: ['tts', 'tts settings', 'voice', 'speech', 'text to speech'],labelKey: 'settingTTS.openai.ttsModel',tab: SettingsTabs.ServiceModel,visible: (ctx) => ctx.enableSTT,@@ -601,6 +653,12 @@ export const SETTINGS_SEARCH_ITEMS: SettingsSearchItem[] = [tab: SettingsTabs.Usage,},// Notification+ {+ anchor: 'notification-inbox',+ keywords: ['inbox', 'in-app notification'],+ labelKey: 'notification.inbox.title',+ tab: SettingsTabs.Notification,+ },{anchor: 'notification-email',keywords: ['email'],diff --git a/src/features/SettingsSearch/matcher.test.ts b/src/features/SettingsSearch/matcher.test.tsindex e18d82d8127..9770ba15790 100644--- a/src/features/SettingsSearch/matcher.test.ts+++ b/src/features/SettingsSearch/matcher.test.ts@@ -1,6 +1,11 @@import { describe, expect, it } from 'vitest';-import { createSettingsSearchFuse, MAX_SEARCH_RESULTS } from './matcher';+import {+ createSettingsSearchFuse,+ MAX_SEARCH_RESULTS,+ searchSettingsIndex,+ tokenizeSettingsQuery,+} from './matcher';const entries = [{ haystack: ['appearance', 'theme', '主题', 'zhuti', 'zt'], key: 'tab-appearance' },@@ -12,8 +17,15 @@ const entries = [haystack: ['storage', 'clear all session messages and reset the database'],key: 'tab-storage',},+ { haystack: ['api', 'api key', 'apikey'], key: 'tab-agent-apikey' },+ { haystack: ['provider', 'model', 'api', 'model provider'], key: 'tab-agent-provider' },+ { haystack: ['newapi', 'new api'], key: 'provider-newapi' },+ { haystack: ['search1api'], key: 'provider-search1api' },+ { haystack: ['tts', 'voice', 'speech'], key: 'item-service-model-tts' },];+const fuse = createSettingsSearchFuse(entries);+const search = (query: string) =>createSettingsSearchFuse(entries).search(query, { limit: MAX_SEARCH_RESULTS })@@ -44,3 +56,46 @@ describe('createSettingsSearchFuse', () => {expect(search('banana')).toEqual([]);});});++describe('tokenizeSettingsQuery', () => {+ it('splits on spaces', () => {+ expect(tokenizeSettingsQuery('model provider')).toEqual(['model', 'provider']);+ });++ it('splits latin/CJK compounds', () => {+ expect(tokenizeSettingsQuery('tts设置')).toEqual(['tts', '设置']);+ });++ it('drops single-character tokens', () => {+ expect(tokenizeSettingsQuery('a api')).toEqual(['api']);+ });+});++describe('searchSettingsIndex', () => {+ it('keeps tab and item hits above provider-name collisions for generic tokens', () => {+ const keys = searchSettingsIndex(fuse, 'api').map((entry) => entry.key);++ expect(keys[0]).toBe('tab-agent-apikey');+ expect(keys).toContain('tab-agent-provider');+ expect(keys.indexOf('tab-agent-apikey')).toBeLessThan(keys.indexOf('provider-newapi'));+ expect(keys.indexOf('tab-agent-provider')).toBeLessThan(keys.indexOf('provider-newapi'));+ });++ it('does not demote a provider when the query is its name', () => {+ expect(searchSettingsIndex(fuse, 'newapi').map((entry) => entry.key)[0]).toBe(+ 'provider-newapi',+ );+ });++ it('matches a multi-word query against per-field keywords', () => {+ expect(searchSettingsIndex(fuse, 'model provider').map((entry) => entry.key)).toContain(+ 'tab-agent-provider',+ );+ });++ it('falls back to the latin token in a CJK compound like tts设置', () => {+ expect(searchSettingsIndex(fuse, 'tts设置').map((entry) => entry.key)).toContain(+ 'item-service-model-tts',+ );+ });+});diff --git a/src/features/SettingsSearch/matcher.ts b/src/features/SettingsSearch/matcher.tsindex 6d8990b04db..863bd914bfc 100644--- a/src/features/SettingsSearch/matcher.ts+++ b/src/features/SettingsSearch/matcher.ts@@ -1,8 +1,10 @@-import Fuse from 'fuse.js';+import Fuse, { type FuseResult } from 'fuse.js';export interface SearchableEntry {/** Lowercased searchable texts (label / desc / keywords / pinyin variants) */haystack: string[];+ /** Result key (`tab-*` / `item-*` / `provider-*` / `connector-*`) */+ key: string;}/**@@ -11,6 +13,32 @@ export interface SearchableEntry {*/export const MAX_SEARCH_RESULTS = 20;+/**+ * Short tokens that are also substrings of many provider ids (`newapi`,+ * `search1api`, `cometapi`). Exact keyword hits on tabs/items must outrank+ * those name collisions.+ */+export const GENERIC_PROVIDER_QUERIES = new Set(['ai', 'api', 'key', 'model']);++export type SettingsSearchResultKind = 'connector' | 'item' | 'provider' | 'tab';++const KIND_RANK: Record<SettingsSearchResultKind, number> = {+ connector: 2,+ item: 1,+ provider: 3,+ tab: 0,+};++/**+ * Result keys are prefixed by their index source.+ */+export const getSettingsSearchResultKind = (resultKey: string): SettingsSearchResultKind => {+ if (resultKey.startsWith('item-')) return 'item';+ if (resultKey.startsWith('provider-')) return 'provider';+ if (resultKey.startsWith('connector-')) return 'connector';+ return 'tab';+};+/*** Fuzzy matcher over the settings index. Compared to the ChatInput Fuse usages* (threshold 0.3–0.4 over short command labels), the settings haystack includes@@ -23,6 +51,98 @@ export const MAX_SEARCH_RESULTS = 20;export const createSettingsSearchFuse = <T extends SearchableEntry>(entries: T[]) =>new Fuse(entries, {ignoreLocation: true,+ // rankHits breaks kind-rank ties by score, so scores must be real numbers+ // rather than the undefined Fuse returns by default+ includeScore: true,keys: ['haystack'],threshold: 0.35,});++/**+ * Split a query so `model provider` and `tts设置` can fall back to per-token+ * matches when the whole string misses. Does not enable Fuse extended-search+ * (quotes / `=` / `!` would hijack real user input like `a'pi`).+ */+export const tokenizeSettingsQuery = (query: string): string[] => {+ const normalized = query.trim().toLowerCase();+ if (!normalized) return [];++ return normalized+ .split(+ /(?<=\p{Script=Han})(?=[\p{Script=Latin}\p{Nd}])|(?<=[\p{Script=Latin}\p{Nd}])(?=\p{Script=Han})|\s+/u,+ )+ .map((token) => token.trim())+ .filter((token) => token.length >= 2);+};++interface RankedHit<T> {+ item: T;+ score: number;+}++const toHits = <T>(results: FuseResult<T>[]): RankedHit<T>[] =>+ results.map((result) => ({ item: result.item, score: result.score ?? 0 }));++const intersectTokenHits = <T extends SearchableEntry>(+ fuse: Fuse<T>,+ tokens: string[],+): RankedHit<T>[] => {+ const [first, ...rest] = tokens;+ if (!first) return [];++ const firstHits = toHits(fuse.search(first, { limit: MAX_SEARCH_RESULTS * 2 }));+ if (rest.length === 0) return firstHits;++ const restKeys = rest.map(+ (token) =>+ new Set(fuse.search(token, { limit: MAX_SEARCH_RESULTS * 2 }).map((hit) => hit.item.key)),+ );++ return firstHits.filter((hit) => restKeys.every((keys) => keys.has(hit.item.key)));+};++const rankHits = <T extends SearchableEntry>(hits: RankedHit<T>[], query: string): T[] => {+ const normalized = query.trim().toLowerCase();+ const shouldDemoteProviders = GENERIC_PROVIDER_QUERIES.has(normalized);++ const ordered = shouldDemoteProviders+ ? [...hits].sort((left, right) => {+ const kindDelta =+ KIND_RANK[getSettingsSearchResultKind(left.item.key)] -+ KIND_RANK[getSettingsSearchResultKind(right.item.key)];+ if (kindDelta !== 0) return kindDelta;+ return left.score - right.score;+ })+ : hits;++ return ordered.slice(0, MAX_SEARCH_RESULTS).map((hit) => hit.item);+};++/**+ * Search the settings index: full query first, then token-AND, then the first+ * token. Generic tokens like `api` keep tab/item hits above provider-name+ * collisions.+ */+export const searchSettingsIndex = <T extends SearchableEntry>(+ fuse: Fuse<T>,+ query: string,+): T[] => {+ const raw = query.trim();+ if (!raw) return [];++ const primary = toHits(fuse.search(raw, { limit: MAX_SEARCH_RESULTS }));+ if (primary.length > 0) return rankHits(primary, raw);++ const tokens = tokenizeSettingsQuery(raw);+ if (tokens.length > 1) {+ const andHits = intersectTokenHits(fuse, tokens);+ if (andHits.length > 0) return rankHits(andHits, raw);+ }++ const fallbackToken = tokens[0];+ if (fallbackToken && fallbackToken !== raw.toLowerCase()) {+ return rankHits(toHits(fuse.search(fallbackToken, { limit: MAX_SEARCH_RESULTS })), raw);+ }++ return [];+};diff --git a/src/features/SettingsSearch/useSettingsSearch.ts b/src/features/SettingsSearch/useSettingsSearch.tsindex 82efdf872b9..ec56b4e2803 100644--- a/src/features/SettingsSearch/useSettingsSearch.ts+++ b/src/features/SettingsSearch/useSettingsSearch.ts@@ -4,6 +4,7 @@ import { DEFAULT_MODEL_PROVIDER_LIST } from 'model-bank/modelProviders';import { useEffect, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';+import { SUPPORTED_MESSENGER_PLATFORMS } from '@/features/Messenger/constants';import { useCategory } from '@/features/Settings/hooks/useCategory';import { SettingsTabs } from '@/store/global/initialState';import {@@ -21,7 +22,7 @@ import {TAB_SEARCH_EN_KEYWORDS,TAB_SEARCH_KEYWORDS_KEYS,} from './items';-import { createSettingsSearchFuse, MAX_SEARCH_RESULTS } from './matcher';+import { createSettingsSearchFuse, searchSettingsIndex } from './matcher';import { containsHan, loadPinyinTexts, type PinyinTexts } from './pinyin';export interface SettingsSearchResult {@@ -176,6 +177,25 @@ export const useSettingsSearch = (});}+ // IM notification channels (Telegram / Slack / …) live on the notification+ // page with per-platform anchors. Index them from the same catalog the page+ // renders so a search for the platform name deep-links to that row.+ const notificationTab = visibleTabs.get(SettingsTabs.Notification);+ if (notificationTab)+ for (const platform of SUPPORTED_MESSENGER_PLATFORMS) {+ entries.push({+ anchor: `notification-${platform.id}`,+ breadcrumb: `${notificationTab.groupTitle} › ${notificationTab.label}`,+ haystack: [platform.name.toLowerCase(), platform.id.toLowerCase(), 'messenger', 'im'],+ icon: notificationTab.icon,+ key: `item-notification-${platform.id}`,+ label: platform.name,+ pinyinBase: [platform.name.toLowerCase()],+ tab: SettingsTabs.Notification,+ url: `${notificationTab.url}#notification-${platform.id}`,+ });+ }+// Builtin OAuth connectors (Notion, GitHub, …): searching a connector name// should land on the connector page. The page has no per-connector deep// link, so these navigate to the tab itself. Availability ultimately@@ -266,9 +286,9 @@ export const useSettingsSearch = (const q = query.trim();if (!q) return [];- return fuse- .search(q, { limit: MAX_SEARCH_RESULTS })- .map(({ item: { haystack: _h, pinyinBase: _p, ...result } }) => result);+ return searchSettingsIndex(fuse, q).map(+ ({ haystack: _h, pinyinBase: _p, ...result }) => result,+ );}, [query, fuse]);return { isIndexing: needsPinyin && !pinyin.settled, results };