Skip to content

Commit 3e35dd0

Browse files
committed
Update to latest goflow that removes all classification serivces besides wit
1 parent 4cf55cb commit 3e35dd0

File tree

3 files changed

+5
-27
lines changed

3 files changed

+5
-27
lines changed

core/models/classifier.go

+2-24
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99
"github.com/nyaruka/goflow/assets"
1010
"github.com/nyaruka/goflow/flows"
1111
"github.com/nyaruka/goflow/flows/engine"
12-
"github.com/nyaruka/goflow/services/classification/bothub"
13-
"github.com/nyaruka/goflow/services/classification/luis"
1412
"github.com/nyaruka/goflow/services/classification/wit"
1513
"github.com/nyaruka/mailroom/core/goflow"
1614
"github.com/nyaruka/mailroom/runtime"
@@ -25,9 +23,7 @@ const NilClassifierID = ClassifierID(0)
2523

2624
// classifier type constants
2725
const (
28-
ClassifierTypeWit = "wit"
29-
ClassifierTypeLuis = "luis"
30-
ClassifierTypeBothub = "bothub"
26+
ClassifierTypeWit = "wit"
3127
)
3228

3329
// classifier config key constants
@@ -88,7 +84,7 @@ func (c *Classifier) Type() string { return c.Type_ }
8884

8985
// AsService builds the corresponding ClassificationService for the passed in Classifier
9086
func (c *Classifier) AsService(cfg *runtime.Config, classifier *flows.Classifier) (flows.ClassificationService, error) {
91-
httpClient, httpRetries, httpAccess := goflow.HTTP(cfg)
87+
httpClient, httpRetries, _ := goflow.HTTP(cfg)
9288

9389
switch c.Type() {
9490
case ClassifierTypeWit:
@@ -98,24 +94,6 @@ func (c *Classifier) AsService(cfg *runtime.Config, classifier *flows.Classifier
9894
}
9995
return wit.NewService(httpClient, httpRetries, classifier, accessToken), nil
10096

101-
case ClassifierTypeLuis:
102-
appID := c.Config_[LuisConfigAppID]
103-
endpoint := c.Config_[LuisConfigPredictionEndpoint]
104-
key := c.Config_[LuisConfigPredictionKey]
105-
slot := c.Config_[LuisConfigSlot]
106-
if endpoint == "" || appID == "" || key == "" || slot == "" {
107-
return nil, fmt.Errorf("missing %s, %s, %s or %s on LUIS classifier: %s",
108-
LuisConfigAppID, LuisConfigPredictionEndpoint, LuisConfigPredictionKey, LuisConfigSlot, c.UUID())
109-
}
110-
return luis.NewService(httpClient, httpRetries, httpAccess, classifier, endpoint, appID, key, slot), nil
111-
112-
case ClassifierTypeBothub:
113-
accessToken := c.Config_[BothubConfigAccessToken]
114-
if accessToken == "" {
115-
return nil, fmt.Errorf("missing %s for Bothub classifier: %s", BothubConfigAccessToken, c.UUID())
116-
}
117-
return bothub.NewService(httpClient, httpRetries, classifier, accessToken), nil
118-
11997
default:
12098
return nil, fmt.Errorf("unknown classifier type '%s' for classifier: %s", c.Type(), c.UUID())
12199
}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/lib/pq v1.10.9
2727
github.com/nyaruka/ezconf v0.3.0
2828
github.com/nyaruka/gocommon v1.61.1
29-
github.com/nyaruka/goflow v0.236.0
29+
github.com/nyaruka/goflow v0.236.1
3030
github.com/nyaruka/null/v3 v3.0.0
3131
github.com/nyaruka/redisx v0.9.0
3232
github.com/nyaruka/rp-indexer/v10 v10.1.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ github.com/nyaruka/ezconf v0.3.0 h1:kGvJqVN8AHowb4HdaHAviJ0Z3yI5Pyekp1WqibFEaGk=
210210
github.com/nyaruka/ezconf v0.3.0/go.mod h1:89GUW6EPRNLIxT7lC4LWnjWTgZeQwRoX7lBmc8ralAU=
211211
github.com/nyaruka/gocommon v1.61.1 h1:qulMx0jHDWoDagCJbVs7CMLZA33jfa5kYutlXR66pHM=
212212
github.com/nyaruka/gocommon v1.61.1/go.mod h1:HcwpCzwt8XK7SxmGHYRF1R9viOAvlU7VtXTGuEmJx/8=
213-
github.com/nyaruka/goflow v0.236.0 h1:5B4+sGH5PncG7vc+mxNh2wSu8fklwdJI4i34dqiU+CY=
214-
github.com/nyaruka/goflow v0.236.0/go.mod h1:m0bwl9WfJhBQHeabOGnWoyy6n5GXaoU27iE7X3hDkeg=
213+
github.com/nyaruka/goflow v0.236.1 h1:Gvk8ya6FKB8B8n9BMAsCcOIrGgDrMav1dm7ocRbFs7w=
214+
github.com/nyaruka/goflow v0.236.1/go.mod h1:m0bwl9WfJhBQHeabOGnWoyy6n5GXaoU27iE7X3hDkeg=
215215
github.com/nyaruka/null/v2 v2.0.3 h1:rdmMRQyVzrOF3Jff/gpU/7BDR9mQX0lcLl4yImsA3kw=
216216
github.com/nyaruka/null/v2 v2.0.3/go.mod h1:OCVeCkCXwrg5/qE6RU0c1oUVZBy+ZDrT+xYg1XSaIWA=
217217
github.com/nyaruka/null/v3 v3.0.0 h1:JvOiNuKmRBFHxzZFt4sWii+ewmMkCQ1vO7X0clTNn6E=

0 commit comments

Comments
 (0)