feat(image): 接入 ChatGPT Web 生图反代

This commit is contained in:
Entropy.Xu
2026-05-06 02:29:17 +08:00
parent beee7a76d2
commit 4baee436ba
47 changed files with 3872 additions and 141 deletions

View File

@@ -86,7 +86,7 @@ export async function updateProvider(
providerId: string,
data: Partial<{
name: string
provider_type: 'custom' | 'vertex_ai' | 'claude_code' | 'codex' | 'gemini_cli' | 'antigravity' | 'kiro'
provider_type: 'custom' | 'vertex_ai' | 'claude_code' | 'codex' | 'chatgpt_web' | 'gemini_cli' | 'antigravity' | 'kiro'
description: string | null
website: string
provider_priority: number
@@ -120,7 +120,7 @@ export async function updateProvider(
export async function createProvider(
data: {
name: string
provider_type?: 'custom' | 'vertex_ai' | 'claude_code' | 'codex' | 'gemini_cli' | 'antigravity' | 'kiro'
provider_type?: 'custom' | 'vertex_ai' | 'claude_code' | 'codex' | 'chatgpt_web' | 'gemini_cli' | 'antigravity' | 'kiro'
description?: string
website?: string
billing_type?: 'monthly_quota' | 'pay_as_you_go' | 'free_tier'

View File

@@ -480,7 +480,7 @@ export interface PublicEndpointStatusMonitorResponse {
formats: PublicEndpointStatusMonitor[]
}
export type ProviderType = 'custom' | 'claude_code' | 'codex' | 'gemini_cli' | 'antigravity' | 'kiro' | 'vertex_ai'
export type ProviderType = 'custom' | 'claude_code' | 'codex' | 'chatgpt_web' | 'gemini_cli' | 'antigravity' | 'kiro' | 'vertex_ai'
export interface ClaudeCodeAdvancedConfig {
// 会话数量控制null/undefined 表示不限制

View File

@@ -854,6 +854,7 @@ const PROVIDER_TYPE_LABELS: Record<string, string> = {
vertex_ai: 'Vertex AI',
claude_code: 'ClaudeCode',
codex: 'Codex',
chatgpt_web: 'ChatGPT Web',
gemini_cli: 'Gemini CLI',
antigravity: 'Antigravity',
kiro: 'Kiro',

View File

@@ -54,6 +54,9 @@
<SelectItem value="codex">
Codex
</SelectItem>
<SelectItem value="chatgpt_web">
ChatGPT Web
</SelectItem>
<SelectItem value="gemini_cli">
Gemini CLI
</SelectItem>
@@ -78,6 +81,9 @@
<SelectItem value="codex">
Codex
</SelectItem>
<SelectItem value="chatgpt_web">
ChatGPT Web
</SelectItem>
<SelectItem value="gemini_cli">
Gemini CLI
</SelectItem>
@@ -340,7 +346,7 @@ const defaultPriority = computed(() => {
// 表单数据
const form = ref({
name: '',
provider_type: 'custom' as 'custom' | 'vertex_ai' | 'claude_code' | 'codex' | 'gemini_cli' | 'antigravity' | 'kiro',
provider_type: 'custom' as 'custom' | 'vertex_ai' | 'claude_code' | 'codex' | 'chatgpt_web' | 'gemini_cli' | 'antigravity' | 'kiro',
description: '',
website: '',
// 计费配置

View File

@@ -0,0 +1,11 @@
import { describe, expect, it } from 'vitest'
import { isKeyManagedProviderType, isOAuthAccountProviderType } from '../providerTypeUtils'
describe('providerTypeUtils', () => {
it('treats ChatGPT-Web as an OAuth account provider', () => {
expect(isOAuthAccountProviderType('chatgpt_web')).toBe(true)
expect(isOAuthAccountProviderType('ChatGPT_Web')).toBe(true)
expect(isKeyManagedProviderType('chatgpt_web')).toBe(false)
})
})

View File

@@ -7,6 +7,7 @@
const oauthAccountProviderTypes = new Set([
'claude_code',
'codex',
'chatgpt_web',
'gemini_cli',
'antigravity',
'kiro',