Я клонировал проект из gitHub, который является приложением chatbot, с использованием IBM assistant. К сожалению, в диалоге отображаются только «текстовые» сообщения, но опции. Я хочу показать списки опций для выбора пользователей, но я не знаю, как это сделать.
Спасибо всем заранее.
Ниже приведены Мои коды и JSON-код от IBM Watson
enter code here"output": {
"entities": [],
"generic": [
{
"response_type": "text",
"text": "반갑습니다!\r\n숙명의 모든 걸 알고 있는 Sook BoT 이에요.\r\n어떤 것이 궁금하신가요 송이님?"
},
{
"description": "",
"options": [
{
"label": "학사 FAQ",
"value": {
"input": {
"text": "a"
}
}
},
{
"label": "도서관 안내",
"value": {
"input": {
"text": "b"
}
}
},
{
"label": "식단표",
"value": {
"input": {
"text": "c"
}
}
}
],
"response_type": "option",
"title": "원하시는 질문을 선택하실 수도 있답니다:-)"
}
],
"intents": []
}
}
Thread thread = new Thread(new Runnable() {
public void run() {
try {
if (watsonAssistantSession == null) {
ServiceCall<SessionResponse> call = watsonAssistant.createSession(new CreateSessionOptions.Builder().assistantId(mContext.getString(R.string.assistant_id)).build());
watsonAssistantSession = call.execute();
}
MessageInput input = new MessageInput.Builder()
.text(inputmessage)
.build();
MessageOptions options = new MessageOptions.Builder()
.assistantId(mContext.getString(R.string.assistant_id))
.input(input)
.sessionId(watsonAssistantSession.getSessionId())
.build();
MessageResponse response = watsonAssistant.message(options).execute();
Log.i(TAG, "run: "+response);
final Message outMessage = new Message();
final Message outMessage1 = new Message();
if (response != null &&
response.getOutput() != null &&
!response.getOutput().getGeneric().isEmpty()) {
outMessage.setMessage(response.getOutput().getGeneric().get(0).getText());
outMessage.setId("2");
messageArrayList.add(outMessage);
runOnUiThread(new Runnable() {
public void run() {
mAdapter.notifyDataSetChanged();
if (mAdapter.getItemCount() > 1) {
recyclerView.getLayoutManager().smoothScrollToPosition(recyclerView, null, mAdapter.getItemCount() - 1);
}
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
}
});