refactor: 使用 go-sora2api SDK 替代自建 Sora 客户端

使用 go-sora2api v1.1.0 SDK 替代原有 ~2000 行自建 HTTP/PoW/TLS 指纹代码,
SDK 提供高并发性能优化(实例级 rand、PoW 缓冲区复用、context.Context 支持)。

- 新增 SoraSDKClient 适配器实现 SoraClient 接口
- 精简 sora_client.go 为仅保留接口和类型定义
- 更新 Wire 绑定使用 SoraSDKClient
- 删除 SoraDirectClient、sora_curl_cffi_sidecar、sora_request_guard 等旧代码

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
huangenjun
2026-02-25 10:15:38 +08:00
parent ded9b6c14e
commit 3c619a8da5
12 changed files with 880 additions and 4150 deletions

View File

@@ -9,6 +9,7 @@ import (
"io"
"log"
"math"
"math/rand"
"mime"
"net"
"net/http"
@@ -669,7 +670,7 @@ func processSoraCharacterUsername(usernameHint string) string {
if usernameHint == "" {
usernameHint = "character"
}
return fmt.Sprintf("%s%d", usernameHint, soraRandInt(900)+100)
return fmt.Sprintf("%s%d", usernameHint, rand.Intn(900)+100)
}
func (s *SoraGatewayService) resolveWatermarkFreeURL(ctx context.Context, account *Account, generationID string, opts soraWatermarkOptions) (string, string, error) {