新增 Codex Base URL 配置输入

This commit is contained in:
jiesen
2025-12-21 20:12:39 +07:00
parent 043ad052bf
commit d215816a18
4 changed files with 48 additions and 11 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "proxycast",
"version": "0.14.6",
"version": "0.15.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "proxycast",
"version": "0.14.6",
"version": "0.15.0",
"dependencies": {
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
@@ -35,6 +35,7 @@ export function AddCredentialModal({
defaultCredsPath[providerType] || "",
);
const [projectId, setProjectId] = useState("");
const [apiBaseUrl, setApiBaseUrl] = useState("");
// API Key 字段
const [apiKey, setApiKey] = useState("");
@@ -77,6 +78,8 @@ export function AddCredentialModal({
name,
credsFilePath,
setCredsFilePath,
apiBaseUrl,
setApiBaseUrl,
onSelectFile: handleSelectFile,
loading,
setLoading,
@@ -14,6 +14,8 @@ interface CodexFormProps {
name: string;
credsFilePath: string;
setCredsFilePath: (path: string) => void;
apiBaseUrl: string;
setApiBaseUrl: (url: string) => void;
onSelectFile: () => void;
loading: boolean;
setLoading: (loading: boolean) => void;
@@ -25,6 +27,8 @@ export function CodexForm({
name,
credsFilePath,
setCredsFilePath,
apiBaseUrl,
setApiBaseUrl,
onSelectFile,
loading: _loading,
setLoading,
@@ -87,7 +91,12 @@ export function CodexForm({
try {
const trimmedName = name.trim() || undefined;
await providerPoolApi.addCodexOAuth(credsFilePath, trimmedName);
const trimmedUrl = apiBaseUrl.trim() || undefined;
await providerPoolApi.addCodexOAuth(
credsFilePath,
trimmedUrl,
trimmedName,
);
onSuccess();
} catch (e) {
setError(e instanceof Error ? e.message : String(e));
@@ -130,13 +139,33 @@ export function CodexForm({
/>
</div>
) : (
<FileImportForm
credsFilePath={credsFilePath}
setCredsFilePath={setCredsFilePath}
onSelectFile={onSelectFile}
placeholder="选择 auth.json 或 oauth.json..."
hint="默认路径: ~/.codex/auth.json 或 Codex CLI 的凭证文件"
/>
<div className="space-y-4">
<FileImportForm
credsFilePath={credsFilePath}
setCredsFilePath={setCredsFilePath}
onSelectFile={onSelectFile}
placeholder="选择 auth.json 或 oauth.json..."
hint="默认路径: ~/.codex/auth.json 或 Codex CLI 的凭证文件"
/>
{/* API Base URL 输入框 */}
<div>
<label className="mb-1 block text-sm font-medium">
API Base URL
</label>
<input
type="text"
value={apiBaseUrl}
onChange={(e) => setApiBaseUrl(e.target.value)}
placeholder="https://yunyi.cfd/codex"
className="w-full rounded-md border bg-background px-3 py-2 text-sm"
/>
<p className="mt-1 text-xs text-muted-foreground">
云驿代理默认:
https://yunyi.cfd/codex(留空则使用凭证文件中的配置)
</p>
</div>
</div>
)}
</>
),
+6 -1
View File
@@ -333,9 +333,14 @@ export const providerPoolApi = {
async addCodexOAuth(
credsFilePath: string,
apiBaseUrl?: string,
name?: string,
): Promise<ProviderCredential> {
return invoke("add_codex_oauth_credential", { credsFilePath, name });
return invoke("add_codex_oauth_credential", {
credsFilePath,
apiBaseUrl,
name,
});
},
async addClaudeOAuth(