mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-02 18:41:35 +08:00
test(proxy): add nested JSON error detection test for thinking rectifier
This commit is contained in:
@@ -240,6 +240,16 @@ mod tests {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_detect_invalid_signature_nested_json() {
|
||||||
|
// 测试嵌套 JSON 格式的错误消息(第三方渠道常见格式)
|
||||||
|
let nested_error = r#"{"error":{"message":"{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"***.content.0: Invalid `signature` in `thinking` block\"},\"request_id\":\"req_xxx\"}"}}"#;
|
||||||
|
assert!(should_rectify_thinking_signature(
|
||||||
|
Some(nested_error),
|
||||||
|
&enabled_config()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_detect_thinking_expected() {
|
fn test_detect_thinking_expected() {
|
||||||
assert!(should_rectify_thinking_signature(
|
assert!(should_rectify_thinking_signature(
|
||||||
|
|||||||
Reference in New Issue
Block a user