feat: 渠道支持指定组织
This commit is contained in:
parent
d1d789616f
commit
cc09dd4f9d
@ -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))
|
||||
|
@ -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")
|
||||
|
@ -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"`
|
||||
|
@ -38,6 +38,7 @@ const EditChannel = () => {
|
||||
name: '',
|
||||
type: 1,
|
||||
key: '',
|
||||
openai_organization:'',
|
||||
base_url: '',
|
||||
other: '',
|
||||
model_mapping: '',
|
||||
@ -418,6 +419,16 @@ const EditChannel = () => {
|
||||
/>
|
||||
</Form.Field>
|
||||
}
|
||||
<Form.Field>
|
||||
<Form.Input
|
||||
label='组织,可选,不填则为默认组织'
|
||||
name='openai_organization'
|
||||
placeholder='请输入组织org-xxx'
|
||||
onChange={handleInputChange}
|
||||
value={inputs.openai_organization}
|
||||
autoComplete='new-password'
|
||||
/>
|
||||
</Form.Field>
|
||||
{
|
||||
!isEdit && (
|
||||
<Form.Checkbox
|
||||
|
Loading…
Reference in New Issue
Block a user