Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hubot-natural
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
hubot-natural
Commits
1915d1c6
Commit
1915d1c6
authored
7 years ago
by
Rodrigo Nascimento
Browse files
Options
Downloads
Patches
Plain Diff
Clear context if no errors defined
parent
2460d973
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/bot/index.coffee
+18
-10
18 additions, 10 deletions
scripts/bot/index.coffee
with
18 additions
and
10 deletions
scripts/bot/index.coffee
+
18
−
10
View file @
1915d1c6
...
...
@@ -72,11 +72,7 @@ module.exports = (_config, robot) ->
classifier
.
train
()
console
.
timeEnd
'Processing interactions (Done)'
robot
.
hear
/(.+)/i
,
(
res
)
->
msg
=
res
.
match
[
0
].
replace
res
.
robot
.
name
+
' '
,
''
msg
=
msg
.
replace
(
/^\s+/
,
''
)
msg
=
msg
.
replace
(
/\s+&/
,
''
)
processMessage
=
(
res
,
msg
)
->
context
=
getContext
(
res
)
currentClassifier
=
classifier
trust
=
config
.
trust
...
...
@@ -91,20 +87,24 @@ module.exports = (_config, robot) ->
classifications
=
currentClassifier
.
getClassifications
(
msg
)
if
classifications
[
0
].
value
<
trust
error_count
=
incErrors
res
if
classifications
[
0
].
value
>=
trust
clearErrors
res
node_name
=
classifications
[
0
].
label
else
if
Array
.
isArray
interaction
?
.
next
?
.
error
error_count
=
incErrors
res
error_node_name
=
interaction
.
next
.
error
[
error_count
-
1
]
if
not
error_node_name
?
clearErrors
res
error_node_name
=
interaction
.
next
.
error
[
0
]
else
if
interaction
?
.
next
?
setContext
(
res
,
undefined
)
return
processMessage
(
res
,
msg
)
else
error_count
=
incErrors
res
if
error_count
>
err_nodes
clearErrors
res
error_node_name
=
"error-"
+
error_count
else
clearErrors
res
node_name
=
classifications
[
0
].
label
currentInteraction
=
config
.
interactions
.
find
(
interaction
)
->
interaction
.
node
.
name
is
node_name
or
interaction
.
node
.
name
is
error_node_name
...
...
@@ -121,3 +121,11 @@ module.exports = (_config, robot) ->
currentNode
=
nodes
[
node_name
or
error_node_name
]
callback
=
currentNode
.
process
callback
.
apply
@
,
arguments
robot
.
hear
/(.+)/i
,
(
res
)
->
msg
=
res
.
match
[
0
].
replace
res
.
robot
.
name
+
' '
,
''
msg
=
msg
.
replace
(
/^\s+/
,
''
)
msg
=
msg
.
replace
(
/\s+&/
,
''
)
processMessage
res
,
msg
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment