mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-04 11:43:57 +08:00
fix(pi): close native inspection review gaps
This commit is contained in:
@@ -813,6 +813,60 @@ mod tests {
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn public_inspection_accepts_surrogates_overridden_before_the_final_result() {
|
||||
let temp = tempfile::tempdir().expect("tempdir");
|
||||
let path = temp.path().join("models.json");
|
||||
fs::write(
|
||||
&path,
|
||||
r#"{"providers":{"surrogate":{
|
||||
"api":"openai-responses",
|
||||
"baseUrl":"https://compat.example/v1",
|
||||
"apiKey":"literal",
|
||||
"compat":{"chatTemplateKwargs":"😀"},
|
||||
"models":[{"id":"m"}],
|
||||
"modelOverrides":{"m":{"compat":{"chatTemplateKwargs":{
|
||||
"0":"repaired-high",
|
||||
"1":"repaired-low",
|
||||
"named":true
|
||||
}}}}
|
||||
}}}"#,
|
||||
)
|
||||
.expect("write");
|
||||
|
||||
let inspection =
|
||||
PiNativeInspectionService::inspect_entry(&path, "surrogate", &BTreeMap::new())
|
||||
.unwrap()
|
||||
.expect("provider");
|
||||
assert_eq!(
|
||||
inspection.diagnostic.managed_assessment,
|
||||
PiManagedAssessment::Manageable
|
||||
);
|
||||
assert_eq!(
|
||||
inspection.diagnostic.composition_status,
|
||||
PiCompositionStatus::Composed
|
||||
);
|
||||
assert_eq!(
|
||||
inspection.diagnostic.gateway_status,
|
||||
PiGatewayStatus::Proxyable
|
||||
);
|
||||
assert!(!inspection
|
||||
.diagnostic
|
||||
.reasons
|
||||
.iter()
|
||||
.any(|reason| reason.code == PiReasonCode::UnrepresentableCompat));
|
||||
assert_eq!(
|
||||
inspection.composition.models[0].compat,
|
||||
Some(json!({
|
||||
"chatTemplateKwargs": {
|
||||
"0": "repaired-high",
|
||||
"1": "repaired-low",
|
||||
"named": true
|
||||
}
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn managed_rejection_does_not_control_raw_composition() {
|
||||
let temp = tempfile::tempdir().expect("tempdir");
|
||||
|
||||
Reference in New Issue
Block a user