Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions frontend/chat-ui/src/api.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || '';
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || '';
const API_KEY = import.meta.env.VITE_API_KEY || '';

Expand Down
3 changes: 2 additions & 1 deletion frontend/chat-ui/src/components/ChatWindow.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useRef } from 'react';
import { useStore } from '../store';
import MessageBubble from './MessageBubble.jsx';
import { API_BASE_URL } from '../api';

export default function ChatWindow() {
const { state, dispatch } = useStore();
Expand All @@ -12,7 +13,7 @@ export default function ChatWindow() {

useEffect(() => {
if (!state.currentConversation) return;
const events = new EventSource(`/stream/${state.currentConversation.id}`);
const events = new EventSource(`${API_BASE_URL}/stream/${state.currentConversation.id}`);

const handleToken = (e) => {
try {
Expand Down
1 change: 1 addition & 0 deletions frontend/chat-ui/src/components/InputBox.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState, useRef } from 'react';
import { useStore } from '../store';
import { API_BASE_URL } from '../api';
import { post } from '../api';

export default function InputBox() {
Expand Down
3 changes: 1 addition & 2 deletions frontend/chat-ui/src/components/MessageActions.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { useStore } from '../store';

const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || '';
import { API_BASE_URL } from '../api';

export default function MessageActions({ message }) {
const { state } = useStore();
Expand Down
1 change: 1 addition & 0 deletions frontend/chat-ui/src/components/Sidebar.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect } from 'react';
import { useStore } from '../store';
import { API_BASE_URL } from '../api';
import { get, post } from '../api';

export default function Sidebar() {
Expand Down
5 changes: 3 additions & 2 deletions frontend/chat-ui/src/components/TopBar.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState, useEffect } from 'react';
import { useStore } from '../store';
import { API_BASE_URL } from '../api';

export default function TopBar() {
const { state, dispatch } = useStore();
Expand All @@ -15,7 +16,7 @@ export default function TopBar() {
setTitle(t);
if (!state.currentConversation) return;
try {
await fetch(`/conversations/${state.currentConversation.id}`, {
await fetch(`${API_BASE_URL}/conversations/${state.currentConversation.id}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Expand All @@ -37,7 +38,7 @@ export default function TopBar() {
const remove = async () => {
if (!state.currentConversation) return;
try {
await fetch(`/conversations/${state.currentConversation.id}`, {
await fetch(`${API_BASE_URL}/conversations/${state.currentConversation.id}`, {
method: 'DELETE',
headers: { 'x-api-key': import.meta.env.VITE_API_KEY },
});
Expand Down