mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 21:17:30 +00:00
fix: 修复claude SSE捕获usage问题
This commit is contained in:
@@ -1487,9 +1487,12 @@ class ClaudeRelayService {
|
||||
|
||||
for (const line of lines) {
|
||||
// 解析SSE数据寻找usage信息
|
||||
if (line.startsWith('data: ') && line.length > 6) {
|
||||
if (line.startsWith('data:')) {
|
||||
const jsonStr = line.slice(5).trimStart()
|
||||
if (!jsonStr || jsonStr === '[DONE]') {
|
||||
continue
|
||||
}
|
||||
try {
|
||||
const jsonStr = line.slice(6)
|
||||
const data = JSON.parse(jsonStr)
|
||||
|
||||
// 收集来自不同事件的usage数据
|
||||
|
||||
Reference in New Issue
Block a user