Skip to content

Commit

Permalink
Text:Update Text Interface 1.6 spec
Browse files Browse the repository at this point in the history
It update to handle the asrContext during parsing ExpectTyping directive.

Signed-off-by: Hyungrok.Kim <hr97gdi@sk.com>
  • Loading branch information
kimhyungrok committed Dec 22, 2021
1 parent cf084a0 commit 7e357bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/capability/text_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,20 @@ void TextAgent::sendEventTextInput(const TextInputParam& text_input_param, bool
if (!text_input_param.ps_id.empty())
root["playServiceId"] = text_input_param.ps_id;
else if (include_dialog_attribute) {
auto composeDialogAttribute = [&](const std::string& ps_id, const std::list<std::string>& domain_types) {
auto composeDialogAttribute = [&](const std::string& ps_id, const std::list<std::string>& domain_types, const Json::Value& asr_context = Json::nullValue) {
if (!ps_id.empty())
root["playServiceId"] = ps_id;

for (const auto& domain_type : domain_types)
if (!domain_type.empty())
root["domainTypes"].append(domain_type);

if (!asr_context.isNull())
root["asrContext"] = asr_context;
};

if (expect_typing.is_handle) {
composeDialogAttribute(expect_typing.ps_id, expect_typing.domain_types);
composeDialogAttribute(expect_typing.ps_id, expect_typing.domain_types, expect_typing.asr_context);
} else {
std::string ps_id = "";
std::list<std::string> domain_types;
Expand Down Expand Up @@ -380,6 +383,9 @@ void TextAgent::parsingExpectTyping(const char* message)
expect_typing.domain_types.emplace_back(domain_type);
}
}

if (root.isMember("asrContext"))
expect_typing.asr_context = root["asrContext"];
}

bool TextAgent::handleTextCommonProcess(const TextInputParam& text_input_param)
Expand Down
1 change: 1 addition & 0 deletions src/capability/text_agent.hh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private:
std::string playstack;
std::string ps_id;
std::list<std::string> domain_types;
Json::Value asr_context;
};

std::string requestTextInput(TextInputParam&& text_input_param, bool routine_play, bool include_dialog_attribute = true);
Expand Down

0 comments on commit 7e357bd

Please sign in to comment.