File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
src/main/java/net/b07z/sepia/sdk/services/uid1007 Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -161,22 +161,21 @@ public ServiceResult getResult(NluResult nluResult) {
161161
162162 //TODO: Here you can add your scripts to answer the question. Write your own logic or maybe use a web API?
163163 String questionResponse = "" ;
164- boolean answeredSuccessfully = false ;
165164 //Example HTTP call e.g. to a web API, your PythonBridge or any other micro-service with HTTP interface:
166165 /*
167166 try{
168167 JSONObject response = Connectors.apacheHttpGETjson("http://localhost:20731/my-service/");
169168 if (response != null && response.containsKey("answer")){
170169 questionResponse = JSON.getString(response, "answer");
171- answeredSuccessfully = true;
172170 }
173171 }catch (Exception e){
174- e.printStackTrace( );
172+ Debugger.println("DynamicQuestionAnswering - failed to call API - Error: " + e.getMessage(), 1 );
175173 }
176174 */
177175 //JUST FOR TESTING: return the question:
178176 questionResponse = qRaw ;
179- answeredSuccessfully = Is .notNullOrEmpty (questionResponse ); //implement your own checks depending on how you generate answers!
177+ //TODO: Implement your own checks depending on how you generate answers!
178+ boolean answeredSuccessfully = Is .notNullOrEmpty (questionResponse );
180179
181180 //success or no answer?
182181 if (!answeredSuccessfully ){
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ public ServiceInfo getInfo(String language) {
119119
120120 //Parameters:
121121
122- //This service has a one required parameter, the code word.
122+ //This service has one required parameter, the code word.
123123 //Required parameters will be asked automatically by SEPIA using the defined question.
124124 Parameter p1 = new Parameter (new CodeWord ())
125125 .setRequired (true )
@@ -161,6 +161,21 @@ public ServiceResult getResult(NluResult nluResult) {
161161
162162 // ... here you could put some code that runs after successful code word.
163163 // wrong code will automatically lead to rejection before reaching this part ...
164+
165+ //Example call to another PythonBridge endpoint (define yourself)
166+ /*
167+ String myReply = "";
168+ try{
169+ JSONObject response = Connectors.apacheHttpGETjson("http://localhost:20731/my-service/");
170+ if (response != null && response.containsKey("myReply")){
171+ myReply = JSON.getString(response, "myReply");
172+ ...
173+ }
174+ }catch (Exception e){
175+ Debugger.println("PythonBridgeDemo - failed to call API - Error: " + e.getMessage(), 1);
176+ }
177+ if (Is.notNullOrEmpty(myReply)){ ... }
178+ */
164179
165180 //all good
166181 api .setStatusSuccess ();
You can’t perform that action at this time.
0 commit comments