From 8eaf3c2271ac4d6599826b347afee0fe6f46a37f Mon Sep 17 00:00:00 2001 From: Robi9 Date: Fri, 15 Sep 2023 14:34:42 -0300 Subject: [PATCH] Fix response fields for zeroshotAPI --- flows/routers/smart.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/flows/routers/smart.go b/flows/routers/smart.go index 03eefd17e..4340077dc 100644 --- a/flows/routers/smart.go +++ b/flows/routers/smart.go @@ -217,11 +217,14 @@ func (r *SmartRouter) classifyText(run flows.FlowRun, step flows.Step, operand s client := &http.Client{} response := &struct { - Output string `json:"output"` - Other bool `json:"other"` - }{ - Output: "", - } + Output struct { + Classification string `json:"classification"` + Other bool `json:"other"` + } + }{Output: struct { + Classification string "json:\"classification\"" + Other bool "json:\"other\"" + }{Classification: ""}} trace, err := httpx.DoTrace(client, req, nil, nil, -1) if err != nil { @@ -249,17 +252,17 @@ func (r *SmartRouter) classifyText(run flows.FlowRun, step flows.Step, operand s var categoryUUID flows.CategoryUUID categoryUUID = "" - if response.Other { + if response.Output.Other { return "", categoryUUID, nil } for _, category := range r.categories { - if category.Name() == response.Output { + if category.Name() == response.Output.Classification { categoryUUID = category.UUID() } } - return response.Output, categoryUUID, nil + return response.Output.Classification, categoryUUID, nil }