P0 fixes: - ModelError.Is(): use exact matching instead of substring contains() - shouldClearStickySession: add context param for cancellation/tracing P1 fixes: - TODO stubs: return 501 Not Implemented errors - validateInstanceSignature: deduplicate to shared validateCodeSignature() - Error messages: standardize to English only - http.go: remove pseudo if-else with duplicate branches
20 lines
607 B
Go
20 lines
607 B
Go
package service
|
|
|
|
// resolveOpenAIForwardModel determines the upstream model for OpenAI-compatible
|
|
// forwarding. Group-level default mapping only applies when the account itself
|
|
// did not match any explicit model_mapping rule.
|
|
func resolveOpenAIForwardModel(account *Account, requestedModel, defaultMappedModel string) string {
|
|
if account == nil {
|
|
if defaultMappedModel != "" {
|
|
return defaultMappedModel
|
|
}
|
|
return requestedModel
|
|
}
|
|
|
|
mappedModel, matched := account.ResolveMappedModel(requestedModel)
|
|
if !matched && defaultMappedModel != "" {
|
|
return defaultMappedModel
|
|
}
|
|
return mappedModel
|
|
}
|