feat(xai): add Grok account management UI with four-locale strings

Add XaiOAuthSection (device-code login, account list, default selection)
backed by the generalized useManagedAuth hook, wire it into the Auth
Center and both Claude provider forms, and expose model fetching for
signed-in accounts.

- Accounts requiring re-auth stay visible in the account selector as
  disabled items with an expired badge instead of silently vanishing.
- Auth status refetches periodically so a revoked refresh token surfaces
  without reloading the panel.
- All strings ship in zh/en/ja/zh-TW; a locale coverage test pins every
  required key in all four locales.
This commit is contained in:
Jason
2026-07-19 00:20:17 +08:00
parent 615c99c62b
commit e9317f476e
16 changed files with 936 additions and 68 deletions
+5 -1
View File
@@ -1,6 +1,9 @@
import { invoke } from "@tauri-apps/api/core";
export type ManagedAuthProvider = "github_copilot" | "codex_oauth";
export type ManagedAuthProvider =
| "github_copilot"
| "codex_oauth"
| "xai_oauth";
export interface ManagedAuthAccount {
id: string;
@@ -10,6 +13,7 @@ export interface ManagedAuthAccount {
authenticated_at: number;
is_default: boolean;
github_domain: string;
requires_reauth: boolean;
}
export interface ManagedAuthStatus {
+9
View File
@@ -42,6 +42,15 @@ export async function fetchCodexOauthModels(
});
}
/** 获取当前 xAI OAuth 账号可访问的模型列表。 */
export async function fetchXaiOauthModels(
accountId?: string | null,
): Promise<FetchedModel[]> {
return invoke("get_xai_oauth_models", {
accountId: accountId || null,
});
}
/**
* 根据错误类型显示对应的 toast 提示
*/