This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-404
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-404 by this push:
new 0ecf903 WIP on NLPCRAFT-404
0ecf903 is described below
commit 0ecf903573e2ac04422f6d98b4e2f8cd22b61bc4
Author: Aaron Radzinski <[email protected]>
AuthorDate: Sat Aug 7 22:28:21 2021 -0700
WIP on NLPCRAFT-404
---
.../org/apache/nlpcraft/model/tools/cmdline/NCCli.scala | 17 +++++++++++++----
.../nlpcraft/model/tools/cmdline/NCCliCommands.scala | 8 ++++++++
.../nlpcraft/probe/mgrs/model/NCModelManager.scala | 2 +-
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
index 22e5ada..b55ac14 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
@@ -36,6 +36,7 @@ import org.apache.nlpcraft.common.ascii.NCAsciiTable
import org.apache.nlpcraft.common.module.NCModule
import org.apache.nlpcraft.model.tools.cmdline.NCCliCommands._
import org.apache.nlpcraft.model.tools.cmdline.NCCliRestSpec._
+import org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator
import org.jline.reader._
import org.jline.reader.impl.DefaultParser
import org.jline.reader.impl.DefaultParser.Bracket
@@ -471,6 +472,7 @@ object NCCli extends NCCliBase {
tbl += (s"${g("info-server")}", "Get server information.")
tbl += (s"${g("ping-server")}", "Ping the server.")
tbl += (s"${g("tail-server")}", "Tail the server log.")
+ tbl += (s"${g("info")}", "Get server & probe information.")
logln(s"Handy commands:\n${tbl.toString}")
}
@@ -585,6 +587,7 @@ object NCCli extends NCCliBase {
case Some(opts) => U.splitTrimFilter(U.trimQuotes(opts), " ")
case None => Seq("-ea", "-Xms1024m")
}
+ val intIds = getParamOpt(args, "intents")
val jvmArgs = mutable.ArrayBuffer.empty[String]
@@ -595,10 +598,13 @@ object NCCli extends NCCliBase {
jvmArgs ++= jvmOpts
if (cfgPath != null)
- jvmArgs += s"-DNLPCRAFT_PROBE_CONFIG=$cfgPath"
+ jvmArgs += s"-D${NCTestAutoModelValidator.PROP_PROBE_CFG}=$cfgPath"
if (mdls.nonEmpty)
- jvmArgs += s"-DNLPCRAFT_TEST_MODELS=$mdls"
+ jvmArgs += s"-D${NCTestAutoModelValidator.PROP_MODELS}=$mdls"
+
+ if (intIds.isDefined)
+ jvmArgs +=
s"-D${NCTestAutoModelValidator.PROP_INTENT_IDS}=${intIds.get}"
if (!NCAnsi.isEnabled)
jvmArgs += "-DNLPCRAFT_ANSI_COLOR_DISABLED=true"
@@ -774,6 +780,9 @@ object NCCli extends NCCliBase {
val tbl = new NCAsciiTable()
tbl += (s"${g(STOP_PRB_CMD.name)}", "Stop the probe.")
+ tbl += (s"${g("restart-probe")}", "Restart the probe.")
+ tbl += (s"${g("test-model")}", "Auto test the model.")
+ tbl += (s"${g("tail-probe")}", "Tail the probe log.")
tbl += (s"${g("info")}", "Get server & probe information.")
logln(s"Handy commands:\n${tbl.toString}")
@@ -1441,7 +1450,7 @@ object NCCli extends NCCliBase {
val logPath = if (beacon.logPath != null) g(beacon.logPath) else
y("<not available>")
val jarsFolder = if (beacon.jarsFolder != null) g(beacon.jarsFolder)
else y("<not set>")
- val mdlSeq = beacon.modelsSeq.map(s => g(s.strip))
+ val mdlSeq = beacon.modelsSeq.map(s => m(s.strip))
tbl += ("PID", s"${g(beacon.pid)}")
tbl += ("Version", s"${g(beacon.ver)} released on
${g(beacon.relDate)}")
@@ -1508,7 +1517,7 @@ object NCCli extends NCCliBase {
val tbl = new NCAsciiTable()
tbl += (s"${g("Email")}", state.userEmail.get)
- tbl += (s"${g("Access token")}", state.accessToken.get)
+ tbl += (s"${g("Access token")}", b(state.accessToken.get))
logln(s"Signed-in user account:\n$tbl")
}
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
index b5a2904..18dc010 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
@@ -970,6 +970,14 @@ private [cmdline] object NCCliCommands {
s"names - and they will be automatically combined
together."
),
Parameter(
+ id = "intents",
+ names = Seq("--ints", "-i"),
+ value = Some("int1,int2"),
+ optional = true,
+ desc =
+ s"Comma separated list of intent IDs to test. If not
provided, all detected intents will be tested."
+ ),
+ Parameter(
id = "jvmopts",
names = Seq("--jvmOpts", "-j"),
value = Some("<jvm flags>"),
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/NCModelManager.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/NCModelManager.scala
index da8c70b..e0febb3 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/NCModelManager.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/model/NCModelManager.scala
@@ -85,7 +85,7 @@ object NCModelManager extends NCService {
tbl += Seq(s"${B}Intents:$RST ${withWarn(pm.intents.size)}") ++
(
for (cb <- pm.callbacks) yield
- s" ${g(bo(cb._1))} from ${m(cb._2.origin)} ->
${c(cb._2.className)}${bo("#")}${c(cb._2.methodName)}(...)"
+ s" ${g(bo(cb._1))} @ ${m(cb._2.origin)} ->
${c(cb._2.className)}${bo("#")}${c(cb._2.methodName)}(...)"
).toSeq
tbl.info(logger, Some("Model:"))