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
4199979c
authored
Sep 24, 2023
by
CaIon
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/main'
# Conflicts: # model/log.go
parents
3fcbf1f0
45adc7fc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
10 deletions
+18
-10
common/model-ratio.go
+3
-2
controller/model.go
+13
-4
model/log.go
+1
-3
web/src/pages/Channel/EditChannel.js
+1
-1
No files found.
common/model-ratio.go
View file @
4199979c
...
...
@@ -24,6 +24,7 @@ var ModelRatio = map[string]float64{
"gpt-3.5-turbo-0613"
:
0.75
,
"gpt-3.5-turbo-16k"
:
1.5
,
// $0.003 / 1K tokens
"gpt-3.5-turbo-16k-0613"
:
1.5
,
"gpt-3.5-turbo-instruct"
:
0.75
,
// $0.0015 / 1K tokens
"text-ada-001"
:
0.2
,
"text-babbage-001"
:
0.25
,
"text-curie-001"
:
1
,
...
...
@@ -50,8 +51,8 @@ var ModelRatio = map[string]float64{
"chatglm_pro"
:
0.7143
,
// ¥0.01 / 1k tokens
"chatglm_std"
:
0.3572
,
// ¥0.005 / 1k tokens
"chatglm_lite"
:
0.1429
,
// ¥0.002 / 1k tokens
"qwen-
v1"
:
0.8572
,
// ¥0.012 / 1k tokens
"qwen-plus
-v1"
:
1
,
// ¥0.0
14 / 1k tokens
"qwen-
turbo"
:
0.8572
,
// ¥0.012 / 1k tokens
"qwen-plus
"
:
10
,
// ¥0.
14 / 1k tokens
"text-embedding-v1"
:
0.05
,
// ¥0.0007 / 1k tokens
"SparkDesk"
:
1.2858
,
// ¥0.018 / 1k tokens
"360GPT_S2_V9"
:
0.8572
,
// ¥0.012 / 1k tokens
...
...
controller/model.go
View file @
4199979c
...
...
@@ -118,6 +118,15 @@ func init() {
Parent
:
nil
,
},
{
Id
:
"gpt-3.5-turbo-instruct"
,
Object
:
"model"
,
Created
:
1677649963
,
OwnedBy
:
"openai"
,
Permission
:
permission
,
Root
:
"gpt-3.5-turbo-instruct"
,
Parent
:
nil
,
},
{
Id
:
"gpt-4"
,
Object
:
"model"
,
Created
:
1677649963
,
...
...
@@ -343,21 +352,21 @@ func init() {
Parent
:
nil
,
},
{
Id
:
"qwen-
v1
"
,
Id
:
"qwen-
turbo
"
,
Object
:
"model"
,
Created
:
1677649963
,
OwnedBy
:
"ali"
,
Permission
:
permission
,
Root
:
"qwen-
v1
"
,
Root
:
"qwen-
turbo
"
,
Parent
:
nil
,
},
{
Id
:
"qwen-plus
-v1
"
,
Id
:
"qwen-plus"
,
Object
:
"model"
,
Created
:
1677649963
,
OwnedBy
:
"ali"
,
Permission
:
permission
,
Root
:
"qwen-plus
-v1
"
,
Root
:
"qwen-plus"
,
Parent
:
nil
,
},
{
...
...
model/log.go
View file @
4199979c
...
...
@@ -71,7 +71,6 @@ func RecordConsumeLog(ctx context.Context, userId int, channelId int, promptToke
ModelName
:
modelName
,
Quota
:
quota
,
Channel
:
channelId
,
TokenId
:
tokenId
,
}
err
:=
DB
.
Create
(
log
)
.
Error
if
err
!=
nil
{
...
...
@@ -164,7 +163,6 @@ func SumUsedQuota(logType int, startTimestamp int64, endTimestamp int64, modelNa
if
modelName
!=
""
{
tx
=
tx
.
Where
(
"model_name = ?"
,
modelName
)
}
if
channel
!=
0
{
tx
=
tx
.
Where
(
"channel = ?"
,
channel
)
}
...
...
@@ -173,7 +171,7 @@ func SumUsedQuota(logType int, startTimestamp int64, endTimestamp int64, modelNa
}
func
SumUsedToken
(
logType
int
,
startTimestamp
int64
,
endTimestamp
int64
,
modelName
string
,
username
string
,
tokenName
string
)
(
token
int
)
{
tx
:=
DB
.
Table
(
"logs"
)
.
Select
(
"
sum(prompt_tokens) + sum(completion_tokens
)"
)
tx
:=
DB
.
Table
(
"logs"
)
.
Select
(
"
ifnull(sum(prompt_tokens),0) + ifnull(sum(completion_tokens),0
)"
)
if
username
!=
""
{
tx
=
tx
.
Where
(
"username = ?"
,
username
)
}
...
...
web/src/pages/Channel/EditChannel.js
View file @
4199979c
...
...
@@ -68,7 +68,7 @@ const EditChannel = () => {
localModels
=
[
'ERNIE-Bot'
,
'ERNIE-Bot-turbo'
,
'Embedding-V1'
];
break
;
case
17
:
localModels
=
[
'qwen-
v1'
,
'qwen-plus-v1
'
,
'text-embedding-v1'
];
localModels
=
[
'qwen-
turbo'
,
'qwen-plus
'
,
'text-embedding-v1'
];
break
;
case
16
:
localModels
=
[
'chatglm_pro'
,
'chatglm_std'
,
'chatglm_lite'
];
...
...
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