[Bot-AI-QnA] Fix disparities (#1214)
* Remove testData to be renamed * Rename testData to testdata in order to be consistent with other Java libraries * Fix typo in javadoc * Consistency of StringUtils * Make props as final * Update property from 0.4 to 0.42
This commit is contained in:
Родитель
40094f92ab
Коммит
c17025014b
|
@ -33,7 +33,6 @@ import java.util.Map.Entry;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -91,15 +90,15 @@ public class QnAMaker implements QnAMakerClient, TelemetryQnAMaker {
|
||||||
}
|
}
|
||||||
this.endpoint = withEndpoint;
|
this.endpoint = withEndpoint;
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(this.endpoint.getKnowledgeBaseId())) {
|
if (StringUtils.isBlank(this.endpoint.getKnowledgeBaseId())) {
|
||||||
throw new IllegalArgumentException("knowledgeBaseId");
|
throw new IllegalArgumentException("knowledgeBaseId");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(this.endpoint.getHost())) {
|
if (StringUtils.isBlank(this.endpoint.getHost())) {
|
||||||
throw new IllegalArgumentException("host");
|
throw new IllegalArgumentException("host");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(this.endpoint.getEndpointKey())) {
|
if (StringUtils.isBlank(this.endpoint.getEndpointKey())) {
|
||||||
throw new IllegalArgumentException("endpointKey");
|
throw new IllegalArgumentException("endpointKey");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +221,7 @@ public class QnAMaker implements QnAMakerClient, TelemetryQnAMaker {
|
||||||
return Async.completeExceptionally(new IllegalArgumentException("Activity type is not a message"));
|
return Async.completeExceptionally(new IllegalArgumentException("Activity type is not a message"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(turnContext.getActivity().getText())) {
|
if (StringUtils.isBlank(turnContext.getActivity().getText())) {
|
||||||
return Async.completeExceptionally(new IllegalArgumentException("Null or empty text"));
|
return Async.completeExceptionally(new IllegalArgumentException("Null or empty text"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class FeedbackRecord {
|
||||||
private Integer qnaId;
|
private Integer qnaId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the feedback recod's user ID.
|
* Gets the feedback record's user ID.
|
||||||
*
|
*
|
||||||
* @return The user ID.
|
* @return The user ID.
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +28,7 @@ public class FeedbackRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the feedback recod's user ID.
|
* Sets the feedback record's user ID.
|
||||||
*
|
*
|
||||||
* @param withUserId The user ID.
|
* @param withUserId The user ID.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,11 +14,11 @@ import javax.annotation.Nullable;
|
||||||
* Class to bind activities.
|
* Class to bind activities.
|
||||||
*/
|
*/
|
||||||
public class BindToActivity {
|
public class BindToActivity {
|
||||||
private Activity activity;
|
private final Activity activity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct to bind an Activity.
|
* Construct to bind an Activity.
|
||||||
*
|
*
|
||||||
* @param withActivity activity to bind.
|
* @param withActivity activity to bind.
|
||||||
*/
|
*/
|
||||||
public BindToActivity(Activity withActivity) {
|
public BindToActivity(Activity withActivity) {
|
||||||
|
@ -37,7 +37,7 @@ public class BindToActivity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the activity text.
|
* Get the activity text.
|
||||||
*
|
*
|
||||||
* @return The activity text.
|
* @return The activity text.
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
|
||||||
* Helper for HTTP requests.
|
* Helper for HTTP requests.
|
||||||
*/
|
*/
|
||||||
public class HttpRequestUtils {
|
public class HttpRequestUtils {
|
||||||
private OkHttpClient httpClient = new OkHttpClient();
|
private final OkHttpClient httpClient = new OkHttpClient();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute Http request.
|
* Execute Http request.
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class QnAMakerRecognizerTests {
|
||||||
|
|
||||||
private String readFileContent (String fileName) throws IOException {
|
private String readFileContent (String fileName) throws IOException {
|
||||||
String path = Paths.get("", "src", "test", "java", "com", "microsoft", "bot", "ai", "qna",
|
String path = Paths.get("", "src", "test", "java", "com", "microsoft", "bot", "ai", "qna",
|
||||||
"testData", fileName).toAbsolutePath().toString();
|
"testdata", fileName).toAbsolutePath().toString();
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
return FileUtils.readFileToString(file, "utf-8");
|
return FileUtils.readFileToString(file, "utf-8");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1109,7 +1109,7 @@ public class QnAMakerTests {
|
||||||
|
|
||||||
QnAMakerOptions allChangedRequestOptions = new QnAMakerOptions();
|
QnAMakerOptions allChangedRequestOptions = new QnAMakerOptions();
|
||||||
allChangedRequestOptions.setTop(2000);
|
allChangedRequestOptions.setTop(2000);
|
||||||
allChangedRequestOptions.setScoreThreshold(0.4f);
|
allChangedRequestOptions.setScoreThreshold(0.42f);
|
||||||
allChangedRequestOptions.setStrictFilters(allChangedRequestOptionsFilters);
|
allChangedRequestOptions.setStrictFilters(allChangedRequestOptionsFilters);
|
||||||
|
|
||||||
QnAMaker qna = new QnAMaker(qnAMakerEndpoint, noFiltersOptions);
|
QnAMaker qna = new QnAMaker(qnAMakerEndpoint, noFiltersOptions);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче