This commit is contained in:
unintendedfraud
2023-11-07 09:36:12 +01:00
parent e4df28272a
commit 9bc940f226
+1 -8
View File
@@ -41,14 +41,7 @@ func (c Client) Chat(messages []*ChatMessage) (*ChatResponse, error) {
return nil, fmt.Errorf("failed to query openai. Error: %s", err.Error()) return nil, fmt.Errorf("failed to query openai. Error: %s", err.Error())
} }
var test interface{} fmt.Println("body response: ", string(res.Body()), res.Status())
if err := json.Unmarshal(res.Body(), &test); err != nil {
fmt.Println("ERROR: ", err.Error())
}
fmt.Println("Parsing response in interface:")
indent, _ := json.MarshalIndent(test, "\n", " ")
fmt.Printf("\n%+v\n", indent)
var r ChatResponse var r ChatResponse
if err := json.Unmarshal(res.Body(), &r); err != nil { if err := json.Unmarshal(res.Body(), &r); err != nil {