a9 commited on
Commit
8e76106
·
verified ·
1 Parent(s): ffe654a

Upload 26 files

Browse files
Dockerfile CHANGED
@@ -5,7 +5,7 @@ COPY frontend ./frontend
5
  WORKDIR /app/frontend
6
  RUN npm install && npm run build
7
 
8
- FROM python:3.11
9
 
10
  WORKDIR /app
11
  COPY . .
@@ -13,6 +13,6 @@ COPY . .
13
  # copy frontend build
14
  COPY --from=frontend /app/frontend/dist ./static
15
 
16
- RUN pip install fastapi uvicorn httpx
17
 
18
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
5
  WORKDIR /app/frontend
6
  RUN npm install && npm run build
7
 
8
+ FROM python:3.11-slim
9
 
10
  WORKDIR /app
11
  COPY . .
 
13
  # copy frontend build
14
  COPY --from=frontend /app/frontend/dist ./static
15
 
16
+ RUN pip install fastapi uvicorn httpx pydantic
17
 
18
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
api/routes/status.py CHANGED
@@ -1,8 +1,7 @@
1
  from fastapi import APIRouter
2
- from services.storage import InMemoryStorage
3
 
4
  router = APIRouter()
5
- storage = InMemoryStorage()
6
 
7
 
8
  @router.get("/")
 
1
  from fastapi import APIRouter
2
+ from services.storage import storage
3
 
4
  router = APIRouter()
 
5
 
6
 
7
  @router.get("/")
frontend/src/main.tsx CHANGED
@@ -3,4 +3,14 @@ import ReactDOM from "react-dom/client";
3
  import App from "./App";
4
  import "./index.css";
5
 
6
- ReactDOM.createRoot(document.getElementById("root")!).render(<App />);
 
 
 
 
 
 
 
 
 
 
 
3
  import App from "./App";
4
  import "./index.css";
5
 
6
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
7
+
8
+ const queryClient = new QueryClient();
9
+
10
+ ReactDOM.createRoot(document.getElementById("root")!).render(
11
+ <React.StrictMode>
12
+ <QueryClientProvider client={queryClient}>
13
+ <App />
14
+ </QueryClientProvider>
15
+ </React.StrictMode>
16
+ );
services/connection_manager.py CHANGED
@@ -35,6 +35,11 @@ class RepoConnection:
35
  self.is_running = False
36
 
37
  except Exception:
 
 
 
 
 
38
  attempt += 1
39
  await exponential_backoff(attempt)
40
 
 
35
  self.is_running = False
36
 
37
  except Exception:
38
+ storage.set_status(self.repo_id, RepoStatus(
39
+ state="ERROR",
40
+ stage="Disconnected",
41
+ last_updated=datetime.utcnow()
42
+ ))
43
  attempt += 1
44
  await exponential_backoff(attempt)
45
 
services/storage.py CHANGED
@@ -85,6 +85,16 @@ class InMemoryStorage:
85
  return []
86
 
87
  return repo.get(range, [])
 
 
 
 
 
 
 
 
 
 
88
 
89
  # Global instance
90
  storage = InMemoryStorage()
 
85
  return []
86
 
87
  return repo.get(range, [])
88
+
89
+ def set_status(self, repo_id: str, status: RepoStatus):
90
+ self.status[repo_id] = status
91
+
92
+ def get_status(self, repo_id: str):
93
+ return self.status.get(repo_id, {
94
+ "state": "DISCONNECTED",
95
+ "stage": "Unknown",
96
+ "last_updated": None
97
+ })
98
 
99
  # Global instance
100
  storage = InMemoryStorage()