Skip to content

Commit bbc906d

Browse files
authored
Merge pull request #24 from SEPIA-Framework/dev
updated HTTP example calls in Python-Bridge and QA demos
2 parents 97fba00 + 0e26af2 commit bbc906d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/main/java/net/b07z/sepia/sdk/services/uid1007/DynamicQuestionAnswering.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ public ServiceResult getResult(NluResult nluResult) {
164164
//Example HTTP call e.g. to a web API, your PythonBridge or any other micro-service with HTTP interface:
165165
/*
166166
try{
167-
JSONObject response = Connectors.apacheHttpGETjson("http://localhost:20731/my-service/");
167+
String qUrlParam = "?q=" + URLEncoder.encode(qRaw, "UTF-8");
168+
JSONObject response = Connectors.apacheHttpGETjson(
169+
"http://localhost:20731/my-service/" + qUrlParam
170+
);
168171
if (response != null && response.containsKey("answer")){
169172
questionResponse = JSON.getString(response, "answer");
170173
}

src/main/java/net/b07z/sepia/sdk/services/uid1007/PythonBridgeDemo.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,12 @@ public ServiceResult getResult(NluResult nluResult) {
165165
//Example call to another PythonBridge endpoint (define yourself)
166166
/*
167167
String myReply = "";
168+
String myQuestion = "my question";
168169
try{
169-
JSONObject response = Connectors.apacheHttpGETjson("http://localhost:20731/my-service/");
170+
String qUrlParam = "?q=" + URLEncoder.encode(myQuestion, "UTF-8");
171+
JSONObject response = Connectors.apacheHttpGETjson(
172+
"http://localhost:20731/my-service/" + qUrlParam
173+
);
170174
if (response != null && response.containsKey("myReply")){
171175
myReply = JSON.getString(response, "myReply");
172176
...

0 commit comments

Comments
 (0)