From 69ba2db04e73f149b4025157e20f6cc03bb74c0f Mon Sep 17 00:00:00 2001 From: Robi9 Date: Thu, 19 Oct 2023 18:35:38 -0300 Subject: [PATCH] Token and url support for weniGPT from mailroom --- flows/actions/call_wenigpt.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/flows/actions/call_wenigpt.go b/flows/actions/call_wenigpt.go index c43bf7499..9d71a868d 100644 --- a/flows/actions/call_wenigpt.go +++ b/flows/actions/call_wenigpt.go @@ -53,6 +53,17 @@ func (a *CallWeniGPTAction) Execute(run flows.FlowRun, step flows.Step, logModif return a.call(run, step, input, kb, logEvent) } +var token string +var apiUrl = "https://nlp.bothub.it" + +func SetWeniGPTToken(t string) { + token = t +} + +func SetWeniGPTAPIURL(url string) { + apiUrl = url +} + // Execute runs this action func (a *CallWeniGPTAction) call(run flows.FlowRun, step flows.Step, input string, kb string, logEvent flows.EventCallback) error { svc, err := run.Session().Engine().Services().WeniGPT(run.Session()) @@ -61,9 +72,7 @@ func (a *CallWeniGPTAction) call(run flows.FlowRun, step flows.Step, input strin return nil } - // TODO: get token/url from mailroom - var token string - var url string + url := apiUrl + "/v2/question-answering/" call, err := svc.Call(run.Session(), input, kb, token, url)