feat(openai): 同步生图 API 支持并接入图片计费调度
- 同步 OpenAI 图片生成与编辑接口 - 接入图片请求解析、账号调度、转发与用量记录 - 接入图片计费与图片用量落库 - 限制 OAuth 生图仅支持无显式模型和尺寸的基础请求
This commit is contained in:
@@ -911,6 +911,34 @@ func (a *Account) GetChatGPTAccountID() string {
|
||||
return a.GetCredential("chatgpt_account_id")
|
||||
}
|
||||
|
||||
func (a *Account) GetOpenAIDeviceID() string {
|
||||
if !a.IsOpenAIOAuth() {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(a.GetExtraString("openai_device_id"))
|
||||
}
|
||||
|
||||
func (a *Account) GetOpenAISessionID() string {
|
||||
if !a.IsOpenAIOAuth() {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(a.GetExtraString("openai_session_id"))
|
||||
}
|
||||
|
||||
func (a *Account) SupportsOpenAIImageCapability(capability OpenAIImagesCapability) bool {
|
||||
if !a.IsOpenAI() {
|
||||
return false
|
||||
}
|
||||
switch capability {
|
||||
case OpenAIImagesCapabilityBasic:
|
||||
return a.Type == AccountTypeOAuth || a.Type == AccountTypeAPIKey
|
||||
case OpenAIImagesCapabilityNative:
|
||||
return a.Type == AccountTypeAPIKey
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Account) GetChatGPTUserID() string {
|
||||
if !a.IsOpenAIOAuth() {
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user