Commit 3745108d authored by Kantz's avatar Kantz
Browse files

VITE_BACKEND_URL entfernt

parent 5c935bed
...@@ -72,11 +72,8 @@ Optional in `math-tutor/frontend/.env`: ...@@ -72,11 +72,8 @@ Optional in `math-tutor/frontend/.env`:
```env ```env
VITE_PROXY_TARGET="http://<BACKEND_HOST>:8000" VITE_PROXY_TARGET="http://<BACKEND_HOST>:8000"
VITE_BACKEND_URL=""
``` ```
`VITE_BACKEND_URL=""` keeps requests relative so they use the proxy. If you set `VITE_BACKEND_URL` to a full URL, requests bypass the proxy and CORS must be configured accordingly.
## Docker Compose (Production-style) ## Docker Compose (Production-style)
Template files: Template files:
......
VITE_BACKEND_URL="" VITE_FRONTEND_LANG="de"
\ No newline at end of file
...@@ -8,9 +8,6 @@ import type { ChatMessage } from "../components/Chat/MessageList"; ...@@ -8,9 +8,6 @@ import type { ChatMessage } from "../components/Chat/MessageList";
import type { RetrievedDoc } from "../components/Retrieval/DocPanel"; import type { RetrievedDoc } from "../components/Retrieval/DocPanel";
import { t } from "../i18n"; import { t } from "../i18n";
// Empty fallback uses Vite proxy (/api -> backend target) in development.
const backendUrl = import.meta.env.VITE_BACKEND_URL || "";
const initialMessages: ChatMessage[] = []; const initialMessages: ChatMessage[] = [];
type ArchivedChatSummary = { type ArchivedChatSummary = {
...@@ -245,7 +242,7 @@ export default function App() { ...@@ -245,7 +242,7 @@ export default function App() {
const loadTasks = async () => { const loadTasks = async () => {
setTasksError(null); setTasksError(null);
try { try {
const response = await fetch(`${backendUrl}/api/tasks`); const response = await fetch(`/api/tasks`);
if (!response.ok) { if (!response.ok) {
throw new Error(`Tasks failed: ${response.status}`); throw new Error(`Tasks failed: ${response.status}`);
} }
...@@ -317,7 +314,7 @@ export default function App() { ...@@ -317,7 +314,7 @@ export default function App() {
const syncTaskSelection = async () => { const syncTaskSelection = async () => {
try { try {
await fetch(`${backendUrl}/api/tasks/select`, { await fetch(`/api/tasks/select`, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({
...@@ -371,7 +368,7 @@ export default function App() { ...@@ -371,7 +368,7 @@ export default function App() {
}; };
} }
const response = await fetch(`${backendUrl}/api/chat`, { const response = await fetch(`/api/chat`, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify(chatPayload), body: JSON.stringify(chatPayload),
...@@ -409,7 +406,7 @@ export default function App() { ...@@ -409,7 +406,7 @@ export default function App() {
} }
try { try {
const contextResponse = await fetch(`${backendUrl}/api/context/retrieval`, { const contextResponse = await fetch(`/api/context/retrieval`, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({
...@@ -514,9 +511,7 @@ export default function App() { ...@@ -514,9 +511,7 @@ export default function App() {
const loadArchives = async () => { const loadArchives = async () => {
setArchiveError(null); setArchiveError(null);
try { try {
const response = await fetch( const response = await fetch(`/api/chat/archives?limit=50`);
`${backendUrl}/api/chat/archives?limit=50`
);
if (!response.ok) { if (!response.ok) {
throw new Error(`Archive list failed: ${response.status}`); throw new Error(`Archive list failed: ${response.status}`);
} }
...@@ -538,9 +533,7 @@ export default function App() { ...@@ -538,9 +533,7 @@ export default function App() {
} }
setArchiveError(null); setArchiveError(null);
try { try {
const response = await fetch( const response = await fetch(`/api/chat/archive/${targetId}`);
`${backendUrl}/api/chat/archive/${targetId}`
);
if (!response.ok) { if (!response.ok) {
throw new Error(`Archive load failed: ${response.status}`); throw new Error(`Archive load failed: ${response.status}`);
} }
...@@ -558,7 +551,7 @@ export default function App() { ...@@ -558,7 +551,7 @@ export default function App() {
if (messages.length) { if (messages.length) {
setIsArchiving(true); setIsArchiving(true);
try { try {
await fetch(`${backendUrl}/api/chat/archive`, { await fetch(`/api/chat/archive`, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({
...@@ -593,7 +586,7 @@ export default function App() { ...@@ -593,7 +586,7 @@ export default function App() {
}); });
try { try {
const response = await fetch(`${backendUrl}/api/canvas/save`, { const response = await fetch(`/api/canvas/save`, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ data_url: dataUrl, filename_hint: "canvas" }), body: JSON.stringify({ data_url: dataUrl, filename_hint: "canvas" }),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment