jupyterlab / jupyter-chat

An extension to add a chat panel
BSD 3-Clause "New" or "Revised" License
12 stars 3 forks source link

Question about collaborative chat shared document #25

Closed brichet closed 1 month ago

brichet commented 2 months ago

The shared document in collaborative chat is a JSON formatted as the following:

{
  "messages": {
    "msg_id1": {
      "type": "msg",
      "id": "f7843bee-7e40-4659-84f6-552d492befd3",
      "body": "Hello World!",
      "time": 1714057210.97,
      "sender": "4480f9e7ffc847b3b657d8681ba3a4c8"
    }
  },
  "users": {
    "4480f9e7ffc847b3b657d8681ba3a4c8": {
      "name": "Anonymous Thyone",
      "avatar_url": null,
      "initials": "AT",
      "username": "4480f9e7ffc847b3b657d8681ba3a4c8",
      "color": "var(--jp-collaborator-color7)",
      "display_name": "Anonymous Thyone"
    }
  }
}

Problem

Structuring the messages as a Map is better for message manipulation (edition, deletion), but bring some drawback in comparison with an Array:

Proposed Solution

Switch back to an Array for the messages. This structure has been changed in https://github.com/jupyterlab/jupyter-chat/pull/18 (the first idea of the PR was to add the users section). The part about the messages could be reverted for better readability.