diff --git a/apps/android/src/screens/bot/ds-bot-settings-screen.tsx b/apps/android/src/screens/bot/ds-bot-settings-screen.tsx
index fe0ddf7..481cb3a 100644
--- a/apps/android/src/screens/bot/ds-bot-settings-screen.tsx
+++ b/apps/android/src/screens/bot/ds-bot-settings-screen.tsx
@@ -1,7 +1,6 @@
-import { useCallback, useEffect, useMemo, useState } from 'react'
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import {
ActivityIndicator,
- Alert,
Modal,
Pressable,
ScrollView,
@@ -9,6 +8,7 @@ import {
Text,
View,
} from 'react-native'
+import { Alert } from '../../ui/alert'
import {
Bot,
CalendarClock,
@@ -121,12 +121,12 @@ interface TabItem {
}
const KNOWN_LOCAL_AGENTS = [
- { id: 'claude', name: 'Claude Code', cmd: 'claude-agent-acp', desc: 'Anthropic Claude Code 命令行 Agent' },
- { id: 'codex', name: 'Codex', cmd: 'codex', desc: 'OpenAI Codex 本地编码 Agent' },
- { id: 'opencode', name: 'OpenCode', cmd: 'opencode', desc: 'OpenCode 终端编码 Agent' },
- { id: 'hermes', name: 'Hermes Agent', cmd: 'hermes', desc: 'Nous Research Hermes 本地 Agent' },
- { id: 'cursor', name: 'Cursor Agent', cmd: 'cursor-agent', desc: 'Cursor 命令行编码 Agent' },
- { id: 'pi', name: 'Pi', cmd: 'pi-acp', desc: 'Pi 极简命令行 Agent' },
+ { id: 'claude', name: 'Claude Code', cmd: 'claude-agent-acp', get desc() { return s.dsBotSettings.localAgentDescriptions.claude } },
+ { id: 'codex', name: 'Codex', cmd: 'codex', get desc() { return s.dsBotSettings.localAgentDescriptions.codex } },
+ { id: 'opencode', name: 'OpenCode', cmd: 'opencode', get desc() { return s.dsBotSettings.localAgentDescriptions.opencode } },
+ { id: 'hermes', name: 'Hermes Agent', cmd: 'hermes', get desc() { return s.dsBotSettings.localAgentDescriptions.hermes } },
+ { id: 'cursor', name: 'Cursor Agent', cmd: 'cursor-agent', get desc() { return s.dsBotSettings.localAgentDescriptions.cursor } },
+ { id: 'pi', name: 'Pi', cmd: 'pi-acp', get desc() { return s.dsBotSettings.localAgentDescriptions.pi } },
]
const FALLBACK_PREVIEW_STATE: BotState = parseBotState({
@@ -166,6 +166,7 @@ export function DsBotSettingsModal({
const { contentMaxWidth, landscape } = useResponsiveLayout()
const isDark = scheme === 'dark'
+ const language = useAppStore(store => store.language)
const connected = useAppStore(store => store.connection.phase === 'connected')
const selectedDevice = useAppStore(store => store.selectedDevice)
const state = useBotTeamStore(store => store.state)
@@ -237,10 +238,27 @@ export function DsBotSettingsModal({
}
}, [dsBotBundle, enablingPlugin, handleRetryAll])
+ const prevVisibleRef = useRef(false)
+ const prevInitialTabRef = useRef(initialTab)
+ const prevConnectedRef = useRef(connected)
useEffect(() => {
- if (!visible) return
- setSubpage(initialTab ?? null)
- void checkDsBotPluginStatus()
+ if (!visible) {
+ prevVisibleRef.current = false
+ prevConnectedRef.current = connected
+ return
+ }
+ const justOpened = !prevVisibleRef.current
+ const initialTabChanged = prevInitialTabRef.current !== initialTab
+ const connectionChanged = prevConnectedRef.current !== connected
+ prevVisibleRef.current = true
+ prevInitialTabRef.current = initialTab
+ prevConnectedRef.current = connected
+ if (justOpened || initialTabChanged) {
+ setSubpage(initialTab ?? null)
+ }
+ if (justOpened || connectionChanged) {
+ void checkDsBotPluginStatus()
+ }
if (connected && !state) {
void refresh(true)
}
@@ -283,33 +301,43 @@ export function DsBotSettingsModal({
const tabs: TabItem[] = useMemo(
() => [
- { id: 'general', label: s.bots.tabGeneral, detail: '默认模型、回复体验与工作文件夹', icon: SlidersHorizontal },
- { id: 'models', label: s.bots.tabModels, detail: '模型服务商、API 密钥与本地服务', icon: Cpu },
- { id: 'local-agents', label: s.bots.tabLocalAgents, detail: 'Claude Code、Codex、OpenCode 与原生会话', icon: Terminal },
- { id: 'bots', label: s.bots.tabBots, detail: '主 Bot、动画风格与团队成员管理', icon: Bot },
- { id: 'groups', label: s.bots.tabGroups, detail: '多 Bot 协作群聊、管理员与回复模式', icon: Users },
- { id: 'connectors', label: s.bots.tabConnectors, detail: 'GitHub、邮箱、Notion、Linear 等第三方服务', icon: Plug },
- { id: 'im', label: s.bots.tabIm, detail: '微信、飞书、钉钉、企微、QQ、Telegram 等平台', icon: MessageSquareShare },
- { id: 'capabilities', label: s.bots.tabCapabilities, detail: '按 Bot 配置工具权限与共享技能', icon: Sparkles },
- { id: 'browser', label: s.bots.tabBrowser, detail: '网页自动化与站点敏感操作预授权', icon: Globe },
- { id: 'computer', label: s.bots.tabComputer, detail: '屏幕查看与键鼠操控权限等级', icon: Monitor },
- { id: 'schedules', label: s.bots.tabSchedules, detail: '周期性简报、定时提醒与自动任务', icon: CalendarClock },
- { id: 'usage', label: s.bots.tabUsage, detail: 'Token 走势、缓存命中率与年度活跃度', icon: ChartNoAxesColumn },
- { id: 'secrets', label: s.bots.tabSecrets, detail: 'Bot 环境变量密钥与访问范围', icon: KeyRound },
+ { id: 'general', label: s.bots.tabGeneral, detail: s.dsBotSettings.tabDetail.general, icon: SlidersHorizontal },
+ { id: 'models', label: s.bots.tabModels, detail: s.dsBotSettings.tabDetail.models, icon: Cpu },
+ { id: 'local-agents', label: s.bots.tabLocalAgents, detail: s.dsBotSettings.tabDetail.localAgents, icon: Terminal },
+ { id: 'bots', label: s.bots.tabBots, detail: s.dsBotSettings.tabDetail.bots, icon: Bot },
+ { id: 'groups', label: s.bots.tabGroups, detail: s.dsBotSettings.tabDetail.groups, icon: Users },
+ { id: 'connectors', label: s.bots.tabConnectors, detail: s.dsBotSettings.tabDetail.connectors, icon: Plug },
+ { id: 'im', label: s.bots.tabIm, detail: s.dsBotSettings.tabDetail.im, icon: MessageSquareShare },
+ { id: 'capabilities', label: s.bots.tabCapabilities, detail: s.dsBotSettings.tabDetail.capabilities, icon: Sparkles },
+ { id: 'browser', label: s.bots.tabBrowser, detail: s.dsBotSettings.tabDetail.browser, icon: Globe },
+ { id: 'computer', label: s.bots.tabComputer, detail: s.dsBotSettings.tabDetail.computer, icon: Monitor },
+ { id: 'schedules', label: s.bots.tabSchedules, detail: s.dsBotSettings.tabDetail.schedules, icon: CalendarClock },
+ { id: 'usage', label: s.bots.tabUsage, detail: s.dsBotSettings.tabDetail.usage, icon: ChartNoAxesColumn },
+ { id: 'secrets', label: s.bots.tabSecrets, detail: s.dsBotSettings.tabDetail.secrets, icon: KeyRound },
],
- [],
+ [language],
)
const usageView = useMemo(
() => buildDsBotUsageView(usageData, usageRange),
- [usageData, usageRange],
+ [usageData, usageRange, language],
)
const activityYear = useMemo(
() => buildDsBotActivityYear(usageData, 24),
[usageData],
)
- if (!visible) return null
+ const [contentMounted, setContentMounted] = useState(visible)
+ useEffect(() => {
+ if (visible) {
+ setContentMounted(true)
+ return
+ }
+ const timer = setTimeout(() => setContentMounted(false), 320)
+ return () => clearTimeout(timer)
+ }, [visible])
+
+ if (!visible && !contentMounted) return null
const prefs = object(effectiveState.prefs)
const showThinking = prefs.thinking !== false && prefs.showThinking !== false
@@ -347,40 +375,40 @@ export function DsBotSettingsModal({
? folderBasename(effectiveState.workspaceId)
: defaultBotModel
? defaultBotModel.split('/').pop() ?? ''
- : '默认'
+ : s.dsBotSettings.defaultValue
case 'models':
- return configuredProviderCount > 0 ? `${configuredProviderCount} 个服务商` : `${effectiveState.models.length} 个模型`
+ return configuredProviderCount > 0 ? s.dsBotSettings.providersCount(configuredProviderCount) : s.dsBotSettings.modelsCount(effectiveState.models.length)
case 'local-agents': {
const det = objects(localAgentsData?.detected).filter(d => d.installed === true || d.available === true).length
const dshCount = effectiveState.agents.length
- return det + dshCount > 0 ? `已启用 ${det + dshCount}` : `${KNOWN_LOCAL_AGENTS.length} 项`
+ return det + dshCount > 0 ? s.dsBotSettings.enabledCount(det + dshCount) : s.dsBotSettings.agentsCount(KNOWN_LOCAL_AGENTS.length)
}
case 'bots':
- return `${mainBotName} · ${effectiveState.bots.length} 个`
+ return s.dsBotSettings.botsSummary(mainBotName, effectiveState.bots.length)
case 'groups':
- return `${effectiveState.rooms.length} 个`
+ return s.dsBotSettings.groupsCount(effectiveState.rooms.length)
case 'connectors':
return connectedConnectorItems.length > 0
- ? `已连接 ${connectedConnectorItems.length}`
- : `${DS_BOT_CONNECTOR_CATALOG.length} 个`
+ ? s.dsBotSettings.connectedCount(connectedConnectorItems.length)
+ : s.dsBotSettings.connectorsCount(DS_BOT_CONNECTOR_CATALOG.length)
case 'im':
- return connectedImList.length > 0 ? `已连接 ${connectedImList.length}` : '8 个平台'
+ return connectedImList.length > 0 ? s.dsBotSettings.connectedCount(connectedImList.length) : s.dsBotSettings.platformsCount(8)
case 'capabilities':
return (effectiveState.capabilities ?? []).length > 0
- ? `${(effectiveState.capabilities ?? []).length} 项能力`
- : '按 Bot 授权'
+ ? s.dsBotSettings.capabilitiesCount((effectiveState.capabilities ?? []).length)
+ : s.dsBotSettings.perBotAccess
case 'browser':
- return totalBrowserGrants > 0 ? `${totalBrowserGrants} 项预授权` : '无预授权'
+ return totalBrowserGrants > 0 ? s.dsBotSettings.browserGrantsCount(totalBrowserGrants) : s.dsBotSettings.noBrowserGrants
case 'computer':
- return effectiveState.computer?.enabled === true ? '已开启' : '关'
+ return effectiveState.computer?.enabled === true ? s.dsBotSettings.on : s.dsBotSettings.off
case 'schedules':
- return '管理任务'
+ return s.dsBotSettings.manageTasks
case 'usage':
return usageView.current.tokens > 0
? `${formatCompactTokens(usageView.current.tokens)} Token`
- : '查看统计'
+ : s.dsBotSettings.viewStats
case 'secrets':
- return `${(effectiveState.secrets ?? []).length} 个`
+ return s.dsBotSettings.secretsCount((effectiveState.secrets ?? []).length)
}
}
@@ -407,21 +435,21 @@ export function DsBotSettingsModal({
if (!connected) {
return (
- DS Bot 插件状态
+ {s.dsBotSettings.pluginStatus}
- void handleRetryAll()} />
+ void handleRetryAll()} />
)
}
@@ -429,24 +457,24 @@ export function DsBotSettingsModal({
if (isPluginDisabled) {
return (
- DS Bot 插件状态
+ {s.dsBotSettings.pluginStatus}
void handleEnableDsBot()}
/>
setPluginsModalOpen(true)}
/>
@@ -459,7 +487,7 @@ export function DsBotSettingsModal({
- 正在检测电脑端 DS Bot 插件状态…
+ {s.dsBotSettings.checkingPlugin}
)
@@ -468,7 +496,7 @@ export function DsBotSettingsModal({
if (isPluginNotInstalled) {
return (
- 未检测到 DS Bot 插件
+ {s.dsBotSettings.pluginNotFound}
void handleRetryAll()}
@@ -477,8 +505,8 @@ export function DsBotSettingsModal({
setPluginsModalOpen(true)}
/>
@@ -490,7 +518,7 @@ export function DsBotSettingsModal({
}
return (
-
+
+ {isLiveState && visibleError !== undefined && (
+ {visibleError}
+ )}
{/* ==================== LEVEL 1: SETTINGS-STYLE INDEX PAGE ==================== */}
{subpage === null && (
<>
{renderPrerequisiteNotice()}
- 基础与模型
+ {s.dsBotSettings.sectionBasics}
{tabs.slice(0, 3).map((item, idx) => (
- 团队与协作
+ {s.dsBotSettings.sectionTeam}
{tabs.slice(3, 5).map((item, idx) => (
- 连接器与消息渠道
+ {s.dsBotSettings.sectionChannels}
{tabs.slice(5, 7).map((item, idx) => (
- 能力与操作授权
+ {s.dsBotSettings.sectionPermissions}
{tabs.slice(7, 10).map((item, idx) => (
- 任务、统计与密钥
+ {s.dsBotSettings.sectionTasks}
{tabs.slice(10, 13).map((item, idx) => (
@@ -612,20 +643,20 @@ export function DsBotSettingsModal({
first
icon={Cpu}
label={s.bots.defaultModel}
- detail="新建 Bot 时默认使用的模型"
- value={defaultBotModel ? defaultBotModel.split('/').pop() : '默认'}
+ detail={s.dsBotSettings.defaultModelDetail}
+ value={defaultBotModel ? defaultBotModel.split('/').pop() : s.dsBotSettings.defaultValue}
chevron
onPress={() => setDefaultModelPickerOpen(true)}
/>
- 对话与回复
+ {s.dsBotSettings.sectionConversation}
- 位置
+ {s.dsBotSettings.sectionLocation}
setTeamFolderPickerOpen(true)}
/>
- 各 Bot 自己的文件夹
+ {s.dsBotSettings.sectionBotFolders}
{effectiveState.bots.map((bot, idx) => (
0 && (
<>
- {`删除后仍受保护 · ${(effectiveState.privateArchives ?? []).length}`}
+ {s.dsBotSettings.protectedArchives((effectiveState.privateArchives ?? []).length)}
{(effectiveState.privateArchives ?? []).map((arc, idx) => (
))}
@@ -708,7 +739,7 @@ export function DsBotSettingsModal({
{/* 2. 模型 (Models / ProvidersPage) */}
{subpage === 'models' && (
<>
- 已配置服务商
+ {s.dsBotSettings.sectionConfiguredProviders}
{(() => {
const list =
providersData && providersData.length > 0
@@ -736,7 +767,7 @@ export function DsBotSettingsModal({
first
icon={Cpu}
label={s.bots.noModel}
- detail="请在电脑端 DS Bot 设置中添加模型服务商或配置 API Key"
+ detail={s.dsBotSettings.noProviderDetail}
chevron={false}
/>
@@ -754,7 +785,7 @@ export function DsBotSettingsModal({
{pname}
- {pmodels.length} 个模型 · {configured ? '已配置密钥' : '需要 API Key'}
+ {`${s.dsBotSettings.modelsCount(pmodels.length)} · ${configured ? s.dsBotSettings.keyConfigured : s.dsBotSettings.apiKeyRequired}`}
@@ -775,7 +806,7 @@ export function DsBotSettingsModal({
})
})()}
- 常用服务商
+ {s.dsBotSettings.sectionPopularProviders}
{DS_BOT_POPULAR_PROVIDERS.map((prov, idx) => {
const isConfigured =
@@ -788,14 +819,14 @@ export function DsBotSettingsModal({
icon={Cpu}
label={prov.name}
detail={prov.desc}
- value={isConfigured ? '已就绪' : '在电脑端配置'}
+ value={isConfigured ? s.dsBotSettings.ready : s.dsBotSettings.configureOnComputer}
chevron={false}
/>
)
})}
- 本地模型服务
+ {s.dsBotSettings.sectionLocalServers}
{DS_BOT_LOCAL_SERVERS.map((srv, idx) => (
))}
@@ -816,17 +847,17 @@ export function DsBotSettingsModal({
{subpage === 'local-agents' && (
<>
- 将电脑上已安装的命令行编码 Agent 接入 DS Bot,各 Bot 可直接选用其作为底层运行模型。
+ {s.dsBotSettings.localAgentsNote}
- DeepSeek Harness 原生会话
+ {s.dsBotSettings.sectionNativeSessions}
0 ? '已添加' : '未添加'}
+ detail={s.dsBotSettings.dshAgentDetail}
+ value={effectiveState.agents.length > 0 ? s.dsBotSettings.added : s.dsBotSettings.notAdded}
disabled={!isLiveState || busy}
onPress={() => {
if (effectiveState.agents[0]) {
@@ -838,7 +869,7 @@ export function DsBotSettingsModal({
/>
- 本地编码 Agent
+ {s.dsBotSettings.sectionLocalAgents}
{KNOWN_LOCAL_AGENTS.map((agent, idx) => {
const detectedList = objects(localAgentsData?.detected)
@@ -855,7 +886,7 @@ export function DsBotSettingsModal({
icon={Terminal}
label={agent.name}
detail={ver ? `${agent.desc} · ${ver}` : `${agent.desc} (${text(matched?.command) || agent.cmd})`}
- value={ready ? '已就绪' : '未检测到'}
+ value={ready ? s.dsBotSettings.ready : s.dsBotSettings.notDetected}
chevron={false}
/>
)
@@ -871,8 +902,8 @@ export function DsBotSettingsModal({
{s.bots.botAnimation}
- 聊天与状态栏中 Bot 头像的呼吸和工作动效。
+ {s.dsBotSettings.motionDetail}
{([
@@ -959,7 +990,7 @@ export function DsBotSettingsModal({
)}
{(bot.main || bot.id === effectiveState.mainBotId) && (
- 主 Bot
+ {s.dsBotSettings.mainBot}
)}
{bot.private && (
@@ -969,7 +1000,7 @@ export function DsBotSettingsModal({
)}
- {bot.instructions || (bot.model || effectiveState.defaultModel) || '点击管理模型、指令与文件夹'}
+ {bot.instructions || (bot.model || effectiveState.defaultModel) || s.dsBotSettings.botCardHint}
@@ -1025,14 +1056,14 @@ export function DsBotSettingsModal({
}
>
- {`群聊 · ${effectiveState.rooms.length}`}
+ {s.dsBotSettings.groupsTitle(effectiveState.rooms.length)}
{effectiveState.rooms.length === 0 ? (
- 还没有群聊。
- 在群聊里,几个 Bot 和你一起做一件事。
+ {s.dsBotSettings.noGroups}
+ {s.dsBotSettings.noGroupsHint}
) : (
effectiveState.rooms.map((room, idx) => {
@@ -1062,7 +1093,7 @@ export function DsBotSettingsModal({
{memberNames || `${room.members.length} ${s.bots.members}`}
- {`${room.members.length} 成员`}
+ {s.dsBotSettings.membersCount(room.members.length)}
{isLiveState && !effectiveState.readOnly && (
@@ -1159,7 +1190,7 @@ export function DsBotSettingsModal({
setMainBotPickerOpen(false)}>
- 选择主 Bot
+ {s.dsBotSettings.chooseMainBot}
setMainBotPickerOpen(false)} />
@@ -1420,4 +1451,13 @@ const createStyles = (colors: ThemeColors) =>
fontSize: 18,
color: colors.ink,
},
+ errorBanner: {
+ fontSize: 13.5,
+ lineHeight: 19,
+ color: colors.danger,
+ paddingHorizontal: 14,
+ paddingVertical: 10,
+ borderRadius: radius.md,
+ backgroundColor: colors.dangerSoft,
+ },
})