Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/chat-ui/src/components/ChatWindow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export default function ChatWindow() {

useEffect(() => {
if (!state.currentConversation) return;
const url = new URL(`${API_BASE_URL}/stream/${state.currentConversation.id}`);
const base = API_BASE_URL || window.location.origin;
const url = new URL(`/stream/${state.currentConversation.id}`, base);
Comment on lines +17 to +18

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P1] Preserve path prefixes when building EventSource URL

Building the URL via new URL('/stream/...', base) resets the path component of base when it contains a subpath. If VITE_API_BASE_URL is configured as https://example.com/api, the previous string concatenation produced https://example.com/api/stream/..., but the new implementation now resolves to https://example.com/stream/..., dropping the /api prefix and causing the SSE connection to hit the wrong endpoint. Construct the URL without stripping path segments (e.g. avoid the leading / or ensure the base already includes the trailing slash).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@codex fix comments

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Testing

  • npm test

View task →

const apiKey = import.meta.env.VITE_API_KEY;
if (apiKey) {
url.searchParams.set('api_key', apiKey);
Expand Down