Merge pull request #824 from pkssssss/fix/ws-usage-window-pr

fix(openai): 修复 WS 模式下用量窗口不显示
This commit is contained in:
Wesley Liddick
2026-03-06 22:45:36 +08:00
committed by GitHub
9 changed files with 410 additions and 12 deletions

View File

@@ -218,6 +218,7 @@ type OpenAIForwardResult struct {
ReasoningEffort *string
Stream bool
OpenAIWSMode bool
ResponseHeaders http.Header
Duration time.Duration
FirstTokenMs *int
}
@@ -3884,6 +3885,15 @@ func (s *OpenAIGatewayService) updateCodexUsageSnapshot(ctx context.Context, acc
}()
}
func (s *OpenAIGatewayService) UpdateCodexUsageSnapshotFromHeaders(ctx context.Context, accountID int64, headers http.Header) {
if accountID <= 0 || headers == nil {
return
}
if snapshot := ParseCodexRateLimitHeaders(headers); snapshot != nil {
s.updateCodexUsageSnapshot(ctx, accountID, snapshot)
}
}
func getOpenAIReasoningEffortFromReqBody(reqBody map[string]any) (value string, present bool) {
if reqBody == nil {
return "", false