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
37cc9c24
authored
Aug 16, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support gpt-4o-gizmo-* (close #436)
parent
7a3ca166
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletions
+16
-1
common/model-ratio.go
+9
-1
model/cache.go
+3
-0
relay/relay-text.go
+4
-0
No files found.
common/model-ratio.go
View file @
37cc9c24
...
...
@@ -24,6 +24,7 @@ const (
var
defaultModelRatio
=
map
[
string
]
float64
{
//"midjourney": 50,
"gpt-4-gizmo-*"
:
15
,
"gpt-4o-gizmo-*"
:
2.5
,
"gpt-4-all"
:
15
,
"gpt-4o-all"
:
15
,
"gpt-4"
:
15
,
...
...
@@ -187,7 +188,7 @@ var defaultModelPrice = map[string]float64{
}
var
(
modelPriceMap
=
make
(
map
[
string
]
float64
)
modelPriceMap
map
[
string
]
float64
=
nil
modelPriceMapMutex
=
sync
.
RWMutex
{}
)
var
(
...
...
@@ -198,6 +199,7 @@ var (
var
CompletionRatio
map
[
string
]
float64
=
nil
var
defaultCompletionRatio
=
map
[
string
]
float64
{
"gpt-4-gizmo-*"
:
2
,
"gpt-4o-gizmo-*"
:
3
,
"gpt-4-all"
:
2
,
}
...
...
@@ -232,6 +234,9 @@ func GetModelPrice(name string, printErr bool) (float64, bool) {
if
strings
.
HasPrefix
(
name
,
"gpt-4-gizmo"
)
{
name
=
"gpt-4-gizmo-*"
}
if
strings
.
HasPrefix
(
name
,
"gpt-4o-gizmo"
)
{
name
=
"gpt-4o-gizmo-*"
}
price
,
ok
:=
modelPriceMap
[
name
]
if
!
ok
{
if
printErr
{
...
...
@@ -312,6 +317,9 @@ func GetCompletionRatio(name string) float64 {
if
strings
.
HasPrefix
(
name
,
"gpt-4-gizmo"
)
{
name
=
"gpt-4-gizmo-*"
}
if
strings
.
HasPrefix
(
name
,
"gpt-4o-gizmo"
)
{
name
=
"gpt-4o-gizmo-*"
}
if
strings
.
HasPrefix
(
name
,
"gpt-3.5"
)
{
if
name
==
"gpt-3.5-turbo"
||
strings
.
HasSuffix
(
name
,
"0125"
)
{
// https://openai.com/blog/new-embedding-models-and-api-updates
...
...
model/cache.go
View file @
37cc9c24
...
...
@@ -270,6 +270,9 @@ func CacheGetRandomSatisfiedChannel(group string, model string, retry int) (*Cha
if
strings
.
HasPrefix
(
model
,
"gpt-4-gizmo"
)
{
model
=
"gpt-4-gizmo-*"
}
if
strings
.
HasPrefix
(
model
,
"gpt-4o-gizmo"
)
{
model
=
"gpt-4o-gizmo-*"
}
// if memory cache is disabled, get channel directly from database
if
!
common
.
MemoryCacheEnabled
{
...
...
relay/relay-text.go
View file @
37cc9c24
...
...
@@ -354,6 +354,10 @@ func postConsumeQuota(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, modelN
logModel
=
"gpt-4-gizmo-*"
logContent
+=
fmt
.
Sprintf
(
",模型 %s"
,
modelName
)
}
if
strings
.
HasPrefix
(
logModel
,
"gpt-4o-gizmo"
)
{
logModel
=
"gpt-4o-gizmo-*"
logContent
+=
fmt
.
Sprintf
(
",模型 %s"
,
modelName
)
}
if
extraContent
!=
""
{
logContent
+=
", "
+
extraContent
}
...
...
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