dmitrizzle / chat-bubble

Simple chatbot UI for the Web with JSON scripting 👋🤖🤙
MIT License
579 stars 171 forks source link

multiple talk will display duplicate reply bubble #72

Closed spdragon closed 4 years ago

spdragon commented 4 years ago
chatWindow.talk({"a": {
        says: ["aaa"],
        reply: [
            {
                question:"a",
                answer: "a"
            }
        ]
    }},"a");
chatWindow.talk({"b": {
        says: ["bbb"],
        reply: [
            {
                question:"b",
                answer: "b"
            }
        ]
    }},"b");
chatWindow.talk({"c": {
        says: ["ccc"],
        reply: [
            {
                question:"c",
                answer: "c"
            }
        ]
    }},"c");

this will only reply with c's question, how to resolve this issue?

dmitrizzle commented 4 years ago

This way you're initializing three separate scripts, which isn't the right way of implementing this tool. As per docs, it should be structured like this:

chatWindow.talk(
  {
    "ice": {
      "says": [ "aaa" ],
      "reply" : [
        {
          "question" : "a",
          "answer" : "b",
        }
      ]
    },
    "b" : {
      "says" : [ "ccc"],
      "reply": [
        {
          "question": "c",
          "answer": "c"
        }
      ]
    } 
  } 
);
dmitrizzle commented 4 years ago

It's been a while since this question was asked, I'll assume it's been sufficiently covered.