Skip to content

v0.5.0

Choose a tag to compare

@pardnchiu pardnchiu released this 11 Aug 14:10
· 7 commits to master since this release
6788e33

v0.4.1 -> v0.5.0

Summary

Unifies cross-provider token streaming behind a shared SSE layer and brings remaining backends online, including Gemini. Hardens stream error surfaces with typed failures and clearer upstream diagnostics.

翻譯

以共用 SSE 層統一跨供應商 token 串流,並補齊其餘後端(含 Gemini)。以型別化錯誤與更清楚的上游診斷強化串流失敗表面。

⚠️ Breaking Changes

core.OpenStream no longer returns HTTP status

Before:

func OpenStream(ctx context.Context, client *http.Client, url string, headers map[string]string, body map[string]any, label string) (*http.Response, int, error)

After:

func OpenStream(ctx context.Context, client *http.Client, url string, headers map[string]string, body map[string]any, label string) (*http.Response, error)

Migration:

// Old
resp, code, err := core.OpenStream(ctx, client, url, headers, body, label)
if err != nil {
    // use code or err
    _ = code
}

// New — status lives on *core.StreamError when the request fails
resp, err := core.OpenStream(ctx, client, url, headers, body, label)
if err != nil {
    var se *core.StreamError
    if errors.As(err, &se) {
        code := se.Code
        _ = code
    }
    return err
}
defer resp.Body.Close()
翻譯

OpenStream 不再回傳 HTTP status int。失敗時改以 *core.StreamError 承載 CodeBody/inner Err,呼叫端請用 errors.As 取出狀態碼。

Changes

BREAKING

翻譯
  • 變更 OpenStream 簽章:移除 status 回傳並改回 StreamError (@pardnchiu) [95b26bb]

FEAT

翻譯

UPDATE

翻譯
  • 將 OpenAI fast mode 的 service_tier 由 fast 改為 priority (@pardnchiu) [568315e]
  • reasoning delta 改為擇一輸出,不再串接雙欄位 (@pardnchiu) [95b26bb]
  • 改善各供應商串流/同步錯誤前綴與 body 長度上限 (@pardnchiu) [95b26bb]

REFACTOR

翻譯

Scope

  • core/stream.go, core/sse.go, core/type.go — BREAKING, FEAT, UPDATE, REFACTOR
  • core/gemini/ — FEAT (stream.go, send.go)
  • core/openai/, core/deepseek/, core/nvidia/, core/openRouter/, core/copilot/ — FEAT
  • core/grok/, core/compat/, core/claude/ — FEAT, REFACTOR
  • core/grokOauth/, core/openaiCodex/ — FEAT, UPDATE
  • core/cloudflare/ — FEAT (stream.go stub)
  • core/*/send.go — UPDATE (error prefixes, limits)

Generated by SKILL