From fff889742b91ad865ba27a8112c32c10441ba311 Mon Sep 17 00:00:00 2001 From: wood Date: Wed, 15 Nov 2023 03:13:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E4=B8=BA=E6=A8=A1=E5=9E=8B=E5=8D=95=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- common/model-ratio.go | 52 ++++++++++++++++----------------- controller/relay-text.go | 4 ++- web/src/components/LogsTable.js | 2 +- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 889a96a2..020ee240 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ docker pull woodchen/czloapi - [x] 当用户充值达到5刀时,自动提升为vip分组; - [x] 修改颜色 -- [x] 日志页面新增快速筛选日期、修复渠道ID查询、自动更新消耗额度、修改日志详情(因为没有太大意义); +- [x] 日志页面新增快速筛选日期、修复渠道ID查询、自动更新消耗额度、修改日志详情; - [x] 用户管理界面,支持快速设置用户组,在`web\src\components\UsersTable.js`处修改相关值; - [x] 令牌界面,删除无用的多种复制、聊天等按钮; - [x] 删除系统访问令牌; diff --git a/common/model-ratio.go b/common/model-ratio.go index e15f8bee..e895f4fd 100644 --- a/common/model-ratio.go +++ b/common/model-ratio.go @@ -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 { diff --git a/controller/relay-text.go b/controller/relay-text.go index 090d9cfb..722e2331 100644 --- a/controller/relay-text.go +++ b/controller/relay-text.go @@ -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) diff --git a/web/src/components/LogsTable.js b/web/src/components/LogsTable.js index 2bb44bb5..7478035e 100644 --- a/web/src/components/LogsTable.js +++ b/web/src/components/LogsTable.js @@ -414,7 +414,7 @@ const LogsTable = () => { }} width={isAdminUser ? 4 : 6} > - 详情(1=$0.002/1K tokens) + 详情