Spaces:
Sleeping
Sleeping
umer6016
commited on
Commit
·
f72bd53
1
Parent(s):
d20da3f
Fix API URL undefined error and rebrand to ChatSmith
Browse files- backend/app/main.py +2 -1
- frontend/src/App.jsx +9 -2
backend/app/main.py
CHANGED
|
@@ -64,7 +64,8 @@ def get_application() -> FastAPI:
|
|
| 64 |
<script>
|
| 65 |
window.__ENV__ = {{
|
| 66 |
VITE_SUPABASE_URL: "{supabase_url}",
|
| 67 |
-
VITE_SUPABASE_ANON_KEY: "{supabase_key}"
|
|
|
|
| 68 |
}};
|
| 69 |
</script>
|
| 70 |
"""
|
|
|
|
| 64 |
<script>
|
| 65 |
window.__ENV__ = {{
|
| 66 |
VITE_SUPABASE_URL: "{supabase_url}",
|
| 67 |
+
VITE_SUPABASE_ANON_KEY: "{supabase_key}",
|
| 68 |
+
VITE_API_BASE_URL: "/api"
|
| 69 |
}};
|
| 70 |
</script>
|
| 71 |
"""
|
frontend/src/App.jsx
CHANGED
|
@@ -1,7 +1,14 @@
|
|
| 1 |
import { useRef, useState } from "react";
|
| 2 |
import { supabase } from "./supabaseClient";
|
| 3 |
|
| 4 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
const Panel = ({ title, subtitle, children }) => (
|
| 7 |
<div className="card">
|
|
@@ -283,7 +290,7 @@ export default function App() {
|
|
| 283 |
const Header = () => (
|
| 284 |
<header className="hero">
|
| 285 |
<div>
|
| 286 |
-
<h1>
|
| 287 |
<p className="muted">
|
| 288 |
{firstNameDisplay
|
| 289 |
? `Welcome, ${firstNameDisplay}`
|
|
|
|
| 1 |
import { useRef, useState } from "react";
|
| 2 |
import { supabase } from "./supabaseClient";
|
| 3 |
|
| 4 |
+
const getEnv = (key) => {
|
| 5 |
+
if (typeof window !== "undefined" && window.__ENV__ && window.__ENV__[key]) {
|
| 6 |
+
return window.__ENV__[key];
|
| 7 |
+
}
|
| 8 |
+
return import.meta.env[key];
|
| 9 |
+
};
|
| 10 |
+
|
| 11 |
+
const API_BASE_URL = getEnv("VITE_API_BASE_URL") || "/api";
|
| 12 |
|
| 13 |
const Panel = ({ title, subtitle, children }) => (
|
| 14 |
<div className="card">
|
|
|
|
| 290 |
const Header = () => (
|
| 291 |
<header className="hero">
|
| 292 |
<div>
|
| 293 |
+
<h1>ChatSmith</h1>
|
| 294 |
<p className="muted">
|
| 295 |
{firstNameDisplay
|
| 296 |
? `Welcome, ${firstNameDisplay}`
|