From 7ab6c6c303610a335c8db9c574b6e918f5eef159 Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Sat, 9 Mar 2024 13:25:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dclaude=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E6=B5=81=E6=A8=A1=E5=BC=8F=E8=AE=A1=E8=B4=B9=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- relay/channel/claude/relay-claude.go | 4 ++++ web/src/constants/channel.constants.js | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/relay/channel/claude/relay-claude.go b/relay/channel/claude/relay-claude.go index db29fe8..0e9aa42 100644 --- a/relay/channel/claude/relay-claude.go +++ b/relay/channel/claude/relay-claude.go @@ -278,6 +278,10 @@ func claudeStreamHandler(requestMode int, modelName string, promptTokens int, c } if requestMode == RequestModeCompletion { usage = *service.ResponseText2Usage(responseText, modelName, promptTokens) + } else { + if usage.CompletionTokens == 0 { + usage = *service.ResponseText2Usage(responseText, modelName, usage.PromptTokens) + } } return nil, &usage } diff --git a/web/src/constants/channel.constants.js b/web/src/constants/channel.constants.js index 0e0ebc1..32f76ef 100644 --- a/web/src/constants/channel.constants.js +++ b/web/src/constants/channel.constants.js @@ -1,15 +1,15 @@ export const CHANNEL_OPTIONS = [ {key: 1, text: 'OpenAI', value: 1, color: 'green', label: 'OpenAI'}, {key: 2, text: 'Midjourney Proxy', value: 2, color: 'light-blue', label: 'Midjourney Proxy'}, - {key: 14, text: 'Anthropic Claude', value: 14, color: 'black', label: 'Anthropic Claude'}, - {key: 3, text: 'Azure OpenAI', value: 3, color: 'olive', label: 'Azure OpenAI'}, + {key: 14, text: 'Anthropic Claude', value: 14, color: 'indigo', label: 'Anthropic Claude'}, + {key: 3, text: 'Azure OpenAI', value: 3, color: 'teal', label: 'Azure OpenAI'}, {key: 11, text: 'Google PaLM2', value: 11, color: 'orange', label: 'Google PaLM2'}, {key: 24, text: 'Google Gemini', value: 24, color: 'orange', label: 'Google Gemini'}, {key: 15, text: '百度文心千帆', value: 15, color: 'blue', label: '百度文心千帆'}, {key: 17, text: '阿里通义千问', value: 17, color: 'orange', label: '阿里通义千问'}, {key: 18, text: '讯飞星火认知', value: 18, color: 'blue', label: '讯飞星火认知'}, {key: 16, text: '智谱 ChatGLM', value: 16, color: 'violet', label: '智谱 ChatGLM'}, - {key: 16, text: '智谱 GLM-4V', value: 26, color: 'green', label: '智谱 GLM-4V'}, + {key: 16, text: '智谱 GLM-4V', value: 26, color: 'purple', label: '智谱 GLM-4V'}, {key: 16, text: 'Moonshot', value: 25, color: 'green', label: 'Moonshot'}, {key: 19, text: '360 智脑', value: 19, color: 'blue', label: '360 智脑'}, {key: 23, text: '腾讯混元', value: 23, color: 'teal', label: '腾讯混元'},