Skip to content

Commit

Permalink
Breaking: API to get a message from SSE removes unused ID param
Browse files Browse the repository at this point in the history
ID were unused since multiple releases.

Change details:
- Before: "[root]/message/[id]?token=[token]"
- Now: "[root]/message/[token]"
  • Loading branch information
clemlesne committed Aug 1, 2023
1 parent 3c3e01e commit 5f81c7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/conversation-api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))


Expand Down
2 changes: 1 addition & 1 deletion src/conversation-ui/src/Conversation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit 5f81c7f

Please sign in to comment.