如何卷曲访问RASA NLU(starter-pack-rasa-stack)?

时间:2018-10-12 01:29:45

标签: rasa-nlu rasa-core

通过此链接https://github.com/RasaHQ/starter-pack-rasa-stack

我已成功使用以下命令启动服务器:制作cmdline 并通过成功对其进行了测试!

如果我想使用邮递员 curl命令访问我的机器人服务器怎么办?是否可以或者我必须编写其他代码?

这是我的方法:

1.make动作服务器

java.lang.AssertionError
at org.gradle.api.internal.tasks.testing.results.AttachParentTestResultProcessor.started(AttachParentTestResultProcessor.java:33)
at org.gradle.api.internal.tasks.testing.junit.TestClassExecutionEventGenerator.started(TestClassExecutionEventGenerator.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.actor.internal.DefaultActorFactory$BlockingActor.dispatch(DefaultActorFactory.java:122)
at org.gradle.internal.actor.internal.DefaultActorFactory$BlockingActor.dispatch(DefaultActorFactory.java:97)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.started(Unknown Source)
at org.gradle.api.internal.tasks.testing.junit.GenericJUnitTestEventAdapter.testStarted(GenericJUnitTestEventAdapter.java:54)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestExecutionListener.executionStarted(JUnitPlatformTestExecutionListener.java:78)
at org.junit.platform.launcher.core.TestExecutionListenerRegistry$CompositeTestExecutionListener.lambda$executionStarted$2(TestExecutionListenerRegistry.java:72)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.junit.platform.launcher.core.TestExecutionListenerRegistry.notifyTestExecutionListeners(TestExecutionListenerRegistry.java:51)
at org.junit.platform.launcher.core.TestExecutionListenerRegistry.access$100(TestExecutionListenerRegistry.java:27)
at org.junit.platform.launcher.core.TestExecutionListenerRegistry$CompositeTestExecutionListener.executionStarted(TestExecutionListenerRegistry.java:72)
at org.junit.platform.launcher.core.ExecutionListenerAdapter.executionStarted(ExecutionListenerAdapter.java:46)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:92)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:71)
at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:169)
at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinTask.doJoin(ForkJoinTask.java:389)
at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:719)
at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.joinConcurrentTasksInReverseOrderToEnableWorkStealing(ForkJoinPoolHierarchicalTestExecutorService.java:146)
at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.invokeAll(ForkJoinPoolHierarchicalTestExecutorService.java:120)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:110)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:71)
at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:169)
at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinTask.doJoin(ForkJoinTask.java:389)
at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:719)
at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.joinConcurrentTasksInReverseOrderToEnableWorkStealing(ForkJoinPoolHierarchicalTestExecutorService.java:146)
at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.invokeAll(ForkJoinPoolHierarchicalTestExecutorService.java:120)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:110)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:71)
at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:169)
at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

2.make cmdline

Narongs-MacBook-Pro:starter-pack-rasa-stack softmastx$ make action-server
python -m rasa_core_sdk.endpoint --actions actions
INFO:__main__:Starting action endpoint server...
ERROR:rasa_core_sdk.executor:Failed to register package 'actions'.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/rasa_core_sdk/executor.py", line 144, in register_package
    self._import_submodules(package)
  File "/usr/local/lib/python2.7/site-packages/rasa_core_sdk/executor.py", line 131, in _import_submodules
    package = importlib.import_module(package)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "actions.py", line 16, in <module>
    from rasa_core.channels.direct import CollectingOutputChannel
ImportError: No module named direct
INFO:__main__:Action endpoint is up and running. on ('0.0.0.0', 5055)

请告知。谢谢。

1 个答案:

答案 0 :(得分:0)

make cmdline不会启动额外的NLU服务器。因此,您不能直接卷曲Rasa NLU API。 但是,您可以将消息直接发送到Core:

curl --request POST \
  --url http://localhost:5005/webhooks/rest/webhook \
  --header 'content-type: application/json' \
  --data '{
  "message": "Hello"
}'

如果要启动额外的NLU服务器,则必须运行:

python -m rasa_nlu.server --path models/current

然后可以使用以下方法卷曲Rasa NLU:

curl --request GET \
  --url 'http://localhost:5000/parse?q=Hello&project=nlu'