From 0880c7f72250d38494686dc271a8111e11502627 Mon Sep 17 00:00:00 2001 From: "haowei.yao" Date: Thu, 5 Jul 2018 14:35:10 +0800 Subject: [PATCH] =?UTF-8?q?CHATBOT=20SDK=20Auto=20Released=20By=20yanke.yk?= =?UTF-8?q?,Version=EF=BC=9A1.19.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: haowei.yao --- CHANGELOG | 3 + CMakeLists.txt | 3 +- VERSION | 2 +- chatbot/CMakeLists.txt | 86 ++++++++++++ .../alibabacloud/chatbot/ChatbotClient.h | 54 ++++++++ .../alibabacloud/chatbot/ChatbotExport.h | 32 +++++ .../alibabacloud/chatbot/model/ChatRequest.h | 72 ++++++++++ .../alibabacloud/chatbot/model/ChatResult.h | 85 ++++++++++++ chatbot/src/ChatbotClient.cc | 89 ++++++++++++ chatbot/src/model/ChatRequest.cc | 127 ++++++++++++++++++ chatbot/src/model/ChatResult.cc | 111 +++++++++++++++ 11 files changed, 662 insertions(+), 2 deletions(-) create mode 100644 chatbot/CMakeLists.txt create mode 100644 chatbot/include/alibabacloud/chatbot/ChatbotClient.h create mode 100644 chatbot/include/alibabacloud/chatbot/ChatbotExport.h create mode 100644 chatbot/include/alibabacloud/chatbot/model/ChatRequest.h create mode 100644 chatbot/include/alibabacloud/chatbot/model/ChatResult.h create mode 100644 chatbot/src/ChatbotClient.cc create mode 100644 chatbot/src/model/ChatRequest.cc create mode 100644 chatbot/src/model/ChatResult.cc diff --git a/CHANGELOG b/CHANGELOG index 7bdbde64a..3b6045a18 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2018-07-05 Version: 1.19.0 +1, A new optional parameter 'Perspectives' is introduced to the 'Chat' API. By filling this parameter when calling 'Chat', you'll get the knowledge base content within the specified perspectives. + 2018-06-28 Version: 1.18.1 1, ScalingConfiguration support hostName and passwordInherit 2, ScalingConfiguration support modify diff --git a/CMakeLists.txt b/CMakeLists.txt index 2871ffe8e..0f6ba71d3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,4 +78,5 @@ add_subdirectory(drds) add_subdirectory(jarvis) add_subdirectory(scdn) add_subdirectory(live) -add_subdirectory(rtc) \ No newline at end of file +add_subdirectory(rtc) +add_subdirectory(chatbot) \ No newline at end of file diff --git a/VERSION b/VERSION index 5ce8b3959..c1af674ec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.1 \ No newline at end of file +1.19.0 \ No newline at end of file diff --git a/chatbot/CMakeLists.txt b/chatbot/CMakeLists.txt new file mode 100644 index 000000000..cdc8363a3 --- /dev/null +++ b/chatbot/CMakeLists.txt @@ -0,0 +1,86 @@ +# +# Copyright 2009-2017 Alibaba Cloud All rights reserved. +# +# Licensed 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. +# + +set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include) + +set(chatbot_public_header + include/alibabacloud/chatbot/ChatbotClient.h + include/alibabacloud/chatbot/ChatbotExport.h ) + +set(chatbot_public_header_model + include/alibabacloud/chatbot/model/ChatRequest.h + include/alibabacloud/chatbot/model/ChatResult.h ) + +set(chatbot_src + src/ChatbotClient.cc + src/model/ChatRequest.cc + src/model/ChatResult.cc ) + +add_library(chatbot ${LIB_TYPE} + ${chatbot_public_header} + ${chatbot_public_header_model} + ${chatbot_src}) + +set_target_properties(chatbot + PROPERTIES + LINKER_LANGUAGE CXX + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}chatbot + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(chatbot + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_CHATBOT_LIBRARY) +endif() + +target_include_directories(chatbot + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(chatbot + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(chatbot + jsoncpp) + target_include_directories(chatbot + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(chatbot + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(chatbot + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(chatbot + PRIVATE /usr/include/jsoncpp) + target_link_libraries(chatbot + jsoncpp) +endif() + +install(FILES ${chatbot_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/chatbot) +install(FILES ${chatbot_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/chatbot/model) +install(TARGETS chatbot + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/chatbot/include/alibabacloud/chatbot/ChatbotClient.h b/chatbot/include/alibabacloud/chatbot/ChatbotClient.h new file mode 100644 index 000000000..96da19aca --- /dev/null +++ b/chatbot/include/alibabacloud/chatbot/ChatbotClient.h @@ -0,0 +1,54 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#ifndef ALIBABACLOUD_CHATBOT_CHATBOTCLIENT_H_ +#define ALIBABACLOUD_CHATBOT_CHATBOTCLIENT_H_ + +#include +#include +#include +#include +#include "ChatbotExport.h" +#include "model/ChatRequest.h" +#include "model/ChatResult.h" + + +namespace AlibabaCloud +{ + namespace Chatbot + { + class ALIBABACLOUD_CHATBOT_EXPORT ChatbotClient : public RpcServiceClient + { + public: + typedef Outcome ChatOutcome; + typedef std::future ChatOutcomeCallable; + typedef std::function&)> ChatAsyncHandler; + + ChatbotClient(const Credentials &credentials, const ClientConfiguration &configuration); + ChatbotClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + ChatbotClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~ChatbotClient(); + ChatOutcome chat(const Model::ChatRequest &request)const; + void chatAsync(const Model::ChatRequest& request, const ChatAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ChatOutcomeCallable chatCallable(const Model::ChatRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_CHATBOT_CHATBOTCLIENT_H_ diff --git a/chatbot/include/alibabacloud/chatbot/ChatbotExport.h b/chatbot/include/alibabacloud/chatbot/ChatbotExport.h new file mode 100644 index 000000000..498f3cb69 --- /dev/null +++ b/chatbot/include/alibabacloud/chatbot/ChatbotExport.h @@ -0,0 +1,32 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#ifndef ALIBABACLOUD_CHATBOT_CHATBOTEXPORT_H_ +#define ALIBABACLOUD_CHATBOT_CHATBOTEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_CHATBOT_LIBRARY) +# define ALIBABACLOUD_CHATBOT_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_CHATBOT_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_CHATBOT_EXPORT +#endif + +#endif // !ALIBABACLOUD_CHATBOT_CHATBOTEXPORT_H_ \ No newline at end of file diff --git a/chatbot/include/alibabacloud/chatbot/model/ChatRequest.h b/chatbot/include/alibabacloud/chatbot/model/ChatRequest.h new file mode 100644 index 000000000..356784630 --- /dev/null +++ b/chatbot/include/alibabacloud/chatbot/model/ChatRequest.h @@ -0,0 +1,72 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#ifndef ALIBABACLOUD_CHATBOT_MODEL_CHATREQUEST_H_ +#define ALIBABACLOUD_CHATBOT_MODEL_CHATREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Chatbot + { + namespace Model + { + class ALIBABACLOUD_CHATBOT_EXPORT ChatRequest : public RpcServiceRequest + { + + public: + ChatRequest(); + ~ChatRequest(); + + std::string getKnowledgeId()const; + void setKnowledgeId(const std::string& knowledgeId); + std::string getSenderId()const; + void setSenderId(const std::string& senderId); + std::string getInstanceId()const; + void setInstanceId(const std::string& instanceId); + std::string getSenderNick()const; + void setSenderNick(const std::string& senderNick); + std::vector getPerspective()const; + void setPerspective(const std::vector& perspective); + std::string getSessionId()const; + void setSessionId(const std::string& sessionId); + std::string getTag()const; + void setTag(const std::string& tag); + std::string getUtterance()const; + void setUtterance(const std::string& utterance); + std::string getAccessKeyId()const; + void setAccessKeyId(const std::string& accessKeyId); + + private: + std::string knowledgeId_; + std::string senderId_; + std::string instanceId_; + std::string senderNick_; + std::vector perspective_; + std::string sessionId_; + std::string tag_; + std::string utterance_; + std::string accessKeyId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CHATBOT_MODEL_CHATREQUEST_H_ \ No newline at end of file diff --git a/chatbot/include/alibabacloud/chatbot/model/ChatResult.h b/chatbot/include/alibabacloud/chatbot/model/ChatResult.h new file mode 100644 index 000000000..e554f7dd0 --- /dev/null +++ b/chatbot/include/alibabacloud/chatbot/model/ChatResult.h @@ -0,0 +1,85 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#ifndef ALIBABACLOUD_CHATBOT_MODEL_CHATRESULT_H_ +#define ALIBABACLOUD_CHATBOT_MODEL_CHATRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Chatbot + { + namespace Model + { + class ALIBABACLOUD_CHATBOT_EXPORT ChatResult : public ServiceResult + { + public: + struct Message + { + struct Text + { + std::string content; + std::string answerSource; + }; + struct Knowledge + { + std::string content; + std::string answerSource; + std::string title; + std::string summary; + std::string id; + }; + struct Recommend + { + std::string answerSource; + std::string content; + std::string title; + std::string summary; + std::string knowledgeId; + }; + std::string type; + Text text; + std::vector recommends; + Knowledge knowledge; + }; + + + ChatResult(); + explicit ChatResult(const std::string &payload); + ~ChatResult(); + std::vector getMessages()const; + std::string getTag()const; + std::string getSessionId()const; + std::string getMessageId()const; + + protected: + void parse(const std::string &payload); + private: + std::vector messages_; + std::string tag_; + std::string sessionId_; + std::string messageId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CHATBOT_MODEL_CHATRESULT_H_ \ No newline at end of file diff --git a/chatbot/src/ChatbotClient.cc b/chatbot/src/ChatbotClient.cc new file mode 100644 index 000000000..d312fdd53 --- /dev/null +++ b/chatbot/src/ChatbotClient.cc @@ -0,0 +1,89 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#include +#include + +using namespace AlibabaCloud; +using namespace AlibabaCloud::Location; +using namespace AlibabaCloud::Chatbot; +using namespace AlibabaCloud::Chatbot::Model; + +namespace +{ + const std::string SERVICE_NAME = "Chatbot"; +} + +ChatbotClient::ChatbotClient(const Credentials &credentials, const ClientConfiguration &configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "beebot"); +} + +ChatbotClient::ChatbotClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "beebot"); +} + +ChatbotClient::ChatbotClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) +{ + auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "beebot"); +} + +ChatbotClient::~ChatbotClient() +{} + +ChatbotClient::ChatOutcome ChatbotClient::chat(const ChatRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ChatOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ChatOutcome(ChatResult(outcome.result())); + else + return ChatOutcome(outcome.error()); +} + +void ChatbotClient::chatAsync(const ChatRequest& request, const ChatAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, chat(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ChatbotClient::ChatOutcomeCallable ChatbotClient::chatCallable(const ChatRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->chat(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/chatbot/src/model/ChatRequest.cc b/chatbot/src/model/ChatRequest.cc new file mode 100644 index 000000000..de40d46da --- /dev/null +++ b/chatbot/src/model/ChatRequest.cc @@ -0,0 +1,127 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#include + +using AlibabaCloud::Chatbot::Model::ChatRequest; + +ChatRequest::ChatRequest() : + RpcServiceRequest("chatbot", "2017-10-11", "Chat") +{} + +ChatRequest::~ChatRequest() +{} + +std::string ChatRequest::getKnowledgeId()const +{ + return knowledgeId_; +} + +void ChatRequest::setKnowledgeId(const std::string& knowledgeId) +{ + knowledgeId_ = knowledgeId; + setParameter("KnowledgeId", knowledgeId); +} + +std::string ChatRequest::getSenderId()const +{ + return senderId_; +} + +void ChatRequest::setSenderId(const std::string& senderId) +{ + senderId_ = senderId; + setParameter("SenderId", senderId); +} + +std::string ChatRequest::getInstanceId()const +{ + return instanceId_; +} + +void ChatRequest::setInstanceId(const std::string& instanceId) +{ + instanceId_ = instanceId; + setParameter("InstanceId", instanceId); +} + +std::string ChatRequest::getSenderNick()const +{ + return senderNick_; +} + +void ChatRequest::setSenderNick(const std::string& senderNick) +{ + senderNick_ = senderNick; + setParameter("SenderNick", senderNick); +} + +std::vector ChatRequest::getPerspective()const +{ + return perspective_; +} + +void ChatRequest::setPerspective(const std::vector& perspective) +{ + perspective_ = perspective; + for(int i = 0; i!= perspective.size(); i++) + setParameter("Perspective."+ std::to_string(i), perspective.at(i)); +} + +std::string ChatRequest::getSessionId()const +{ + return sessionId_; +} + +void ChatRequest::setSessionId(const std::string& sessionId) +{ + sessionId_ = sessionId; + setParameter("SessionId", sessionId); +} + +std::string ChatRequest::getTag()const +{ + return tag_; +} + +void ChatRequest::setTag(const std::string& tag) +{ + tag_ = tag; + setParameter("Tag", tag); +} + +std::string ChatRequest::getUtterance()const +{ + return utterance_; +} + +void ChatRequest::setUtterance(const std::string& utterance) +{ + utterance_ = utterance; + setParameter("Utterance", utterance); +} + +std::string ChatRequest::getAccessKeyId()const +{ + return accessKeyId_; +} + +void ChatRequest::setAccessKeyId(const std::string& accessKeyId) +{ + accessKeyId_ = accessKeyId; + setParameter("AccessKeyId", accessKeyId); +} + diff --git a/chatbot/src/model/ChatResult.cc b/chatbot/src/model/ChatResult.cc new file mode 100644 index 000000000..c1395831c --- /dev/null +++ b/chatbot/src/model/ChatResult.cc @@ -0,0 +1,111 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#include +#include + +using namespace AlibabaCloud::Chatbot; +using namespace AlibabaCloud::Chatbot::Model; + +ChatResult::ChatResult() : + ServiceResult() +{} + +ChatResult::ChatResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ChatResult::~ChatResult() +{} + +void ChatResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allMessages = value["Messages"]["Message"]; + for (auto value : allMessages) + { + Message messagesObject; + if(!value["Type"].isNull()) + messagesObject.type = value["Type"].asString(); + auto allRecommends = value["Recommends"]["Recommend"]; + for (auto value : allRecommends) + { + Message::Recommend recommendsObject; + if(!value["KnowledgeId"].isNull()) + recommendsObject.knowledgeId = value["KnowledgeId"].asString(); + if(!value["Title"].isNull()) + recommendsObject.title = value["Title"].asString(); + if(!value["AnswerSource"].isNull()) + recommendsObject.answerSource = value["AnswerSource"].asString(); + if(!value["Summary"].isNull()) + recommendsObject.summary = value["Summary"].asString(); + if(!value["Content"].isNull()) + recommendsObject.content = value["Content"].asString(); + messagesObject.recommends.push_back(recommendsObject); + } + auto textNode = value["Text"]; + if(!textNode["Content"].isNull()) + messagesObject.text.content = textNode["Content"].asString(); + if(!textNode["AnswerSource"].isNull()) + messagesObject.text.answerSource = textNode["AnswerSource"].asString(); + auto knowledgeNode = value["Knowledge"]; + if(!knowledgeNode["Id"].isNull()) + messagesObject.knowledge.id = knowledgeNode["Id"].asString(); + if(!knowledgeNode["Title"].isNull()) + messagesObject.knowledge.title = knowledgeNode["Title"].asString(); + if(!knowledgeNode["Summary"].isNull()) + messagesObject.knowledge.summary = knowledgeNode["Summary"].asString(); + if(!knowledgeNode["Content"].isNull()) + messagesObject.knowledge.content = knowledgeNode["Content"].asString(); + if(!knowledgeNode["AnswerSource"].isNull()) + messagesObject.knowledge.answerSource = knowledgeNode["AnswerSource"].asString(); + messages_.push_back(messagesObject); + } + if(!value["SessionId"].isNull()) + sessionId_ = value["SessionId"].asString(); + if(!value["MessageId"].isNull()) + messageId_ = value["MessageId"].asString(); + if(!value["Tag"].isNull()) + tag_ = value["Tag"].asString(); + +} + +std::vector ChatResult::getMessages()const +{ + return messages_; +} + +std::string ChatResult::getTag()const +{ + return tag_; +} + +std::string ChatResult::getSessionId()const +{ + return sessionId_; +} + +std::string ChatResult::getMessageId()const +{ + return messageId_; +} +