Files
ragflow/internal/entity/models/base_model_request_body_test.go
Zhichang Yu 14b943a04a feat: Go knowledge compiler with scheduler-driven dataset compilation (#17881)
Ports the dataset knowledge compilation (wiki/graph/tree/mindmap) to the
Go scheduler with a status contract, aligns wiki storage/retrieval with
Python, and sizes prompts by content_length.
2026-08-05 20:00:42 +08:00

32 lines
688 B
Go

package models
import "testing"
func TestBuildRequestBodyOmitsNonPositiveMaxTokens(t *testing.T) {
zero := 0
body := buildRequestBody(
&ChatConfig{MaxTokens: &zero},
"test-model",
[]Message{{Role: "user", Content: "hello"}},
false,
)
if _, ok := body["max_tokens"]; ok {
t.Fatalf("max_tokens should be omitted, got %#v", body["max_tokens"])
}
}
func TestBuildRequestBodyOmitsPositiveMaxTokens(t *testing.T) {
mt := 256
body := buildRequestBody(
&ChatConfig{MaxTokens: &mt},
"test-model",
[]Message{{Role: "user", Content: "hello"}},
false,
)
if _, ok := body["max_tokens"]; ok {
t.Fatalf("max_tokens should be omitted, got %#v", body["max_tokens"])
}
}