Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2a961f1c
authored
Sep 15, 2023
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 渠道支持指定组织
parent
76c0c791
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
1 deletions
+17
-1
README.md
+2
-1
controller/relay-text.go
+3
-0
model/channel.go
+1
-0
web/src/pages/Channel/EditChannel.js
+11
-0
No files found.
README.md
View file @
2a961f1c
...
...
@@ -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
)
)
...
...
controller/relay-text.go
View file @
2a961f1c
...
...
@@ -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"
)
...
...
model/channel.go
View file @
2a961f1c
...
...
@@ -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"`
...
...
web/src/pages/Channel/EditChannel.js
View file @
2a961f1c
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment