This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-490-1
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-490-1 by this push:
new 1972c8b WIP.
1972c8b is described below
commit 1972c8ba4f81c44d98a64bd0bb2d0cfecb8744d0
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Mar 31 15:46:22 2022 +0300
WIP.
---
.../internal/intent/matcher/NCIntentSolverManager.scala | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
index f1463b9..c2c3f06 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
@@ -710,7 +710,7 @@ class NCIntentSolverManager(
)
logger.info(s"Intent '${intentRes.intentId}' for
variant #${intentRes.variantIdx + 1} selected as the <|best match|>")
- def execute(im: NCIntentMatch): NCResult =
+ def executeCallback(im: NCIntentMatch): NCResult =
val cbRes = intentRes.fn(im)
// Store winning intent match in the input.
if cbRes.getIntentId == null then
cbRes.setIntentId(intentRes.intentId)
@@ -723,25 +723,25 @@ class NCIntentSolverManager(
if called then E("Callback was already
called.")
called = true
- val currKey = reqIds.synchronized {
reqIds.getOrElse(key, null) }
+ val reqId = reqIds.synchronized {
reqIds.getOrElse(key, null) }
// TODO: text.
- if currKey != ctx.getRequest.getRequestId then
E("Callback is out of date.")
+ if reqId != ctx.getRequest.getRequestId then
E("Callback is out of date.")
typ match
case SEARCH =>
- val imFixed = mkIntentMatch(args)
- val cbRes = execute(imFixed)
- dialog.replaceLastItem(imFixed, cbRes,
ctx)
+ val imNew = mkIntentMatch(args)
+ val cbRes = executeCallback(imNew)
+ dialog.replaceLastItem(imNew, cbRes,
ctx)
cbRes
- case SEARCH_NO_HISTORY =>
execute(mkIntentMatch(args))
+ case SEARCH_NO_HISTORY =>
executeCallback(mkIntentMatch(args))
case _ => throw new
AssertionError(s"Unexpected state: $typ")
Loop.finish(IterationResult(Right(CallbackDataImpl(im.getIntentId,
im.getIntentEntities, cb)), im))
typ match
case REGULAR =>
- val cbRes = execute(im)
+ val cbRes = executeCallback(im)
saveHistory(cbRes, im)
Loop.finish(IterationResult(Left(cbRes), im))
case SEARCH =>