Skip to content

Commit

Permalink
Token and url support for weniGPT from mailroom
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Oct 19, 2023
1 parent 762be65 commit 69ba2db
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions flows/actions/call_wenigpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)

Expand Down

0 comments on commit 69ba2db

Please sign in to comment.