diff --git a/README.md b/README.md index 04071649..fc594326 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,8 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用 + [x] 易支付 3. 支持用key查询使用额度: + 配合项目[neko-api-key-tool](https://github.com/Calcium-Ion/neko-api-key-tool)可实现用key查询使用情况,方便二次分销 -4. 渠道显示已使用额度 +4. 渠道显示已使用额度,支持指定组织访问 +5. 分页支持选择每页显示数量 ## 功能 1. 支持多种大模型: + [x] [OpenAI ChatGPT 系列模型](https://platform.openai.com/docs/guides/gpt/chat-completions-api)(支持 [Azure OpenAI API](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference)) diff --git a/controller/relay-text.go b/controller/relay-text.go index a07ed5f4..ab0e6997 100644 --- a/controller/relay-text.go +++ b/controller/relay-text.go @@ -311,6 +311,9 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode { req.Header.Set("api-key", apiKey) } else { req.Header.Set("Authorization", c.Request.Header.Get("Authorization")) + if c.Request.Header.Get("OpenAI-Organization") != "" { + req.Header.Set("OpenAI-Organization", c.Request.Header.Get("OpenAI-Organization")) + } if channelType == common.ChannelTypeOpenRouter { req.Header.Set("HTTP-Referer", "https://github.com/songquanpeng/one-api") req.Header.Set("X-Title", "One API") diff --git a/model/channel.go b/model/channel.go index 5c495bab..680f18bb 100644 --- a/model/channel.go +++ b/model/channel.go @@ -9,6 +9,7 @@ type Channel struct { Id int `json:"id"` Type int `json:"type" gorm:"default:0"` Key string `json:"key" gorm:"not null;index"` + OpenAIOrganization *string `json:"openai_organization"` Status int `json:"status" gorm:"default:1"` Name string `json:"name" gorm:"index"` Weight int `json:"weight"` diff --git a/web/src/pages/Channel/EditChannel.js b/web/src/pages/Channel/EditChannel.js index 78ff1952..dffdd141 100644 --- a/web/src/pages/Channel/EditChannel.js +++ b/web/src/pages/Channel/EditChannel.js @@ -38,6 +38,7 @@ const EditChannel = () => { name: '', type: 1, key: '', + openai_organization:'', base_url: '', other: '', model_mapping: '', @@ -418,6 +419,16 @@ const EditChannel = () => { /> } + + + { !isEdit && (