Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /messages/{message_id}/emoji endpoint to toggle, add, remove message emojis #925

Merged
merged 2 commits into from Jan 25, 2023

Conversation

andreaskoepf
Copy link
Collaborator

Emoji protocol:

class EmojiCode(str, enum.Enum):
    thumbs_up = "+1"  # 馃憤
    thumbs_down = "-1"  # 馃憥
    red_flag = "red_flag"  # 馃毄
    hundred = "100"  # 馃挴
    rofl = "rofl"  # 馃ぃ"
    heart_eyes = "heart_eyes"  # 馃槏
    disappointed = "disappointed"  # 馃槥
    poop = "poop"  # 馃挬
    skull = "skull"  # 馃拃


class EmojiOp(str, enum.Enum):
    togggle = "toggle"
    add = "add"
    remove = "remove"


class MessageEmojiRequest(BaseModel):
    user: User
    op: EmojiOp = EmojiOp.togggle
    emoji: EmojiCode


JSON messages returned by the server /messages or /messages/cursor now have a emojis field with counts of the emojis (null by default).

Example:

{
  "id": "aa77f446-6a19-47cf-a20b-ee394b07c745",
  "frontend_message_id": "8080",
  "text": "world hello world foo foo hello world hello hello world",
  "lang": "en",
  "is_assistant": false,
  "parent_id": "c53581a6-ef17-4c69-a971-391c169f3366",
  "created_date": "2023-01-24T19:14:18.320648+00:00",
  "emojis": {
    "+1": 1
  }
}

@andreaskoepf andreaskoepf requested a review from yk as a code owner January 24, 2023 23:34
@andreaskoepf
Copy link
Collaborator Author

link #917

Copy link
Collaborator

@yk yk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@andreaskoepf andreaskoepf merged commit 558b207 into main Jan 25, 2023
@andreaskoepf andreaskoepf deleted the 917_thumbs_up_down_message_emoji branch January 25, 2023 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants