Spaces:
Runtime error
Runtime error
Upload 33 files
Browse files- server.py +11 -0
- ui_kits/chan-compass/index.html +5 -5
- ui_kits/chan-compass/views.jsx +8 -4
server.py
CHANGED
|
@@ -366,6 +366,17 @@ def _boot():
|
|
| 366 |
# Static frontend mounted LAST so /api/* and /download/* win.
|
| 367 |
app.mount("/", StaticFiles(directory=UI_DIR, html=True), name="ui")
|
| 368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
# Boot background services at import time (uvicorn serves `app` directly).
|
| 370 |
_boot()
|
| 371 |
|
|
|
|
| 366 |
# Static frontend mounted LAST so /api/* and /download/* win.
|
| 367 |
app.mount("/", StaticFiles(directory=UI_DIR, html=True), name="ui")
|
| 368 |
|
| 369 |
+
|
| 370 |
+
@app.middleware("http")
|
| 371 |
+
async def _no_cache_assets(request, call_next):
|
| 372 |
+
resp = await call_next(request)
|
| 373 |
+
p = request.url.path
|
| 374 |
+
if p.endswith((".jsx", ".js", ".css", ".html")) or p == "/":
|
| 375 |
+
resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
| 376 |
+
resp.headers["Pragma"] = "no-cache"
|
| 377 |
+
resp.headers["Expires"] = "0"
|
| 378 |
+
return resp
|
| 379 |
+
|
| 380 |
# Boot background services at import time (uvicorn serves `app` directly).
|
| 381 |
_boot()
|
| 382 |
|
ui_kits/chan-compass/index.html
CHANGED
|
@@ -15,10 +15,10 @@
|
|
| 15 |
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.development.js" crossorigin="anonymous"></script>
|
| 16 |
<script src="https://unpkg.com/@babel/standalone@7.29.0/babel.min.js"></script>
|
| 17 |
<script src="https://unpkg.com/lucide@0.544.0/dist/umd/lucide.min.js"></script>
|
| 18 |
-
<script src="/_ds_bundle.js"></script>
|
| 19 |
-
<script src="/api.js"></script>
|
| 20 |
-
<script src="/md.js"></script>
|
| 21 |
-
<script type="text/babel" src="/views.jsx"></script>
|
| 22 |
-
<script type="text/babel" src="/app.jsx"></script>
|
| 23 |
</body>
|
| 24 |
</html>
|
|
|
|
| 15 |
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.development.js" crossorigin="anonymous"></script>
|
| 16 |
<script src="https://unpkg.com/@babel/standalone@7.29.0/babel.min.js"></script>
|
| 17 |
<script src="https://unpkg.com/lucide@0.544.0/dist/umd/lucide.min.js"></script>
|
| 18 |
+
<script src="/_ds_bundle.js?v=66"></script>
|
| 19 |
+
<script src="/api.js?v=66"></script>
|
| 20 |
+
<script src="/md.js?v=66"></script>
|
| 21 |
+
<script type="text/babel" src="/views.jsx?v=66"></script>
|
| 22 |
+
<script type="text/babel" src="/app.jsx?v=66"></script>
|
| 23 |
</body>
|
| 24 |
</html>
|
ui_kits/chan-compass/views.jsx
CHANGED
|
@@ -436,10 +436,14 @@ function ModelView() {
|
|
| 436 |
try {
|
| 437 |
const r = await API.modelList();
|
| 438 |
setAnalyst(r.analyst || "");
|
| 439 |
-
if (r.analyst === target
|
| 440 |
-
setLoadMsg(
|
| 441 |
-
|
| 442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
}
|
| 444 |
} catch (_) {}
|
| 445 |
}, 2000);
|
|
|
|
| 436 |
try {
|
| 437 |
const r = await API.modelList();
|
| 438 |
setAnalyst(r.analyst || "");
|
| 439 |
+
if (r.analyst === target) {
|
| 440 |
+
setLoadMsg(r.analyst_ready
|
| 441 |
+
? "✅ " + target + " is now the Analyst model."
|
| 442 |
+
: "⏳ " + target + " selected — finishing load…");
|
| 443 |
+
if (r.analyst_ready) {
|
| 444 |
+
clearInterval(poll);
|
| 445 |
+
setTimeout(()=>setLoadMsg(""), 4000);
|
| 446 |
+
}
|
| 447 |
}
|
| 448 |
} catch (_) {}
|
| 449 |
}, 2000);
|