修改日志详情为模型单价

This commit is contained in:
wood 2023-11-15 03:13:31 +08:00
parent 724ca3ccd8
commit fff889742b
4 changed files with 31 additions and 29 deletions

View File

@ -7,7 +7,7 @@ docker pull woodchen/czloapi
- [x] 当用户充值达到5刀时自动提升为vip分组
- [x] 修改颜色
- [x] 日志页面新增快速筛选日期、修复渠道ID查询、自动更新消耗额度、修改日志详情(因为没有太大意义)
- [x] 日志页面新增快速筛选日期、修复渠道ID查询、自动更新消耗额度、修改日志详情
- [x] 用户管理界面,支持快速设置用户组,在`web\src\components\UsersTable.js`处修改相关值;
- [x] 令牌界面,删除无用的多种复制、聊天等按钮;
- [x] 删除系统访问令牌;

View File

@ -20,15 +20,15 @@ var ModelRatio = map[string]float64{
"gpt-4-32k": 30,
"gpt-4-32k-0314": 30,
"gpt-4-32k-0613": 30,
"gpt-4-1106-preview": 5, // $0.01 / 1K tokens
"gpt-4-vision-preview": 5, // $0.01 / 1K tokens
"gpt-3.5-turbo": 0.75, // $0.0015 / 1K tokens
"gpt-4-1106-preview": 5,
"gpt-4-vision-preview": 5,
"gpt-3.5-turbo": 0.75,
"gpt-3.5-turbo-0301": 0.75,
"gpt-3.5-turbo-0613": 0.75,
"gpt-3.5-turbo-16k": 1.5, // $0.003 / 1K tokens
"gpt-3.5-turbo-16k": 1.5,
"gpt-3.5-turbo-16k-0613": 1.5,
"gpt-3.5-turbo-instruct": 0.75, // $0.0015 / 1K tokens
"gpt-3.5-turbo-1106": 0.5, // $0.001 / 1K tokens
"gpt-3.5-turbo-instruct": 0.75,
"gpt-3.5-turbo-1106": 0.5,
"text-ada-001": 0.2,
"text-babbage-001": 0.25,
"text-curie-001": 1,
@ -36,7 +36,7 @@ var ModelRatio = map[string]float64{
"text-davinci-003": 10,
"text-davinci-edit-001": 10,
"code-davinci-edit-001": 10,
"whisper-1": 15, // $0.006 / minute -> $0.006 / 150 words -> $0.006 / 200 tokens -> $0.03 / 1k tokens
"whisper-1": 15,
"davinci": 10,
"curie": 10,
"babbage": 10,
@ -47,26 +47,26 @@ var ModelRatio = map[string]float64{
"text-moderation-latest": 0.1,
"dall-e": 8,
"dall-e-3": 20,
"claude-instant-1": 0.815, // $1.63 / 1M tokens
"claude-2": 5.51, // $11.02 / 1M tokens
"ERNIE-Bot": 0.8572, // ¥0.012 / 1k tokens
"ERNIE-Bot-turbo": 0.5715, // ¥0.008 / 1k tokens
"ERNIE-Bot-4": 8.572, // ¥0.12 / 1k tokens
"Embedding-V1": 0.1429, // ¥0.002 / 1k tokens
"claude-instant-1": 0.815,
"claude-2": 5.51,
"ERNIE-Bot": 0.8572,
"ERNIE-Bot-turbo": 0.5715,
"ERNIE-Bot-4": 8.572,
"Embedding-V1": 0.1429,
"PaLM-2": 1,
"chatglm_turbo": 0.3572, // ¥0.005 / 1k tokens
"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-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
"embedding-bert-512-v1": 0.0715, // ¥0.001 / 1k tokens
"embedding_s1_v1": 0.0715, // ¥0.001 / 1k tokens
"semantic_similarity_s1_v1": 0.0715, // ¥0.001 / 1k tokens
"hunyuan": 7.143, // ¥0.1 / 1k tokens // https://cloud.tencent.com/document/product/1729/97731#e0e6be58-60c8-469f-bdeb-6c264ce3b4d0
"chatglm_turbo": 0.3572,
"chatglm_pro": 0.7143,
"chatglm_std": 0.3572,
"chatglm_lite": 0.1429,
"qwen-turbo": 0.8572,
"qwen-plus": 10,
"text-embedding-v1": 0.05,
"SparkDesk": 1.2858,
"360GPT_S2_V9": 0.8572,
"embedding-bert-512-v1": 0.0715,
"embedding_s1_v1": 0.0715,
"semantic_similarity_s1_v1": 0.0715,
"hunyuan": 7.143,
}
func ModelRatio2JSONString() string {

View File

@ -435,7 +435,9 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
common.LogError(ctx, "error update user quota cache: "+err.Error())
}
if quota != 0 {
logContent := fmt.Sprintf("模型倍率 %.4f", modelRatio)
// logContent := fmt.Sprintf("模型倍率 %.4f", modelRatio)
ratio = ratio * 0.002
logContent := fmt.Sprintf("提示: $%.10g/1k tokens", ratio)
model.RecordConsumeLog(ctx, userId, channelId, promptTokens, completionTokens, textRequest.Model, tokenName, quota, logContent)
model.UpdateUserUsedQuotaAndRequestCount(userId, quota)
model.UpdateChannelUsedQuota(channelId, quota)

View File

@ -414,7 +414,7 @@ const LogsTable = () => {
}}
width={isAdminUser ? 4 : 6}
>
详情(1=$0.002/1K tokens)
详情
</Table.HeaderCell>
</Table.Row>
</Table.Header>