"vscode:/vscode.git/clone" did not exist on "6a2cf09ee05ff4833c93592f6c68cf21415febde"
Commit 6c469b42 authored by shaw's avatar shaw
Browse files

feat: 新增支持codex转发

parent dacf3a2a
...@@ -667,6 +667,7 @@ export default { ...@@ -667,6 +667,7 @@ export default {
failedToClearRateLimit: 'Failed to clear rate limit', failedToClearRateLimit: 'Failed to clear rate limit',
deleteConfirm: "Are you sure you want to delete '{name}'? This action cannot be undone.", deleteConfirm: "Are you sure you want to delete '{name}'? This action cannot be undone.",
// Create/Edit Account Modal // Create/Edit Account Modal
platform: 'Platform',
accountName: 'Account Name', accountName: 'Account Name',
enterAccountName: 'Enter account name', enterAccountName: 'Enter account name',
accountType: 'Account Type', accountType: 'Account Type',
...@@ -759,10 +760,26 @@ export default { ...@@ -759,10 +760,26 @@ export default {
cookieAuthFailed: 'Cookie authorization failed', cookieAuthFailed: 'Cookie authorization failed',
keyAuthFailed: 'Key {index}: {error}', keyAuthFailed: 'Key {index}: {error}',
successCreated: 'Successfully created {count} account(s)', successCreated: 'Successfully created {count} account(s)',
// OpenAI specific
openai: {
title: 'OpenAI Account Authorization',
followSteps: 'Follow these steps to complete OpenAI account authorization:',
step1GenerateUrl: 'Click the button below to generate the authorization URL',
generateAuthUrl: 'Generate Auth URL',
step2OpenUrl: 'Open the URL in your browser and complete authorization',
openUrlDesc: 'Open the authorization URL in a new tab, log in to your OpenAI account and authorize.',
importantNotice: '<strong>Important:</strong> The page may take a while to load after authorization. Please wait patiently. When the browser address bar changes to <code>http://localhost...</code>, the authorization is complete.',
step3EnterCode: 'Enter Authorization URL or Code',
authCodeDesc: 'After authorization is complete, when the page URL becomes <code>http://localhost:xxx/auth/callback?code=...</code>:',
authCode: 'Authorization URL or Code',
authCodePlaceholder: 'Option 1: Copy the complete URL\n(http://localhost:xxx/auth/callback?code=...)\nOption 2: Copy only the code parameter value',
authCodeHint: 'You can copy the entire URL or just the code parameter value, the system will auto-detect',
},
}, },
// Re-Auth Modal // Re-Auth Modal
reAuthorizeAccount: 'Re-Authorize Account', reAuthorizeAccount: 'Re-Authorize Account',
claudeCodeAccount: 'Claude Code Account', claudeCodeAccount: 'Claude Code Account',
openaiAccount: 'OpenAI Account',
inputMethod: 'Input Method', inputMethod: 'Input Method',
reAuthorizedSuccess: 'Account re-authorized successfully', reAuthorizedSuccess: 'Account re-authorized successfully',
// Test Modal // Test Modal
......
...@@ -757,6 +757,7 @@ export default { ...@@ -757,6 +757,7 @@ export default {
failedToDelete: '删除账号失败', failedToDelete: '删除账号失败',
failedToRefresh: '刷新 Cookie 失败', failedToRefresh: '刷新 Cookie 失败',
// Create/Edit Account Modal // Create/Edit Account Modal
platform: '平台',
accountName: '账号名称', accountName: '账号名称',
enterAccountName: '请输入账号名称', enterAccountName: '请输入账号名称',
accountType: '账号类型', accountType: '账号类型',
...@@ -849,10 +850,26 @@ export default { ...@@ -849,10 +850,26 @@ export default {
cookieAuthFailed: 'Cookie 授权失败', cookieAuthFailed: 'Cookie 授权失败',
keyAuthFailed: '密钥 {index}: {error}', keyAuthFailed: '密钥 {index}: {error}',
successCreated: '成功创建 {count} 个账号', successCreated: '成功创建 {count} 个账号',
// OpenAI specific
openai: {
title: 'OpenAI 账户授权',
followSteps: '请按照以下步骤完成 OpenAI 账户的授权:',
step1GenerateUrl: '点击下方按钮生成授权链接',
generateAuthUrl: '生成授权链接',
step2OpenUrl: '在浏览器中打开链接并完成授权',
openUrlDesc: '请在新标签页中打开授权链接,登录您的 OpenAI 账户并授权。',
importantNotice: '<strong>重要提示:</strong>授权后页面可能会加载较长时间,请耐心等待。当浏览器地址栏变为 <code>http://localhost...</code> 开头时,表示授权已完成。',
step3EnterCode: '输入授权链接或 Code',
authCodeDesc: '授权完成后,当页面地址变为 <code>http://localhost:xxx/auth/callback?code=...</code> 时:',
authCode: '授权链接或 Code',
authCodePlaceholder: '方式1:复制完整的链接\n(http://localhost:xxx/auth/callback?code=...)\n方式2:仅复制 code 参数的值',
authCodeHint: '您可以直接复制整个链接或仅复制 code 参数值,系统会自动识别',
},
}, },
// Re-Auth Modal // Re-Auth Modal
reAuthorizeAccount: '重新授权账号', reAuthorizeAccount: '重新授权账号',
claudeCodeAccount: 'Claude Code 账号', claudeCodeAccount: 'Claude Code 账号',
openaiAccount: 'OpenAI 账号',
inputMethod: '输入方式', inputMethod: '输入方式',
reAuthorizedSuccess: '账号重新授权成功', reAuthorizedSuccess: '账号重新授权成功',
// Test Modal // Test Modal
......
...@@ -280,7 +280,7 @@ export interface UpdateGroupRequest { ...@@ -280,7 +280,7 @@ export interface UpdateGroupRequest {
// ==================== Account & Proxy Types ==================== // ==================== Account & Proxy Types ====================
export type AccountPlatform = 'anthropic'; export type AccountPlatform = 'anthropic' | 'openai';
export type AccountType = 'oauth' | 'setup-token' | 'apikey'; export type AccountType = 'oauth' | 'setup-token' | 'apikey';
export type OAuthAddMethod = 'oauth' | 'setup-token'; export type OAuthAddMethod = 'oauth' | 'setup-token';
export type ProxyProtocol = 'http' | 'https' | 'socks5'; export type ProxyProtocol = 'http' | 'https' | 'socks5';
......
...@@ -78,10 +78,10 @@ ...@@ -78,10 +78,10 @@
<span <span
:class="[ :class="[
'w-2 h-2 rounded-full', 'w-2 h-2 rounded-full',
value === 'anthropic' ? 'bg-orange-500' : 'bg-gray-400' value === 'anthropic' ? 'bg-orange-500' : value === 'openai' ? 'bg-green-500' : 'bg-gray-400'
]" ]"
/> />
<span class="text-sm text-gray-700 dark:text-gray-300 capitalize">{{ value === 'anthropic' ? 'Anthropic' : value }}</span> <span class="text-sm text-gray-700 dark:text-gray-300 capitalize">{{ value === 'anthropic' ? 'Anthropic' : value === 'openai' ? 'OpenAI' : value }}</span>
</div> </div>
</template> </template>
...@@ -312,7 +312,8 @@ const columns = computed<Column[]>(() => [ ...@@ -312,7 +312,8 @@ const columns = computed<Column[]>(() => [
// Filter options // Filter options
const platformOptions = computed(() => [ const platformOptions = computed(() => [
{ value: '', label: t('admin.accounts.allPlatforms') }, { value: '', label: t('admin.accounts.allPlatforms') },
{ value: 'anthropic', label: t('admin.accounts.platforms.anthropic') } { value: 'anthropic', label: t('admin.accounts.platforms.anthropic') },
{ value: 'openai', label: t('admin.accounts.platforms.openai') }
]) ])
const typeOptions = computed(() => [ const typeOptions = computed(() => [
...@@ -405,7 +406,8 @@ const loadProxies = async () => { ...@@ -405,7 +406,8 @@ const loadProxies = async () => {
const loadGroups = async () => { const loadGroups = async () => {
try { try {
groups.value = await adminAPI.groups.getByPlatform('anthropic') // Load groups for all platforms to support both Anthropic and OpenAI accounts
groups.value = await adminAPI.groups.getAll()
} catch (error) { } catch (error) {
console.error('Error loading groups:', error) console.error('Error loading groups:', error)
} }
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment