From 5bfbd70b2bda731b96f51885f0752a3b4660c38d Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Mon, 23 Mar 2026 18:07:02 +0800 Subject: [PATCH] refactor: rename AI Gateway UI copy to LLM API --- lib/app/app_controller_desktop.dart | 64 +++++++++---------- lib/app/app_controller_web.dart | 4 +- lib/app/ui_feature_manifest.dart | 4 +- lib/data/mock_data.dart | 4 +- lib/features/assistant/assistant_page.dart | 8 +-- lib/features/modules/modules_page.dart | 12 ++-- .../settings/codex_integration_card.dart | 2 +- lib/features/settings/settings_page.dart | 18 +++--- lib/models/app_models.dart | 10 +-- lib/runtime/multi_agent_mounts.dart | 8 +-- lib/runtime/runtime_controllers.dart | 28 ++++---- lib/runtime/runtime_models.dart | 2 +- lib/web/web_ai_gateway_client.dart | 6 +- lib/web/web_assistant_page.dart | 4 +- lib/web/web_settings_page.dart | 8 +-- lib/widgets/assistant_focus_panel.dart | 8 +-- lib/widgets/sidebar_navigation.dart | 2 +- test/features/ai_gateway_page_suite.dart | 4 +- test/features/modules_page_suite.dart | 2 +- ...settings_ai_gateway_persistence_suite.dart | 6 +- .../app_controller_ai_gateway_chat_suite.dart | 2 +- ...pp_controller_ai_gateway_models_suite.dart | 4 +- ...troller_execution_target_switch_suite.dart | 4 +- ...ings_controller_ai_gateway_sync_suite.dart | 8 +-- test/widget_test.dart | 2 +- 25 files changed, 112 insertions(+), 112 deletions(-) diff --git a/lib/app/app_controller_desktop.dart b/lib/app/app_controller_desktop.dart index 1363ed5d..2f80449a 100644 --- a/lib/app/app_controller_desktop.dart +++ b/lib/app/app_controller_desktop.dart @@ -627,8 +627,8 @@ class AppController extends ChangeNotifier { normalizedSessionKey, ) ? appText( - '没有可用的外部 CLI,请配置 AI Gateway fallback。', - 'No external CLI is available. Configure AI Gateway fallback.', + '没有可用的外部 CLI,请配置 LLM API fallback。', + 'No external CLI is available. Configure LLM API fallback.', ) : appText( '当前线程的外部 CLI 尚未就绪。', @@ -2500,7 +2500,7 @@ class AppController extends ChangeNotifier { if (gatewayUrl.isEmpty) { throw StateError( - appText('AI Gateway URL 未配置', 'AI Gateway URL not configured'), + appText('LLM API Endpoint 未配置', 'LLM API Endpoint not configured'), ); } @@ -3299,8 +3299,8 @@ class AppController extends ChangeNotifier { sessionKey, _assistantErrorMessage( appText( - 'AI Gateway URL 未配置,无法发送对话。', - 'AI Gateway URL is not configured, so the conversation could not be sent.', + 'LLM API Endpoint 未配置,无法发送对话。', + 'LLM API Endpoint is not configured, so the conversation could not be sent.', ), ), ); @@ -3313,8 +3313,8 @@ class AppController extends ChangeNotifier { sessionKey, _assistantErrorMessage( appText( - 'AI Gateway API Key 未配置,无法发送对话。', - 'AI Gateway API key is not configured, so the conversation could not be sent.', + 'LLM API Token 未配置,无法发送对话。', + 'LLM API Token is not configured, so the conversation could not be sent.', ), ), ); @@ -3327,8 +3327,8 @@ class AppController extends ChangeNotifier { sessionKey, _assistantErrorMessage( appText( - '当前没有可用的 AI Gateway 对话模型。请先在 设置 -> 集成 中同步并选择可用模型。', - 'No AI Gateway chat model is available yet. Sync and select a supported model in Settings -> Integrations first.', + '当前没有可用的 LLM API 对话模型。请先在 设置 -> 集成 中同步并选择可用模型。', + 'No LLM API chat model is available yet. Sync and select a supported model in Settings -> Integrations first.', ), ), ); @@ -3669,12 +3669,12 @@ class AppController extends ChangeNotifier { )) { return detail.isEmpty ? appText( - '当前没有可用的外部 CLI,也没有可用的 AI Chat fallback。请先安装外部 CLI,或配置 AI Gateway。', - 'No external CLI is available, and AI Chat fallback is not configured. Install an external CLI or configure AI Gateway first.', + '当前没有可用的外部 CLI,也没有可用的 AI Chat fallback。请先安装外部 CLI,或配置 LLM API。', + 'No external CLI is available, and AI Chat fallback is not configured. Install an external CLI or configure LLM API first.', ) : appText( - '$detail 当前没有可用的外部 CLI,也没有可用的 AI Chat fallback。请先安装外部 CLI,或配置 AI Gateway。', - '$detail No external CLI is available, and AI Chat fallback is not configured. Install an external CLI or configure AI Gateway first.', + '$detail 当前没有可用的外部 CLI,也没有可用的 AI Chat fallback。请先安装外部 CLI,或配置 LLM API。', + '$detail No external CLI is available, and AI Chat fallback is not configured. Install an external CLI or configure LLM API first.', ); } return detail.isEmpty @@ -4229,21 +4229,21 @@ class AppController extends ChangeNotifier { return error.message; } if (error is SocketException) { - return appText('无法连接到 AI Gateway。', 'Unable to reach the AI Gateway.'); + return appText('无法连接到 LLM API。', 'Unable to reach the LLM API.'); } if (error is HandshakeException) { return appText( - 'AI Gateway TLS 握手失败。', - 'AI Gateway TLS handshake failed.', + 'LLM API TLS 握手失败。', + 'LLM API TLS handshake failed.', ); } if (error is TimeoutException) { - return appText('AI Gateway 请求超时。', 'AI Gateway request timed out.'); + return appText('LLM API 请求超时。', 'LLM API request timed out.'); } if (error is FormatException) { return appText( - 'AI Gateway 返回了无法解析的响应。', - 'AI Gateway returned an invalid response.', + 'LLM API 返回了无法解析的响应。', + 'LLM API returned an invalid response.', ); } return error.toString(); @@ -4252,29 +4252,29 @@ class AppController extends ChangeNotifier { String _formatAiGatewayHttpError(int statusCode, String detail) { final base = switch (statusCode) { 400 => appText( - 'AI Gateway 请求无效 (400)', - 'AI Gateway rejected the request (400)', + 'LLM API 请求无效 (400)', + 'LLM API rejected the request (400)', ), 401 => appText( - 'AI Gateway 鉴权失败 (401)', - 'AI Gateway authentication failed (401)', + 'LLM API 鉴权失败 (401)', + 'LLM API authentication failed (401)', ), - 403 => appText('AI Gateway 拒绝访问 (403)', 'AI Gateway denied access (403)'), + 403 => appText('LLM API 拒绝访问 (403)', 'LLM API denied access (403)'), 404 => appText( - 'AI Gateway chat 接口不存在 (404)', - 'AI Gateway chat endpoint was not found (404)', + 'LLM API chat 接口不存在 (404)', + 'LLM API chat endpoint was not found (404)', ), 429 => appText( - 'AI Gateway 限流 (429)', - 'AI Gateway rate limited the request (429)', + 'LLM API 限流 (429)', + 'LLM API rate limited the request (429)', ), >= 500 => appText( - 'AI Gateway 当前不可用 ($statusCode)', - 'AI Gateway is unavailable right now ($statusCode)', + 'LLM API 当前不可用 ($statusCode)', + 'LLM API is unavailable right now ($statusCode)', ), _ => appText( - 'AI Gateway 返回状态码 $statusCode', - 'AI Gateway responded with status $statusCode', + 'LLM API 返回状态码 $statusCode', + 'LLM API responded with status $statusCode', ), }; final trimmed = detail.trim(); diff --git a/lib/app/app_controller_web.dart b/lib/app/app_controller_web.dart index 26c3c204..0420c407 100644 --- a/lib/app/app_controller_web.dart +++ b/lib/app/app_controller_web.dart @@ -840,8 +840,8 @@ class AppController extends ChangeNotifier { if (!canUseAiGatewayConversation) { throw Exception( appText( - '请先在 Settings 配置单机智能体所需的 AI Gateway 地址、API Key 和默认模型。', - 'Configure the Single Agent AI Gateway endpoint, API key, and default model first.', + '请先在 Settings 配置单机智能体所需的 LLM API Endpoint、LLM API Token 和默认模型。', + 'Configure the Single Agent LLM API Endpoint, LLM API Token, and default model first.', ), ); } diff --git a/lib/app/ui_feature_manifest.dart b/lib/app/ui_feature_manifest.dart index 73df8cf1..4b35e50d 100644 --- a/lib/app/ui_feature_manifest.dart +++ b/lib/app/ui_feature_manifest.dart @@ -193,7 +193,7 @@ mobile: enabled: true release_tier: stable build_modes: [debug, profile, release] - description: Mobile workspace AI Gateway launcher + description: Mobile workspace LLM API launcher ui_surface: mobile_workspace_hub account: enabled: true @@ -378,7 +378,7 @@ desktop: enabled: true release_tier: stable build_modes: [debug, profile, release] - description: Desktop AI Gateway destination + description: Desktop LLM API destination ui_surface: sidebar_navigation settings: enabled: true diff --git a/lib/data/mock_data.dart b/lib/data/mock_data.dart index 4d8a59a8..62a65645 100644 --- a/lib/data/mock_data.dart +++ b/lib/data/mock_data.dart @@ -188,7 +188,7 @@ class MockData { static const gatewayModules = [ ModuleSummary( - name: 'AI Gateway', + name: 'LLM API', description: 'Healthy · version $kAppVersion · 3 nodes · 12 active sessions', status: StatusInfo('Healthy', StatusTone.success), @@ -576,7 +576,7 @@ class MockData { SettingSummary( title: 'Gateway default route', description: '控制面启动后默认挂载的主路由。', - value: 'AI Gateway', + value: 'LLM API', ), SettingSummary( title: 'Session retention', diff --git a/lib/features/assistant/assistant_page.dart b/lib/features/assistant/assistant_page.dart index 90177a80..5af17d11 100644 --- a/lib/features/assistant/assistant_page.dart +++ b/lib/features/assistant/assistant_page.dart @@ -2356,7 +2356,7 @@ class _AssistantEmptyState extends StatelessWidget { ? connected ? appText('开始单机智能体任务', 'Start a single-agent task') : singleAgentNeedsAiGateway - ? appText('先配置 AI Gateway', 'Configure AI Gateway first') + ? appText('先配置 LLM API', 'Configure LLM API first') : appText('先准备外部 CLI', 'Prepare the external CLI first') : connected ? appText('开始对话或运行任务', 'Start a chat or run a task') @@ -2381,8 +2381,8 @@ class _AssistantEmptyState extends StatelessWidget { ) : singleAgentNeedsAiGateway ? appText( - '请先在 设置 -> 集成 中配置 AI Gateway 地址、API Key 和默认模型,然后以单机智能体模式继续当前任务。', - 'Set the AI Gateway URL, API key, and default model in Settings -> Integrations, then continue this task in Single Agent mode.', + '请先在 设置 -> 集成 中配置 LLM API Endpoint、LLM API Token 和默认模型,然后以单机智能体模式继续当前任务。', + 'Set the LLM API Endpoint, LLM API Token, and default model in Settings -> Integrations, then continue this task in Single Agent mode.', ) : appText( '当前线程的外部 CLI 尚未就绪。请先安装或配置 $providerLabel,或切换到 Auto。', @@ -2629,7 +2629,7 @@ class _ComposerBarState extends State<_ComposerBar> { ? appText('提交', 'Submit') : singleAgent ? singleAgentNeedsAiGateway - ? appText('配置 AI Gateway', 'Configure AI Gateway') + ? appText('配置 LLM API', 'Configure LLM API') : appText('查看工具栏', 'Open toolbar') : connecting ? appText('连接中…', 'Connecting…') diff --git a/lib/features/modules/modules_page.dart b/lib/features/modules/modules_page.dart index 6d1c86dc..c7baea33 100644 --- a/lib/features/modules/modules_page.dart +++ b/lib/features/modules/modules_page.dart @@ -600,12 +600,12 @@ class _FallbackHubPanel extends StatelessWidget { child: Text( hasAiGateway ? appText( - '当前 AI Gateway 没有返回模型目录。', - 'No model catalog returned by the AI Gateway.', + '当前 LLM API 没有返回模型目录。', + 'No model catalog returned by the LLM API.', ) : appText( - '先在设置 -> 集成 中同步 AI Gateway 模型目录。', - 'Sync the AI Gateway model catalog from Settings -> Integrations.', + '先在设置 -> 集成 中同步 LLM API 模型目录。', + 'Sync the LLM API model catalog from Settings -> Integrations.', ), ), ); @@ -625,8 +625,8 @@ class _FallbackHubPanel extends StatelessWidget { icon: Icons.psychology_alt_rounded, status: StatusInfo(model.provider, StatusTone.accent), description: appText( - '来自 AI Gateway 的可用模型目录项。', - 'Model catalog entry exposed by the AI Gateway.', + '来自 LLM API 的可用模型目录项。', + 'Model catalog entry exposed by the LLM API.', ), meta: [model.id, model.provider], actions: [appText('刷新', 'Refresh')], diff --git a/lib/features/settings/codex_integration_card.dart b/lib/features/settings/codex_integration_card.dart index 63d5504c..b58e3548 100644 --- a/lib/features/settings/codex_integration_card.dart +++ b/lib/features/settings/codex_integration_card.dart @@ -361,7 +361,7 @@ class _CodexIntegrationCardState extends State { if (gatewayUrl.isEmpty) { throw Exception( - appText('AI Gateway URL 未配置', 'AI Gateway URL not configured'), + appText('LLM API Endpoint 未配置', 'LLM API Endpoint not configured'), ); } diff --git a/lib/features/settings/settings_page.dart b/lib/features/settings/settings_page.dart index dd334d35..5b9338a2 100644 --- a/lib/features/settings/settings_page.dart +++ b/lib/features/settings/settings_page.dart @@ -298,8 +298,8 @@ class _SettingsPageState extends State { context, title: detail.label, description: appText( - '统一管理 AI Gateway 地址、API Key、模型目录同步和默认选择。', - 'Manage AI Gateway endpoint, API key, model catalog sync, and default selections from one screen.', + '统一管理 LLM API Endpoint、LLM API Token、模型目录同步和默认选择。', + 'Manage LLM API Endpoint, LLM API Token, model catalog sync, and default selections from one screen.', ), ), const SizedBox(height: 16), @@ -951,7 +951,7 @@ class _SettingsPageState extends State { const SizedBox(height: 16), _buildCollapsibleGatewaySection( context: context, - title: appText('AI Gateway', 'AI Gateway'), + title: appText('LLM API', 'LLM API'), expanded: _aiGatewayExpanded, onChanged: (value) => setState(() { _aiGatewayExpanded = value; @@ -1418,7 +1418,7 @@ class _SettingsPageState extends State { key: const ValueKey('ai-gateway-url-field'), controller: _aiGatewayUrlController, decoration: InputDecoration( - labelText: appText('Gateway URL', 'Gateway URL'), + labelText: appText('LLM API Endpoint', 'LLM API Endpoint'), ), onChanged: (_) => unawaited( _saveAiGatewayDraft(controller, settings).catchError((_) {}), @@ -1430,7 +1430,7 @@ class _SettingsPageState extends State { key: const ValueKey('ai-gateway-api-key-ref-field'), controller: _aiGatewayApiKeyRefController, decoration: InputDecoration( - labelText: appText('API Key 引用', 'API Key Ref'), + labelText: appText('LLM API Token 引用', 'LLM API Token Ref'), ), onChanged: (_) => unawaited( _saveAiGatewayDraft(controller, settings).catchError((_) {}), @@ -1441,7 +1441,7 @@ class _SettingsPageState extends State { fieldKey: const ValueKey('ai-gateway-api-key-field'), controller: _aiGatewayApiKeyController, label: - '${appText('API Key', 'API Key')} (${_aiGatewayApiKeyRefController.text.trim().isEmpty ? settings.aiGateway.apiKeyRef : _aiGatewayApiKeyRefController.text.trim()})', + '${appText('LLM API Token', 'LLM API Token')} (${_aiGatewayApiKeyRefController.text.trim().isEmpty ? settings.aiGateway.apiKeyRef : _aiGatewayApiKeyRefController.text.trim()})', hasStoredValue: hasStoredAiGatewayApiKey, fieldState: _aiGatewayApiKeyState, onStateChanged: (value) => @@ -2186,8 +2186,8 @@ class _SettingsPageState extends State { const SizedBox(height: 4), Text( appText( - 'App 作为统一发现与分发中心,维护托管 skills、MCP server list 和 AI Gateway 默认注入,但不会覆盖用户原有 CLI 配置。', - 'The app acts as the discovery and distribution center for managed skills, MCP server lists, and AI Gateway defaults without overwriting existing CLI config.', + 'App 作为统一发现与分发中心,维护托管 skills、MCP server list 和 LLM API 默认注入,但不会覆盖用户原有 CLI 配置。', + 'The app acts as the discovery and distribution center for managed skills, MCP server lists, and LLM API defaults without overwriting existing CLI config.', ), style: theme.textTheme.bodyMedium, ), @@ -2230,7 +2230,7 @@ class _SettingsPageState extends State { ), initialValue: config.aiGatewayInjectionPolicy.name, decoration: InputDecoration( - labelText: appText('AI Gateway 注入策略', 'AI Gateway Injection'), + labelText: appText('LLM API 注入策略', 'LLM API Injection'), ), items: AiGatewayInjectionPolicy.values .map( diff --git a/lib/models/app_models.dart b/lib/models/app_models.dart index 7877d28e..55d2da42 100644 --- a/lib/models/app_models.dart +++ b/lib/models/app_models.dart @@ -26,7 +26,7 @@ extension WorkspaceDestinationCopy on WorkspaceDestination { WorkspaceDestination.mcpServer => 'MCP Hub', WorkspaceDestination.clawHub => 'ClawHub', WorkspaceDestination.secrets => appText('密钥', 'Secrets'), - WorkspaceDestination.aiGateway => 'AI Gateway', + WorkspaceDestination.aiGateway => 'LLM API', WorkspaceDestination.settings => appText('设置', 'Settings'), WorkspaceDestination.account => appText('账号', 'Account'), }; @@ -79,8 +79,8 @@ extension WorkspaceDestinationCopy on WorkspaceDestination { 'Secrets and Vault configuration now live in the Settings center.', ), WorkspaceDestination.aiGateway => appText( - 'AI Gateway 配置统一收口到设置中心。', - 'AI Gateway configuration now lives in the Settings center.', + 'LLM API 配置统一收口到设置中心。', + 'LLM API configuration now lives in the Settings center.', ), WorkspaceDestination.settings => appText( '全局配置中心,只负责系统设置与诊断,不承担业务模块入口。', @@ -243,8 +243,8 @@ extension SettingsDetailPageCopy on SettingsDetailPage { 'Gateway Connection', ), SettingsDetailPage.aiGatewayIntegration => appText( - 'AI Gateway 集成参数', - 'AI Gateway Integration', + 'LLM API 集成参数', + 'LLM API Integration', ), SettingsDetailPage.vaultProvider => appText( 'Vault 提供方参数', diff --git a/lib/runtime/multi_agent_mounts.dart b/lib/runtime/multi_agent_mounts.dart index bc023417..8af2ab92 100644 --- a/lib/runtime/multi_agent_mounts.dart +++ b/lib/runtime/multi_agent_mounts.dart @@ -316,8 +316,8 @@ class CodexMountAdapter extends CliMountAdapter { discoveredMcpCount: discoveredMcpCount, managedMcpCount: managedMcpServers.length, detail: aiGatewayUrl.isNotEmpty - ? 'AI Gateway uses launch-scoped defaults for collaboration runs.' - : 'AI Gateway not configured.', + ? 'LLM API uses launch-scoped defaults for collaboration runs.' + : 'LLM API not configured.', ); } } @@ -367,7 +367,7 @@ class ClaudeMountAdapter extends CliMountAdapter { .where((item) => item.enabled) .length, detail: - 'MCP discovery uses `claude mcp list`; AI Gateway stays launch-scoped.', + 'MCP discovery uses `claude mcp list`; LLM API stays launch-scoped.', ); } } @@ -417,7 +417,7 @@ class GeminiMountAdapter extends CliMountAdapter { .where((item) => item.enabled) .length, detail: - 'MCP discovery uses `gemini mcp list`; AI Gateway stays launch-scoped.', + 'MCP discovery uses `gemini mcp list`; LLM API stays launch-scoped.', ); } } diff --git a/lib/runtime/runtime_controllers.dart b/lib/runtime/runtime_controllers.dart index 3a980403..d958c700 100644 --- a/lib/runtime/runtime_controllers.dart +++ b/lib/runtime/runtime_controllers.dart @@ -202,7 +202,7 @@ class SettingsController extends ChangeNotifier { SecretAuditEntry( timeLabel: _timeLabel(), action: 'Updated', - provider: 'AI Gateway', + provider: 'LLM API', target: _snapshot.aiGateway.apiKeyRef, module: 'Settings', status: 'Success', @@ -327,7 +327,7 @@ class SettingsController extends ChangeNotifier { if (normalizedBaseUrl == null) { final next = profile.copyWith( syncState: 'invalid', - syncMessage: 'Missing AI Gateway URL', + syncMessage: 'Missing LLM API Endpoint', ); _aiGatewayStatus = next.syncMessage; _snapshot = _snapshot.copyWith(aiGateway: next); @@ -342,7 +342,7 @@ class SettingsController extends ChangeNotifier { final next = profile.copyWith( baseUrl: normalizedBaseUrl.toString(), syncState: 'invalid', - syncMessage: 'Missing AI Gateway API key', + syncMessage: 'Missing LLM API Token', ); _aiGatewayStatus = next.syncMessage; _snapshot = _snapshot.copyWith(aiGateway: next); @@ -410,7 +410,7 @@ class SettingsController extends ChangeNotifier { if (normalizedBaseUrl == null) { return const AiGatewayConnectionCheck( state: 'invalid', - message: 'Missing AI Gateway URL', + message: 'Missing LLM API Endpoint', endpoint: '', modelCount: 0, ); @@ -422,7 +422,7 @@ class SettingsController extends ChangeNotifier { if (apiKey.isEmpty) { return AiGatewayConnectionCheck( state: 'invalid', - message: 'Missing AI Gateway API key', + message: 'Missing LLM API Token', endpoint: endpoint, modelCount: 0, ); @@ -490,7 +490,7 @@ class SettingsController extends ChangeNotifier { ), SecretReferenceEntry( name: _snapshot.aiGateway.name, - provider: 'AI Gateway', + provider: 'LLM API', module: 'Settings', maskedValue: _snapshot.aiGateway.baseUrl.trim().isEmpty ? 'Not set' @@ -518,7 +518,7 @@ class SettingsController extends ChangeNotifier { return 'Ollama Cloud'; } if (key.contains('ai_gateway')) { - return 'AI Gateway'; + return 'LLM API'; } if (key.contains('gateway')) { return 'Gateway'; @@ -625,7 +625,7 @@ class SettingsController extends ChangeNotifier { provider: stringValue(map['provider']) ?? stringValue(map['owned_by']) ?? - 'AI Gateway', + 'LLM API', contextWindow: intValue(map['contextWindow']) ?? intValue(map['context_window']), @@ -646,7 +646,7 @@ class SettingsController extends ChangeNotifier { return error.message; } if (error is SocketException) { - return 'Unable to reach the AI Gateway'; + return 'Unable to reach the LLM API'; } if (error is HandshakeException) { return 'TLS handshake failed'; @@ -655,7 +655,7 @@ class SettingsController extends ChangeNotifier { return 'Connection timed out'; } if (error is FormatException) { - return 'AI Gateway returned invalid JSON'; + return 'LLM API returned invalid JSON'; } return 'Failed: $error'; } @@ -666,9 +666,9 @@ class SettingsController extends ChangeNotifier { 401 => 'Authentication failed (401)', 403 => 'Access denied (403)', 404 => 'Model catalog endpoint not found (404)', - 429 => 'Rate limited by AI Gateway (429)', - >= 500 => 'AI Gateway unavailable ($statusCode)', - _ => 'AI Gateway responded $statusCode', + 429 => 'Rate limited by LLM API (429)', + >= 500 => 'LLM API unavailable ($statusCode)', + _ => 'LLM API responded $statusCode', }; return detail.isEmpty ? base : '$base · $detail'; } @@ -1262,7 +1262,7 @@ class ModelsController extends ChangeNotifier { (item) => GatewayModelSummary( id: item, name: item, - provider: 'AI Gateway', + provider: 'LLM API', contextWindow: null, maxOutputTokens: null, ), diff --git a/lib/runtime/runtime_models.dart b/lib/runtime/runtime_models.dart index e830b0f2..d034aade 100644 --- a/lib/runtime/runtime_models.dart +++ b/lib/runtime/runtime_models.dart @@ -997,7 +997,7 @@ class AiGatewayProfile { factory AiGatewayProfile.defaults() { return const AiGatewayProfile( - name: 'AI Gateway', + name: 'LLM API', baseUrl: '', apiKeyRef: 'ai_gateway_api_key', availableModels: [], diff --git a/lib/web/web_ai_gateway_client.dart b/lib/web/web_ai_gateway_client.dart index 7332338c..ac630370 100644 --- a/lib/web/web_ai_gateway_client.dart +++ b/lib/web/web_ai_gateway_client.dart @@ -33,7 +33,7 @@ class WebAiGatewayClient { if (normalizedBaseUrl == null) { return const AiGatewayConnectionCheck( state: 'invalid', - message: 'Missing AI Gateway URL', + message: 'Missing LLM API Endpoint', endpoint: '', modelCount: 0, ); @@ -43,7 +43,7 @@ class WebAiGatewayClient { if (trimmedApiKey.isEmpty) { return AiGatewayConnectionCheck( state: 'invalid', - message: 'Missing AI Gateway API key', + message: 'Missing LLM API Token', endpoint: endpoint, modelCount: 0, ); @@ -144,7 +144,7 @@ class WebAiGatewayClient { }) async { final normalizedBaseUrl = normalizeBaseUrl(baseUrl); if (normalizedBaseUrl == null) { - throw const WebAiGatewayException(message: 'Missing AI Gateway URL'); + throw const WebAiGatewayException(message: 'Missing LLM API Endpoint'); } final response = await http.post( _chatUri(normalizedBaseUrl), diff --git a/lib/web/web_assistant_page.dart b/lib/web/web_assistant_page.dart index 217b62d1..63f5f9a4 100644 --- a/lib/web/web_assistant_page.dart +++ b/lib/web/web_assistant_page.dart @@ -433,8 +433,8 @@ class _ConversationPanel extends StatelessWidget { child: Text( currentTarget == AssistantExecutionTarget.singleAgent ? appText( - '当前单机智能体配置还不完整,请先在 Settings 中保存 AI Gateway 地址、API Key 和默认模型。', - 'Single Agent is not ready yet. Save the AI Gateway endpoint, API key, and default model in Settings first.', + '当前单机智能体配置还不完整,请先在 Settings 中保存 LLM API Endpoint、LLM API Token 和默认模型。', + 'Single Agent is not ready yet. Save the LLM API Endpoint, LLM API Token, and default model in Settings first.', ) : appText( '当前 Relay Gateway 尚未连接,请先在 Settings 中保存配置并连接。', diff --git a/lib/web/web_settings_page.dart b/lib/web/web_settings_page.dart index e5b0dfd9..477cc33b 100644 --- a/lib/web/web_settings_page.dart +++ b/lib/web/web_settings_page.dart @@ -420,7 +420,7 @@ class _WebSettingsPageState extends State { TextField( controller: _directBaseUrlController, decoration: InputDecoration( - labelText: appText('Base URL', 'Base URL'), + labelText: appText('LLM API Endpoint', 'LLM API Endpoint'), hintText: 'https://api.example.com/v1', ), ), @@ -429,7 +429,7 @@ class _WebSettingsPageState extends State { controller: _directApiKeyController, obscureText: true, decoration: InputDecoration( - labelText: appText('API Key', 'API Key'), + labelText: appText('LLM API Token', 'LLM API Token'), helperText: controller.storedAiGatewayApiKeyMask == null ? null : '${appText('已保存', 'Stored')}: ${controller.storedAiGatewayApiKeyMask}', @@ -750,8 +750,8 @@ class _WebSettingsPageState extends State { const SizedBox(height: 8), Text( appText( - 'Root SPA 目标部署到 https://xworkmate.svc.plus/ 。单机智能体依赖的 AI Gateway endpoint 需要浏览器可达且支持 CORS;否则请使用 Relay 模式。', - 'The root SPA targets https://xworkmate.svc.plus/ . Single Agent AI Gateway endpoints must be browser-reachable and CORS-compatible; otherwise use relay mode.', + 'Root SPA 目标部署到 https://xworkmate.svc.plus/ 。单机智能体依赖的 LLM API endpoint 需要浏览器可达且支持 CORS;否则请使用 Relay 模式。', + 'The root SPA targets https://xworkmate.svc.plus/ . Single Agent LLM API endpoints must be browser-reachable and CORS-compatible; otherwise use relay mode.', ), ), ], diff --git a/lib/widgets/assistant_focus_panel.dart b/lib/widgets/assistant_focus_panel.dart index d46b1f39..88615e92 100644 --- a/lib/widgets/assistant_focus_panel.dart +++ b/lib/widgets/assistant_focus_panel.dart @@ -427,8 +427,8 @@ class _SkillsFocusPreview extends StatelessWidget { controller.isSingleAgentMode ? (controller.currentSingleAgentNeedsAiGatewayConfiguration ? appText( - '当前没有可用外部 CLI,请先配置 AI Gateway fallback。', - 'No external CLI is available. Configure AI Gateway fallback first.', + '当前没有可用外部 CLI,请先配置 LLM API fallback。', + 'No external CLI is available. Configure LLM API fallback first.', ) : appText( '当前线程还没有已加载技能。切换 provider 后会读取该线程自己的 skills 列表。', @@ -669,8 +669,8 @@ class _AiGatewayFocusPreview extends StatelessWidget { if (items.isEmpty) _PreviewEmptyState( message: appText( - '当前没有 AI Gateway 模型摘要。', - 'No AI Gateway model summary is available yet.', + '当前没有 LLM API 模型摘要。', + 'No LLM API model summary is available yet.', ), ) else diff --git a/lib/widgets/sidebar_navigation.dart b/lib/widgets/sidebar_navigation.dart index f55fbfa4..63b362fd 100644 --- a/lib/widgets/sidebar_navigation.dart +++ b/lib/widgets/sidebar_navigation.dart @@ -501,7 +501,7 @@ class _SidebarNavItemState extends State<_SidebarNavItem> { WorkspaceDestination.mcpServer => 'MCP Hub', WorkspaceDestination.clawHub => 'ClawHub', WorkspaceDestination.secrets => appText('密钥', 'Secrets'), - WorkspaceDestination.aiGateway => 'AI Gateway', + WorkspaceDestination.aiGateway => 'LLM API', WorkspaceDestination.settings => appText('设置', 'Settings'), WorkspaceDestination.account => appText('账户', 'Account'), }; diff --git a/test/features/ai_gateway_page_suite.dart b/test/features/ai_gateway_page_suite.dart index 35f42d11..3f2462b5 100644 --- a/test/features/ai_gateway_page_suite.dart +++ b/test/features/ai_gateway_page_suite.dart @@ -68,7 +68,7 @@ class _AiGatewaySettingsShortcutTestController extends AppController { } void main() { - testWidgets('AI Gateway shortcut routes to Settings center', ( + testWidgets('LLM API shortcut routes to Settings center', ( WidgetTester tester, ) async { final controller = await createTestController(tester); @@ -89,7 +89,7 @@ void main() { ); expect(find.text('OpenClaw Gateway'), findsOneWidget); - expect(find.text('AI Gateway'), findsWidgets); + expect(find.text('LLM API'), findsWidgets); }); testWidgets( diff --git a/test/features/modules_page_suite.dart b/test/features/modules_page_suite.dart index 16ed56c7..a21fa48c 100644 --- a/test/features/modules_page_suite.dart +++ b/test/features/modules_page_suite.dart @@ -29,7 +29,7 @@ void main() { ); expect(find.text('OpenClaw Gateway'), findsOneWidget); - expect(find.text('AI Gateway'), findsWidgets); + expect(find.text('LLM API'), findsWidgets); controller.navigateTo(WorkspaceDestination.nodes); await pumpPage( diff --git a/test/features/settings_ai_gateway_persistence_suite.dart b/test/features/settings_ai_gateway_persistence_suite.dart index 79bc5214..37293c05 100644 --- a/test/features/settings_ai_gateway_persistence_suite.dart +++ b/test/features/settings_ai_gateway_persistence_suite.dart @@ -14,7 +14,7 @@ import '../test_support.dart'; void main() { testWidgets( - 'SettingsPage AI Gateway draft/save/apply flow persists edited fields through local actions', + 'SettingsPage LLM API draft/save/apply flow persists edited fields through local actions', (WidgetTester tester) async { late _AiGatewaySettingsTestController controller; late Directory testRoot; @@ -47,7 +47,7 @@ void main() { availableModels: const ['stale-model'], selectedModels: const ['stale-model'], syncState: 'invalid', - syncMessage: 'Missing AI Gateway URL', + syncMessage: 'Missing LLM API Endpoint', ); await tester.runAsync(() async { await controller.saveSettings( @@ -140,7 +140,7 @@ void main() { expect(controller.settings.aiGateway.syncState, 'idle'); expect(controller.settings.aiGateway.syncMessage, 'Ready to sync models'); expect(controller.hasPendingSettingsApply, isFalse); - expect(find.text('Missing AI Gateway URL'), findsNothing); + expect(find.text('Missing LLM API Endpoint'), findsNothing); expect(find.text('Ready to sync models'), findsOneWidget); }, ); diff --git a/test/runtime/app_controller_ai_gateway_chat_suite.dart b/test/runtime/app_controller_ai_gateway_chat_suite.dart index 37ce8866..94976dae 100644 --- a/test/runtime/app_controller_ai_gateway_chat_suite.dart +++ b/test/runtime/app_controller_ai_gateway_chat_suite.dart @@ -176,7 +176,7 @@ void main() { ); test( - 'AppController falls back when AI Gateway ignores stream mode', + 'AppController falls back when LLM API ignores stream mode', () async { SharedPreferences.setMockInitialValues({}); final tempDirectory = await Directory.systemTemp.createTemp( diff --git a/test/runtime/app_controller_ai_gateway_models_suite.dart b/test/runtime/app_controller_ai_gateway_models_suite.dart index a8648ae9..88c62e56 100644 --- a/test/runtime/app_controller_ai_gateway_models_suite.dart +++ b/test/runtime/app_controller_ai_gateway_models_suite.dart @@ -12,7 +12,7 @@ import 'package:xworkmate/runtime/secure_config_store.dart'; void main() { test( - 'AppController exposes selected AI Gateway models to the assistant', + 'AppController exposes selected LLM API models to the assistant', () async { SharedPreferences.setMockInitialValues({}); final tempDirectory = await Directory.systemTemp.createTemp( @@ -100,7 +100,7 @@ void main() { ); test( - 'AppController does not borrow AI Gateway model choices when an external Single Agent provider is available', + 'AppController does not borrow LLM API model choices when an external Single Agent provider is available', () async { SharedPreferences.setMockInitialValues({}); final tempDirectory = await Directory.systemTemp.createTemp( diff --git a/test/runtime/app_controller_execution_target_switch_suite.dart b/test/runtime/app_controller_execution_target_switch_suite.dart index 641efd3e..331ee880 100644 --- a/test/runtime/app_controller_execution_target_switch_suite.dart +++ b/test/runtime/app_controller_execution_target_switch_suite.dart @@ -290,7 +290,7 @@ void main() { expect(controller.assistantConnectionStatusLabel, '单机智能体'); expect( controller.assistantConnectionTargetLabel, - '没有可用的外部 CLI,请配置 AI Gateway fallback。', + '没有可用的外部 CLI,请配置 LLM API fallback。', ); expect( gateway.connectedProfiles, @@ -815,7 +815,7 @@ void main() { expect(controller.assistantConnectionStatusLabel, '单机智能体'); expect( controller.assistantConnectionTargetLabel, - '没有可用的外部 CLI,请配置 AI Gateway fallback。', + '没有可用的外部 CLI,请配置 LLM API fallback。', ); }, ); diff --git a/test/runtime/settings_controller_ai_gateway_sync_suite.dart b/test/runtime/settings_controller_ai_gateway_sync_suite.dart index cb8658ee..bd386768 100644 --- a/test/runtime/settings_controller_ai_gateway_sync_suite.dart +++ b/test/runtime/settings_controller_ai_gateway_sync_suite.dart @@ -13,7 +13,7 @@ import 'package:xworkmate/runtime/secure_config_store.dart'; void main() { test( - 'SettingsController syncs AI Gateway models with an inline API key override', + 'SettingsController syncs LLM API models with an inline token override', () async { SharedPreferences.setMockInitialValues({}); final server = await _FakeAiGatewayServer.start(); @@ -62,7 +62,7 @@ void main() { ); test( - 'SettingsController keeps AI Gateway api key in secure storage while retaining local selected models', + 'SettingsController keeps LLM API api key in secure storage while retaining local selected models', () async { SharedPreferences.setMockInitialValues({}); final server = await _FakeAiGatewayServer.start(); @@ -141,7 +141,7 @@ void main() { ); test( - 'SettingsController tests AI Gateway auth without persisting draft values', + 'SettingsController tests LLM API auth without persisting draft values', () async { SharedPreferences.setMockInitialValues({}); final server = await _FakeAiGatewayServer.start( @@ -172,7 +172,7 @@ void main() { ); test( - 'SettingsController reports AI Gateway auth failures with a detailed message', + 'SettingsController reports LLM API auth failures with a detailed message', () async { SharedPreferences.setMockInitialValues({}); final server = await _FakeAiGatewayServer.start( diff --git a/test/widget_test.dart b/test/widget_test.dart index 9f1a1f5d..a25fb1cb 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -23,7 +23,7 @@ void main() { if (kIsWeb) { expect(find.text('设置'), findsWidgets); expect(find.text('Tasks'), findsNothing); - expect(find.text('AI Gateway'), findsNothing); + expect(find.text('LLM API'), findsNothing); } else { expect(find.text('幻灯片'), findsNothing); }