feat: optimize WebUI stream output and sanitize user-facing answers
This commit is contained in:
24
internal/llm/client_test.go
Normal file
24
internal/llm/client_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package llm
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestShouldDisableThinkingParam(t *testing.T) {
|
||||
if !shouldDisableThinkingParam("https://dashscope.aliyuncs.com/compatible-mode/v1") {
|
||||
t.Fatal("expected DashScope base URL to require enable_thinking=false")
|
||||
}
|
||||
if shouldDisableThinkingParam("https://api.openai.com/v1") {
|
||||
t.Fatal("expected standard OpenAI base URL not to require enable_thinking=false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestChatCompletionRequestOptions(t *testing.T) {
|
||||
client := &OpenAICompatibleClient{disableThinkingParam: true}
|
||||
if got := len(client.chatCompletionRequestOptions()); got != 1 {
|
||||
t.Fatalf("expected 1 request option when disableThinkingParam=true, got %d", got)
|
||||
}
|
||||
|
||||
client.disableThinkingParam = false
|
||||
if got := len(client.chatCompletionRequestOptions()); got != 0 {
|
||||
t.Fatalf("expected 0 request options when disableThinkingParam=false, got %d", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user