Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
ffe43f60
"frontend/src/vscode:/vscode.git/clone" did not exist on "fb99ceacc7ff33a90fd34197ceb6d2fb6fe75cf1"
Commit
ffe43f60
authored
Jan 27, 2026
by
cyhhao
Browse files
Merge branch 'main' of github.com:Wei-Shaw/sub2api
parents
a161fcc8
56a1e29c
Changes
2
Hide whitespace changes
Inline
Side-by-side
.github/workflows/release.yml
View file @
ffe43f60
...
@@ -222,8 +222,9 @@ jobs:
...
@@ -222,8 +222,9 @@ jobs:
REPO="${{ github.repository }}"
REPO="${{ github.repository }}"
GHCR_IMAGE="ghcr.io/${REPO,,}" # ${,,} converts to lowercase
GHCR_IMAGE="ghcr.io/${REPO,,}" # ${,,} converts to lowercase
# 获取 tag message 内容
# 获取 tag message 内容
并转义 Markdown 特殊字符
TAG_MESSAGE='${{ steps.tag_message.outputs.message }}'
TAG_MESSAGE='${{ steps.tag_message.outputs.message }}'
TAG_MESSAGE=$(echo "$TAG_MESSAGE" | sed 's/\([_*`\[]\)/\\\1/g')
# 限制消息长度(Telegram 消息限制 4096 字符,预留空间给头尾固定内容)
# 限制消息长度(Telegram 消息限制 4096 字符,预留空间给头尾固定内容)
if [ ${#TAG_MESSAGE} -gt 3500 ]; then
if [ ${#TAG_MESSAGE} -gt 3500 ]; then
...
...
backend/internal/service/gateway_service.go
View file @
ffe43f60
...
@@ -4102,19 +4102,12 @@ func (s *GatewayService) parseSSEUsage(data string, usage *ClaudeUsage) {
...
@@ -4102,19 +4102,12 @@ func (s *GatewayService) parseSSEUsage(data string, usage *ClaudeUsage) {
}
`json:"usage"`
}
`json:"usage"`
}
}
if
json
.
Unmarshal
([]
byte
(
data
),
&
msgDelta
)
==
nil
&&
msgDelta
.
Type
==
"message_delta"
{
if
json
.
Unmarshal
([]
byte
(
data
),
&
msgDelta
)
==
nil
&&
msgDelta
.
Type
==
"message_delta"
{
// output_tokens 总是从 message_delta 获取
// message_delta 是推理结束后的最终统计,应完全覆盖 message_start 的数据
// 这对于 Claude API 和 GLM 等兼容 API 都是正确的行为
usage
.
InputTokens
=
msgDelta
.
Usage
.
InputTokens
usage
.
OutputTokens
=
msgDelta
.
Usage
.
OutputTokens
usage
.
OutputTokens
=
msgDelta
.
Usage
.
OutputTokens
usage
.
CacheCreationInputTokens
=
msgDelta
.
Usage
.
CacheCreationInputTokens
// 如果 message_start 中没有值,则从 message_delta 获取(兼容GLM等API)
usage
.
CacheReadInputTokens
=
msgDelta
.
Usage
.
CacheReadInputTokens
if
usage
.
InputTokens
==
0
{
usage
.
InputTokens
=
msgDelta
.
Usage
.
InputTokens
}
if
usage
.
CacheCreationInputTokens
==
0
{
usage
.
CacheCreationInputTokens
=
msgDelta
.
Usage
.
CacheCreationInputTokens
}
if
usage
.
CacheReadInputTokens
==
0
{
usage
.
CacheReadInputTokens
=
msgDelta
.
Usage
.
CacheReadInputTokens
}
}
}
}
}
...
...
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