refactor: 彻底移除 Sora 视频生成模块(全栈清理)
## 后端变更 - 删除 21 个 sora_*.go 服务文件(service/handler/repository/routes) - 删除 Sora 相关 migration 文件(046/047/063/090) - 清理 config 中的 sora_* 配置项和平台常量 - 清理 wire 依赖注入中的 Sora 组件 - 修复 wire_gen.go 语法错误(缺少逗号和闭合括号) - 移除 go.mod 中的 go-sora2api 依赖 - 更新 ent schema usage_log.go 注释 ## 前端变更 - 删除 SoraView、SoraAdminView 及 8 个 Sora 子组件 - 删除 sora API 层和路由配置 - 清理 UserEditModal 中的 Sora 存储配额 UI - 清理 types/index.ts 中 Sora 相关类型定义 - 清理 stores/app.ts 默认配置 - 清理 i18n 翻译文件 en.ts/zh.ts (~110 行) - 更新相关测试文件 ## 文档更新 - README.md / README_CN.md / README_JA.md: 移除 Sora 状态说明和配置段落 - PROJECT_DIFF.md: 移除 Sora 相关差异描述 ## 验证结果 - ✅ Go 编译通过 (go build ./...) - ✅ TypeScript 类型检查通过 (vue-tsc --noEmit) - ✅ 后端测试全通过 (0 failures) - ✅ 前端测试全通过 (59 files, 329 tests, 0 failures) - ✅ 前端生产构建成功 (23.81s)
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
// - billing.go — BillingConfig, PricingConfig
|
||||
// - gateway.go — GatewayConfig, UserMessageQueue, SchedulingConfig
|
||||
// - gateway_sub.go — OpenAIWS, UsageRecord, TLSFingerprint sub-structs
|
||||
// - platforms.go — Sora, Gemini, LinuxDo, OIDC, Update, Idempotency configs
|
||||
// - platforms.go — Gemini, LinuxDo, OIDC, Update, Idempotency configs
|
||||
// - ops_and_cache.go— LogConfig, OpsConfig, Dashboard, Cache, Cleanup configs
|
||||
package config
|
||||
|
||||
@@ -79,7 +79,6 @@ type Config struct {
|
||||
TokenRefresh TokenRefreshConfig `mapstructure:"token_refresh"`
|
||||
RunMode string `mapstructure:"run_mode" yaml:"run_mode"`
|
||||
Timezone string `mapstructure:"timezone"`
|
||||
Sora SoraConfig `mapstructure:"sora"`
|
||||
Gemini GeminiConfig `mapstructure:"gemini"`
|
||||
Update UpdateConfig `mapstructure:"update"`
|
||||
Idempotency IdempotencyConfig `mapstructure:"idempotency"`
|
||||
|
||||
@@ -49,7 +49,6 @@ func TestConfigStructIntegrity(t *testing.T) {
|
||||
assert.IsType(t, GatewaySchedulingConfig{}, cfg.Gateway.Scheduling)
|
||||
assert.IsType(t, GatewayOpenAIWSSchedulerScoreWeights{}, cfg.Gateway.OpenAIWS.SchedulerScoreWeights)
|
||||
|
||||
assert.IsType(t, SoraConfig{}, cfg.Sora)
|
||||
assert.IsType(t, GeminiConfig{}, cfg.Gemini)
|
||||
assert.IsType(t, UpdateConfig{}, cfg.Update)
|
||||
assert.IsType(t, IdempotencyConfig{}, cfg.Idempotency)
|
||||
@@ -168,14 +167,6 @@ func TestUserMessageQueueConfig_Methods(t *testing.T) {
|
||||
if q.GetEffectiveMode() != "" { t.Error("disabled+empty → empty") }
|
||||
}
|
||||
|
||||
func TestSoraConfigFields(t *testing.T) {
|
||||
s := SoraConfig{
|
||||
Client: SoraClientConfig{BaseURL: "https://sora.example.com"},
|
||||
Storage: SoraStorageConfig{Type: "local"},
|
||||
}
|
||||
if s.Client.BaseURL != "https://sora.example.com" { t.Error("BaseURL mismatch") }
|
||||
}
|
||||
|
||||
func TestGeminiConfigFields(t *testing.T) {
|
||||
g := GeminiConfig{Quota: GeminiQuotaConfig{Policy: "conservative"}}
|
||||
if g.Quota.Policy != "conservative" { t.Error("Policy mismatch") }
|
||||
|
||||
@@ -322,7 +322,6 @@ func TestIntegration_AllDomainFiles_ContributeToFullConfig(t *testing.T) {
|
||||
{"UsageCleanup/Enabled", func(c *Config) bool { return true }},
|
||||
{"Concurrency/PingInterval", func(c *Config) bool { return c.Concurrency.PingInterval > 0 }},
|
||||
{"TokenRefresh/Enabled", func(c *Config) bool { return true }},
|
||||
{"Sora", func(c *Config) bool { return true }},
|
||||
{"Gemini", func(c *Config) bool { return true }},
|
||||
{"Update", func(c *Config) bool { return true }},
|
||||
{"Idempotency/TTL", func(c *Config) bool { return c.Idempotency.DefaultTTLSeconds > 0 }},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package config
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
@@ -36,16 +36,6 @@ type GatewayConfig struct {
|
||||
InjectBetaForAPIKey bool `mapstructure:"inject_beta_for_apikey"`
|
||||
FailoverOn400 bool `mapstructure:"failover_on_400"`
|
||||
|
||||
// Sora 专用配置
|
||||
SoraMaxBodySize int64 `mapstructure:"sora_max_body_size"`
|
||||
SoraStreamTimeoutSeconds int `mapstructure:"sora_stream_timeout_seconds"`
|
||||
SoraRequestTimeoutSeconds int `mapstructure:"sora_request_timeout_seconds"`
|
||||
SoraStreamMode string `mapstructure:"sora_stream_mode"`
|
||||
SoraModelFilters SoraModelFiltersConfig `mapstructure:"sora_model_filters"`
|
||||
SoraMediaRequireAPIKey bool `mapstructure:"sora_media_require_api_key"`
|
||||
SoraMediaSigningKey string `mapstructure:"sora_media_signing_key"`
|
||||
SoraMediaSignedURLTTLSeconds int `mapstructure:"sora_media_signed_url_ttl_seconds"`
|
||||
|
||||
MaxAccountSwitches int `mapstructure:"max_account_switches"`
|
||||
MaxAccountSwitchesGemini int `mapstructure:"max_account_switches_gemini"`
|
||||
AntigravityFallbackCooldownMinutes int `mapstructure:"antigravity_fallback_cooldown_minutes"`
|
||||
|
||||
@@ -1,63 +1,5 @@
|
||||
package config
|
||||
|
||||
// SoraConfig 直连 Sora 配置
|
||||
type SoraConfig struct {
|
||||
Client SoraClientConfig `mapstructure:"client"`
|
||||
Storage SoraStorageConfig `mapstructure:"storage"`
|
||||
}
|
||||
|
||||
// SoraClientConfig Sora 客户端配置
|
||||
type SoraClientConfig struct {
|
||||
BaseURL string `mapstructure:"base_url"`
|
||||
TimeoutSeconds int `mapstructure:"timeout_seconds"`
|
||||
MaxRetries int `mapstructure:"max_retries"`
|
||||
CloudflareChallengeCooldownSeconds int `mapstructure:"cloudflare_challenge_cooldown_seconds"`
|
||||
PollIntervalSeconds int `mapstructure:"poll_interval_seconds"`
|
||||
MaxPollAttempts int `mapstructure:"max_poll_attempts"`
|
||||
RecentTaskLimit int `mapstructure:"recent_task_limit"`
|
||||
RecentTaskLimitMax int `mapstructure:"recent_task_limit_max"`
|
||||
Debug bool `mapstructure:"debug"`
|
||||
UseOpenAITokenProvider bool `mapstructure:"use_openai_token_provider"`
|
||||
Headers map[string]string `mapstructure:"headers"`
|
||||
UserAgent string `mapstructure:"user_agent"`
|
||||
DisableTLSFingerprint bool `mapstructure:"disable_tls_fingerprint"`
|
||||
CurlCFFISidecar SoraCurlCFFISidecarConfig `mapstructure:"curl_cffi_sidecar"`
|
||||
}
|
||||
|
||||
// SoraCurlCFFISidecarConfig Sora curl_cffi sidecar 配置
|
||||
type SoraCurlCFFISidecarConfig struct {
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
BaseURL string `mapstructure:"base_url"`
|
||||
Impersonate string `mapstructure:"impersonate"`
|
||||
TimeoutSeconds int `mapstructure:"timeout_seconds"`
|
||||
SessionReuseEnabled bool `mapstructure:"session_reuse_enabled"`
|
||||
SessionTTLSeconds int `mapstructure:"session_ttl_seconds"`
|
||||
}
|
||||
|
||||
// SoraStorageConfig 媒体存储配置
|
||||
type SoraStorageConfig struct {
|
||||
Type string `mapstructure:"type"`
|
||||
LocalPath string `mapstructure:"local_path"`
|
||||
FallbackToUpstream bool `mapstructure:"fallback_to_upstream"`
|
||||
MaxConcurrentDownloads int `mapstructure:"max_concurrent_downloads"`
|
||||
DownloadTimeoutSeconds int `mapstructure:"download_timeout_seconds"`
|
||||
MaxDownloadBytes int64 `mapstructure:"max_download_bytes"`
|
||||
Debug bool `mapstructure:"debug"`
|
||||
Cleanup SoraStorageCleanupConfig `mapstructure:"cleanup"`
|
||||
}
|
||||
|
||||
// SoraStorageCleanupConfig 媒体清理配置
|
||||
type SoraStorageCleanupConfig struct {
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
Schedule string `mapstructure:"schedule"`
|
||||
RetentionDays int `mapstructure:"retention_days"`
|
||||
}
|
||||
|
||||
// SoraModelFiltersConfig Sora 模型过滤配置
|
||||
type SoraModelFiltersConfig struct {
|
||||
HidePromptEnhance bool `mapstructure:"hide_prompt_envelope"`
|
||||
}
|
||||
|
||||
// GeminiConfig Gemini 配置
|
||||
type GeminiConfig struct {
|
||||
OAuth GeminiOAuthConfig `mapstructure:"oauth"`
|
||||
|
||||
Reference in New Issue
Block a user