update
Browse files- Dockerfile +1 -0
- client/src/App.jsx +4 -1
- server/server.py +1 -0
Dockerfile
CHANGED
@@ -3,6 +3,7 @@ WORKDIR /app
|
|
3 |
COPY client/package*.json ./
|
4 |
RUN npm install
|
5 |
COPY client/ ./
|
|
|
6 |
RUN npm run build
|
7 |
|
8 |
FROM python:3.9-slim
|
|
|
3 |
COPY client/package*.json ./
|
4 |
RUN npm install
|
5 |
COPY client/ ./
|
6 |
+
ENV VITE_API_URL=https://mistral-ai-game-jam-dont-lookup.hf.space
|
7 |
RUN npm run build
|
8 |
|
9 |
FROM python:3.9-slim
|
client/src/App.jsx
CHANGED
@@ -13,6 +13,9 @@ import {
|
|
13 |
import RestartAltIcon from "@mui/icons-material/RestartAlt";
|
14 |
import axios from "axios";
|
15 |
|
|
|
|
|
|
|
16 |
function App() {
|
17 |
const [storySegments, setStorySegments] = useState([]);
|
18 |
const [currentChoices, setCurrentChoices] = useState([]);
|
@@ -21,7 +24,7 @@ function App() {
|
|
21 |
const handleStoryAction = async (action, choiceId = null) => {
|
22 |
setIsLoading(true);
|
23 |
try {
|
24 |
-
const response = await axios.post(
|
25 |
message: action,
|
26 |
choice_id: choiceId,
|
27 |
});
|
|
|
13 |
import RestartAltIcon from "@mui/icons-material/RestartAlt";
|
14 |
import axios from "axios";
|
15 |
|
16 |
+
// Get API URL from environment or default to localhost in development
|
17 |
+
const API_URL = import.meta.env.VITE_API_URL || "http://localhost:8000";
|
18 |
+
|
19 |
function App() {
|
20 |
const [storySegments, setStorySegments] = useState([]);
|
21 |
const [currentChoices, setCurrentChoices] = useState([]);
|
|
|
24 |
const handleStoryAction = async (action, choiceId = null) => {
|
25 |
setIsLoading(true);
|
26 |
try {
|
27 |
+
const response = await axios.post(`${API_URL}/api/chat`, {
|
28 |
message: action,
|
29 |
choice_id: choiceId,
|
30 |
});
|
server/server.py
CHANGED
@@ -30,6 +30,7 @@ app.add_middleware(
|
|
30 |
f"http://localhost:{API_PORT}", # API port
|
31 |
"https://huggingface.co", # HF main domain
|
32 |
"https://*.hf.space", # HF Spaces domains
|
|
|
33 |
],
|
34 |
allow_credentials=True,
|
35 |
allow_methods=["*"],
|
|
|
30 |
f"http://localhost:{API_PORT}", # API port
|
31 |
"https://huggingface.co", # HF main domain
|
32 |
"https://*.hf.space", # HF Spaces domains
|
33 |
+
"https://mistral-ai-game-jam-dont-lookup.hf.space" # Our HF Space URL
|
34 |
],
|
35 |
allow_credentials=True,
|
36 |
allow_methods=["*"],
|