GhostWording / gw-config-apis

this repo contains static json that can live through apis with github management only
0 stars 7 forks source link

[bot] Masterfile exclusive file picking system #7

Closed andreasdieryck closed 7 years ago

andreasdieryck commented 7 years ago

We currently define the sequences of our bot in masterfiles. These masterfiles have the following structure:

{
  "GroupName": "All",
  "SequenceFiles": [
    { "order" : 5, "file":"/data/bot/sequences/smalltalk/AreYouReal.json"},
    { "order" : 10, "file":"/data/bot/sequences/smalltalk/DoYouLikePoems.json"},
    { "order" : 20, "file":"/data/bot/sequences/smalltalk/DoYouWantAKittenGif.json"},
    { "order" : 20, "file":"/data/bot/sequences/smalltalk/DoYouWantAPenguinGif.json"},
    { "order" : 20, "file":"/data/bot/sequences/smalltalk/FirstTimeBot.json"},
    { "order" : 20, "file":"/data/bot/sequences/smalltalk/HaveYouRegrets.json"}
    ]
}

There are two rules regarding our current file system:

  1. The client reads it from the smallest "order" number to the largest
  2. When two files have the same order number, they are sent in random order to the user

We would now like to add the possibility to send one file or the other to the user, on a random basis.

For instance in the above example, we may want to send DoYouLikePoems.json or DoYouWantAKittenGif.json to the user, not both. To do that, we need a system that accomodates an "OR" choice of file.

Here's what @Frederikos and I came up with:

{
   "GroupName": "All",
   "SequenceFiles": [
      {
         "order": 5,
         "file": [
            "/data/bot/sequences/smalltalk/AreYouReal.json"
         ]
      },
      {
         "order": 10,
         "file": [
            "/data/bot/sequences/smalltalk/DoYouLikePoems.json",
            "/data/bot/sequences/smalltalk/DoYouWantAKittenGif.json"
         ]
      },
      {
         "order": 20,
         "file": [
            "/data/bot/sequences/smalltalk/DoYouWantAPenguinGif.json"
         ]
      },
      {
         "order": 20,
         "file": [
            "/data/bot/sequences/smalltalk/FirstTimeBot.json"
         ]
      },
      {
         "order": 20,
         "file": [
            "/data/bot/sequences/smalltalk/HaveYouRegrets.json"
         ]
      }
   ]
}

By inserting the files in array objects, we create the possibility to store many of them. Then the client has just to pick randomly one of them when there are more than one. -> we will need to insert arrays for each file entry point, as Sergey pointed out, because we want uniform objects at the same places

@rhwy What do you think about it?

rhwy commented 7 years ago

that's perfect, after talking to Olivier I was going to create an issue with the exact same proposal ;-) (we agree that the point of creating this is to be able to A/B test the sequences ?)

andreasdieryck commented 7 years ago

Yep, for A/B testing

OlivierBourdin commented 7 years ago

Looks good to me, thanks