Update aiapis.go

This commit is contained in:
公明 2025-04-25 10:36:37 +08:00 committed by GitHub
parent c3f93ee66c
commit 573ba870db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,11 +88,12 @@ func AIScan(model, aiurl, apikey, reqA, respA, respB, statusB string) (string, e
"statusB": statusB, "statusB": statusB,
} }
inputJSON, err := json.Marshal(input) inputBytes, err := json.MarshalIndent(input, "", " ")
if err != nil { if err != nil {
fmt.Printf("Error marshaling input: %v\n", err) fmt.Printf("Error marshaling input: %v\n", err)
return "", err return "", err
} }
fmt.Println(string(inputBytes))
request := ChatCompletionRequest{ request := ChatCompletionRequest{
Model: model, // 根据实际模型名称修改 Model: model, // 根据实际模型名称修改
Messages: []Message{ Messages: []Message{
@ -102,11 +103,11 @@ func AIScan(model, aiurl, apikey, reqA, respA, respB, statusB string) (string, e
}, },
{ {
Role: "user", Role: "user",
Content: string(inputJSON), Content: string(inputBytes),
}, },
}, },
Temperature: 0.5, Temperature: 0.2,
MaxTokens: 1000, MaxTokens: 2500,
} }
response, err := CreateChatCompletion(request, aiurl, apikey) response, err := CreateChatCompletion(request, aiurl, apikey)