This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch NLPCRAFT-468
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/NLPCRAFT-468 by this push:
     new b21b96b  WIP.
b21b96b is described below

commit b21b96bf3ccfb1c9b41e71b5046fe94c7571e417
Author: Sergey Kamov <[email protected]>
AuthorDate: Tue Oct 12 16:08:23 2021 +0300

    WIP.
---
 nlpcraft-akka/src/main/java/AkkaServer.java        | 19 ++++++++++++++
 .../org/apache/nlpcraft/spring/Application.java    | 29 ++++++++++++++++------
 .../src/test/resources/application.properties      |  6 +++++
 3 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/nlpcraft-akka/src/main/java/AkkaServer.java 
b/nlpcraft-akka/src/main/java/AkkaServer.java
new file mode 100644
index 0000000..1ca2e45
--- /dev/null
+++ b/nlpcraft-akka/src/main/java/AkkaServer.java
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class AkkaServer {
+}
diff --git 
a/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/Application.java 
b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/Application.java
index 0122930..b6d011e 100644
--- a/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/Application.java
+++ b/nlpcraft-spring/src/test/java/org/apache/nlpcraft/spring/Application.java
@@ -23,12 +23,14 @@ import org.apache.nlpcraft.NCNlpcraftBuilder;
 import org.apache.nlpcraft.model.NCModelConfig;
 import org.apache.nlpcraft.model.NCResult;
 import org.apache.nlpcraft.model.builders.NCModelBuilder;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.builder.SpringApplicationBuilder;
 import org.springframework.context.annotation.Bean;
 import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -45,33 +47,44 @@ public class Application  {
     public NCNlpcraftController getNCNlpcraftController(NCNlpcraft nlp) {
         return new NCNlpcraftController(nlp);
     }
-    // Read it from own configs.
-
 
     @Bean
-    public NCModelConfig getModelConfig() {
+    public NCModelConfig getModelConfig(
+        @Value("${model.id}") String mdlId,
+        @Value("${model.name}") String mdlName,
+        @Value("${model.version}") String mdlVersion
+    ) {
         return new NCModelConfig() {
             @Override
             public String getId() {
-                return null;
+                return mdlId;
             }
 
             @Override
             public String getName() {
-                return null;
+                return mdlName;
             }
 
             @Override
             public String getVersion() {
-                return null;
+                return mdlVersion;
             }
         };
     }
 
     @Bean
-    public NCNlpcraft getNlpCraft(NCModelConfig cfg) {
+    public NCNlpcraft getNlpCraft(
+        NCModelConfig cfg,
+        @Value("${intent.1}") String intent1,
+        @Value("${intent.2}") String intent2
+    ) {
         return new NCNlpcraftBuilder().
-            withModel(new NCModelBuilder().withConfig(cfg).getModel()).
+            withModel(
+                new NCModelBuilder().
+                    withConfig(cfg).
+                    withIntents(Arrays.asList(intent1, intent2)).
+                    getModel()
+            ).
             getNlpcraft();
     }
 }
diff --git a/nlpcraft-spring/src/test/resources/application.properties 
b/nlpcraft-spring/src/test/resources/application.properties
index 395606e..37633a1 100644
--- a/nlpcraft-spring/src/test/resources/application.properties
+++ b/nlpcraft-spring/src/test/resources/application.properties
@@ -19,3 +19,9 @@ server.port=8080
 logging.level.root=INFO
 
 # Add model configuration properties here.
+model.id=My Model ID.
+model.name=My Model
+model.version=1.0.0
+
+intent.1=add:waypoint term={# == "x:add-waypoint"} term={# == "x:addr"}
+intent.2=add:waypoint term={# == "x:add-waypoint"} term={# == "x:addr"}
\ No newline at end of file

Reply via email to