mirror of
https://gh-proxy.org/https://github.com/klinsmaya/CLIProxyAPI.git
synced 2026-11-10 02:16:49 +08:00
* fix(usage): preserve request service tier metadata * fix(usage): collapse request tier metadata * fix(usage): emit only service_tier and response_service_tier Collapse request tier to service_tier for usage records and queue payloads. Keep RequestServiceTier as a deprecated input-only alias for older plugin callers.
31 lines
1.0 KiB
Go
31 lines
1.0 KiB
Go
package auth
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
cliproxyexecutor "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/executor"
|
|
coreusage "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/usage"
|
|
)
|
|
|
|
func TestContextWithRequestedModelAliasIncludesReasoningEffort(t *testing.T) {
|
|
ctx := contextWithRequestedModelAlias(context.Background(), cliproxyexecutor.Options{
|
|
Metadata: map[string]any{
|
|
cliproxyexecutor.RequestedModelMetadataKey: "client-model",
|
|
cliproxyexecutor.ReasoningEffortMetadataKey: "medium",
|
|
cliproxyexecutor.ServiceTierMetadataKey: "auto",
|
|
},
|
|
}, "fallback-model")
|
|
|
|
if got := coreusage.RequestedModelAliasFromContext(ctx); got != "client-model" {
|
|
t.Fatalf("requested model alias = %q, want %q", got, "client-model")
|
|
}
|
|
if got := coreusage.ReasoningEffortFromContext(ctx); got != "medium" {
|
|
t.Fatalf("reasoning effort = %q, want %q", got, "medium")
|
|
}
|
|
gotServiceTier := coreusage.ServiceTierFromContext(ctx)
|
|
if gotServiceTier != "auto" {
|
|
t.Fatalf("service tier = %q, want %q", gotServiceTier, "auto")
|
|
}
|
|
}
|