feat: sync deployed v1.0.0-rc.38-custom.42
Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
This commit is contained in:
1 parent
aa6c3f50f4
commit
ceddfd3d6b
828 files changed
+122253
-13702
No files matched your search
@@ -0,0 +1,48 @@
|
||||
package common
|
||||
|
||||
import "strings"
|
||||
|
||||
// ResponseModel records upstream declarations before response conversion. It is
|
||||
// diagnostic only: it must never change routing, pricing, or downstream output.
|
||||
type ResponseModel struct {
|
||||
RequestedModel string `json:"requested_model"`
|
||||
UpstreamModel string `json:"upstream_model"`
|
||||
ReturnedModel string `json:"returned_model"`
|
||||
Mismatch bool `json:"mismatch"`
|
||||
}
|
||||
|
||||
// ObserveResponseModel retains the first differing model for inspection, with
|
||||
// mismatches taking priority over prefix or case-only differences. A later
|
||||
// matching or empty event cannot erase it. Only observe upstream declarations,
|
||||
// never models synthesized by a response converter.
|
||||
func (info *RelayInfo) ObserveResponseModel(model string) {
|
||||
if info == nil || strings.TrimSpace(model) == "" || (info.OriginModelName == "gpt-6-astra" && info.AstraDetectionDisabled) {
|
||||
return
|
||||
}
|
||||
if info.ResponseModel == nil {
|
||||
info.ResponseModel = &ResponseModel{
|
||||
RequestedModel: info.OriginModelName,
|
||||
UpstreamModel: info.GetUpstreamModelName(),
|
||||
}
|
||||
}
|
||||
observation := info.ResponseModel
|
||||
if observation.Mismatch {
|
||||
return
|
||||
}
|
||||
mismatch := true
|
||||
for _, expected := range []string{observation.RequestedModel, observation.UpstreamModel} {
|
||||
if expected != "" && (strings.HasPrefix(model, expected) || strings.EqualFold(model, expected)) {
|
||||
mismatch = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if observation.RequestedModel == "gpt-6-astra" {
|
||||
mismatch = strings.TrimSpace(model) != "gpt-6-astra"
|
||||
}
|
||||
if !mismatch && observation.ReturnedModel != "" &&
|
||||
observation.ReturnedModel != observation.RequestedModel && observation.ReturnedModel != observation.UpstreamModel {
|
||||
return
|
||||
}
|
||||
observation.ReturnedModel = model
|
||||
observation.Mismatch = mismatch
|
||||
}
|
||||
Reference in new issue
Block a user