mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-10 01:11:23 +08:00
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.
32 lines
688 B
Go
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"])
|
|
}
|
|
}
|