revert: completely remove all Sora functionality
This commit is contained in:
@@ -363,28 +363,6 @@ func TestCalculateImageCost(t *testing.T) {
|
||||
require.InDelta(t, 0.134*3, cost.ActualCost, 1e-10)
|
||||
}
|
||||
|
||||
func TestCalculateSoraVideoCost(t *testing.T) {
|
||||
svc := newTestBillingService()
|
||||
|
||||
price := 0.5
|
||||
cfg := &SoraPriceConfig{VideoPricePerRequest: &price}
|
||||
cost := svc.CalculateSoraVideoCost("sora-video", cfg, 1.0)
|
||||
|
||||
require.InDelta(t, 0.5, cost.TotalCost, 1e-10)
|
||||
}
|
||||
|
||||
func TestCalculateSoraVideoCost_HDModel(t *testing.T) {
|
||||
svc := newTestBillingService()
|
||||
|
||||
hdPrice := 1.0
|
||||
normalPrice := 0.5
|
||||
cfg := &SoraPriceConfig{
|
||||
VideoPricePerRequest: &normalPrice,
|
||||
VideoPricePerRequestHD: &hdPrice,
|
||||
}
|
||||
cost := svc.CalculateSoraVideoCost("sora2pro-hd", cfg, 1.0)
|
||||
require.InDelta(t, 1.0, cost.TotalCost, 1e-10)
|
||||
}
|
||||
|
||||
func TestIsModelSupported(t *testing.T) {
|
||||
svc := newTestBillingService()
|
||||
@@ -464,33 +442,6 @@ func TestForceUpdatePricing_NilService(t *testing.T) {
|
||||
require.Contains(t, err.Error(), "not initialized")
|
||||
}
|
||||
|
||||
func TestCalculateSoraImageCost(t *testing.T) {
|
||||
svc := newTestBillingService()
|
||||
|
||||
price360 := 0.05
|
||||
price540 := 0.08
|
||||
cfg := &SoraPriceConfig{ImagePrice360: &price360, ImagePrice540: &price540}
|
||||
|
||||
cost := svc.CalculateSoraImageCost("360", 2, cfg, 1.0)
|
||||
require.InDelta(t, 0.10, cost.TotalCost, 1e-10)
|
||||
|
||||
cost540 := svc.CalculateSoraImageCost("540", 1, cfg, 2.0)
|
||||
require.InDelta(t, 0.08, cost540.TotalCost, 1e-10)
|
||||
require.InDelta(t, 0.16, cost540.ActualCost, 1e-10)
|
||||
}
|
||||
|
||||
func TestCalculateSoraImageCost_ZeroCount(t *testing.T) {
|
||||
svc := newTestBillingService()
|
||||
cost := svc.CalculateSoraImageCost("360", 0, nil, 1.0)
|
||||
require.Equal(t, 0.0, cost.TotalCost)
|
||||
}
|
||||
|
||||
func TestCalculateSoraVideoCost_NilConfig(t *testing.T) {
|
||||
svc := newTestBillingService()
|
||||
cost := svc.CalculateSoraVideoCost("sora-video", nil, 1.0)
|
||||
require.Equal(t, 0.0, cost.TotalCost)
|
||||
}
|
||||
|
||||
func TestCalculateCostWithLongContext_PropagatesError(t *testing.T) {
|
||||
// 使用空的 fallback prices 让 GetModelPricing 失败
|
||||
svc := &BillingService{
|
||||
|
||||
Reference in New Issue
Block a user