Add projects
This commit is contained in:
parent
2d3a9ad623
commit
8b607dd700
1802 changed files with 503346 additions and 2 deletions
|
|
@ -0,0 +1,37 @@
|
|||
package signature
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
func TestSanitizeClaudeMessagesForClaudeUpstreamPreservesEmptyThinkingInCompatMode(t *testing.T) {
|
||||
input := []byte(`{"messages":[{"role":"assistant","content":[{"type":"thinking","thinking":"","signature":""}]}]}`)
|
||||
|
||||
withoutCompat, _ := SanitizeClaudeMessagesForClaudeUpstream(input, "deepseek-v4")
|
||||
if gjson.GetBytes(withoutCompat, "messages.0.content.#").Int() != 0 {
|
||||
t.Fatalf("default sanitizer preserved empty thinking: %s", withoutCompat)
|
||||
}
|
||||
|
||||
withCompat, _ := SanitizeClaudeMessagesForClaudeUpstream(input, "deepseek-v4", true)
|
||||
part := gjson.GetBytes(withCompat, "messages.0.content.0")
|
||||
if part.Get("type").String() != "thinking" || part.Get("signature").String() != "" {
|
||||
t.Fatalf("compat sanitizer dropped empty thinking: %s", withCompat)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSanitizeClaudeMessagesForClaudeUpstreamPreservesOpaqueThinkingSignatureInCompatMode(t *testing.T) {
|
||||
input := []byte(`{"messages":[{"role":"assistant","content":[{"type":"thinking","thinking":"reason","signature":"opaque-deepseek-id"}]}]}`)
|
||||
|
||||
withoutCompat, _ := SanitizeClaudeMessagesForClaudeUpstream(input, "deepseek-v4")
|
||||
if gjson.GetBytes(withoutCompat, "messages.0.content.0.signature").String() != "" {
|
||||
t.Fatalf("default sanitizer preserved opaque signature: %s", withoutCompat)
|
||||
}
|
||||
|
||||
withCompat, _ := SanitizeClaudeMessagesForClaudeUpstream(input, "deepseek-v4", true)
|
||||
part := gjson.GetBytes(withCompat, "messages.0.content.0")
|
||||
if part.Get("type").String() != "thinking" || part.Get("signature").String() != "opaque-deepseek-id" {
|
||||
t.Fatalf("compat sanitizer dropped opaque signature: %s", withCompat)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue