feat: publish v1.0.0-rc.36-custom.1
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
This commit is contained in:
commit
bb7968b612
2381 files changed
+551494
No files matched your search
@@ -0,0 +1,47 @@
|
||||
package relay
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestBuildAlphaSearchRequestBodyPreservesUnknownFields(t *testing.T) {
|
||||
raw := []byte(`{
|
||||
"id":"req_1",
|
||||
"model":"gpt-5.1",
|
||||
"input":[{"role":"user","content":"hi"}],
|
||||
"commands":{"search_query":[{"q":"weather","recency":1}]},
|
||||
"settings":{"locale":"en"},
|
||||
"future_field":{"nested":true}
|
||||
}`)
|
||||
|
||||
out, err := buildAlphaSearchRequestBody(raw, "gpt-5.1", "gpt-5.1-mapped")
|
||||
require.NoError(t, err)
|
||||
|
||||
var body map[string]any
|
||||
require.NoError(t, common.Unmarshal(out, &body))
|
||||
assert.Equal(t, "gpt-5.1-mapped", body["model"])
|
||||
assert.Equal(t, "req_1", body["id"])
|
||||
require.Contains(t, body, "commands")
|
||||
require.Contains(t, body, "settings")
|
||||
require.Contains(t, body, "future_field")
|
||||
require.Contains(t, body, "input")
|
||||
|
||||
commands, ok := body["commands"].(map[string]any)
|
||||
require.True(t, ok)
|
||||
require.Contains(t, commands, "search_query")
|
||||
|
||||
future, ok := body["future_field"].(map[string]any)
|
||||
require.True(t, ok)
|
||||
assert.Equal(t, true, future["nested"])
|
||||
}
|
||||
|
||||
func TestBuildAlphaSearchRequestBodyNoMappingKeepsRawBytes(t *testing.T) {
|
||||
raw := []byte(`{"model":"gpt-5.1","commands":{"search_query":[{"q":"x"}]},"future_field":1}`)
|
||||
out, err := buildAlphaSearchRequestBody(raw, "gpt-5.1", "gpt-5.1")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, raw, out)
|
||||
}
|
||||
Reference in new issue
Block a user