From 5f81c7f19d040e35bdecade8507e8506703d51f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mence=20Lesn=C3=A9?= Date: Tue, 1 Aug 2023 21:35:29 +0200 Subject: [PATCH] Breaking: API to get a message from SSE removes unused ID param ID were unused since multiple releases. Change details: - Before: "[root]/message/[id]?token=[token]" - Now: "[root]/message/[token]" --- src/conversation-api/main.py | 7 +++++-- src/conversation-ui/src/Conversation.jsx | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/conversation-api/main.py b/src/conversation-api/main.py index 10caf989..7b5c1ab0 100644 --- a/src/conversation-api/main.py +++ b/src/conversation-api/main.py @@ -433,8 +433,11 @@ async def message_post( ) -@api.get("/message/{id}") -async def message_get(id: UUID, token: UUID, req: Request) -> EventSourceResponse: +@api.get( + "/message/{token}", + description="Load a message from its token. This endpoint is used for SSE. No authentication is required.", +) +async def message_get(token: UUID, req: Request) -> EventSourceResponse: return EventSourceResponse(_read_message_sse(req, token)) diff --git a/src/conversation-ui/src/Conversation.jsx b/src/conversation-ui/src/Conversation.jsx index 01037a09..4ebe92df 100644 --- a/src/conversation-ui/src/Conversation.jsx +++ b/src/conversation-ui/src/Conversation.jsx @@ -191,7 +191,7 @@ function Conversation() { let content = ""; let actions = []; const source = new EventSource( - `${client.defaults.baseURL}/message/${lastMessage.id}?token=${lastMessage.token}` + `${client.defaults.baseURL}/message/${lastMessage.token}` ); source.onmessage = (e) => { if (e.data === "STOP") {