@Override public ConversationDataResponse doExternalCall(URI url, ConversationDataRequest request, long timeoutInMillis) { ConversationDataResponse dataResponse = new ConversationDataResponse(); try { String jsonRequestBody = jsonSerialization.serialize(request); IResponse httpResponse = httpClient.newRequest(url, IHttpClient.Method.POST) .setUserAgent(AI_LABS_USER_AGENT) .setTimeout(timeoutInMillis, TimeUnit.MILLISECONDS) .setBodyEntity(jsonRequestBody, ENCODING, MediaType.APPLICATION_JSON) .send(); dataResponse.setHttpCode(httpResponse.getHttpCode()); dataResponse.setHeader(httpResponse.getHttpHeader()); ConversationDataResponseHolder responseHolder = jsonSerialization.deserialize(httpResponse.getContentAsString(), ConversationDataResponseHolder.class); dataResponse.setConversationMemorySnapshot(responseHolder.getConversationMemorySnapshot()); } catch (IRequest.HttpRequestException | IOException e) { log.error(e.getLocalizedMessage(), e); } return dataResponse; } }
log.info("Request: " + request.toString()); if (response.getHttpCode() != 200) { String message = "HttpCall (%s) didn't return http code 200, instead %s."; log.warn(String.format(message, call.getName(), response.getHttpCode())); log.warn("Error Msg:" + response.getHttpCodeMessage()); if (response.getHttpCode() == 200 && call.isSaveResponse()) { final String responseBody = response.getContentAsString(); String actualContentType = response.getHttpHeader().get(CONTENT_TYPE); if (actualContentType != null) { actualContentType = actualContentType.split(";")[0]; runPostResponse(memory, call, templateDataObjects, response.getHttpCode());
.setBodyEntity(jsonRequestBody, ENCODING, MediaType.APPLICATION_JSON) .send(); log.debug("response: {}", httpResponse.getContentAsString()); final List<String> output = getOutputText(httpResponse.getContentAsString()); final String state = getConversationState(httpResponse.getContentAsString()); if (state != null && !state.equals("READY")) { conversationIdCache.remove(senderId);
.setBodyEntity(jsonRequestBody, ENCODING, MediaType.APPLICATION_JSON) .send(); log.debug("response: {}", httpResponse.getContentAsString()); final List<Output> outputs = getOutputText(httpResponse.getContentAsString()); final List<Map<String, String>> quickReplies = getQuickReplies(httpResponse.getContentAsString()); final String state = getConversationState(httpResponse.getContentAsString()); if (state != null && !state.equals("READY")) { conversationIdCache.remove(senderId);
.setTimeout(EDDI_TIMEOUT, TimeUnit.MILLISECONDS) .send(); List<String> botids = extractBotIdsFromResponse(httpResponse.getContentAsString()); for (String botId : botids) { Integer version = getLatestDeployedBotVersion(botId);