Spaces:
Paused
Paused
Commit ·
fb96eeb
1
Parent(s): f49efc0
Configure Option 3 decoupled Vercel deployment with API rewrites and dynamic URL resolution
Browse files- main.py +1 -1
- vercel.json +22 -0
- web_ui/index.html +13 -2
main.py
CHANGED
|
@@ -139,7 +139,7 @@ async def health_check() -> Dict[str, Any]:
|
|
| 139 |
"""Health check reporting system and index readiness."""
|
| 140 |
index_mgr = get_index_manager()
|
| 141 |
index_stats = {
|
| 142 |
-
name: idx.index.ntotal for name, idx in index_mgr.indexes.items()
|
| 143 |
}
|
| 144 |
return {
|
| 145 |
"status": "healthy",
|
|
|
|
| 139 |
"""Health check reporting system and index readiness."""
|
| 140 |
index_mgr = get_index_manager()
|
| 141 |
index_stats = {
|
| 142 |
+
name: idx.index.ntotal if hasattr(idx, "index") and idx.index else "qdrant_cloud" for name, idx in index_mgr.indexes.items()
|
| 143 |
}
|
| 144 |
return {
|
| 145 |
"status": "healthy",
|
vercel.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": 2,
|
| 3 |
+
"cleanUrls": true,
|
| 4 |
+
"routes": [
|
| 5 |
+
{
|
| 6 |
+
"src": "/query",
|
| 7 |
+
"dest": "https://hungry-games-dance.loca.lt/query"
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"src": "/languages",
|
| 11 |
+
"dest": "https://hungry-games-dance.loca.lt/languages"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"src": "/health",
|
| 15 |
+
"dest": "https://hungry-games-dance.loca.lt/health"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"src": "/(.*)",
|
| 19 |
+
"dest": "/web_ui/$1"
|
| 20 |
+
}
|
| 21 |
+
]
|
| 22 |
+
}
|
web_ui/index.html
CHANGED
|
@@ -945,6 +945,17 @@
|
|
| 945 |
});
|
| 946 |
searchBtn.addEventListener("click", executeSearch);
|
| 947 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 948 |
async function executeSearch() {
|
| 949 |
const text = queryInput.value.trim();
|
| 950 |
if (!text) return;
|
|
@@ -963,7 +974,7 @@
|
|
| 963 |
fieldNoteText.textContent = `"${text}"`;
|
| 964 |
|
| 965 |
try {
|
| 966 |
-
const response = await fetch("/query", { method: "POST", body: formData });
|
| 967 |
if (!response.ok) {
|
| 968 |
const errText = await response.text();
|
| 969 |
let msg = response.statusText || ("HTTP " + response.status);
|
|
@@ -1040,7 +1051,7 @@
|
|
| 1040 |
formData.append("cross_lingual", isCrossLingual ? "true" : "false");
|
| 1041 |
|
| 1042 |
try {
|
| 1043 |
-
const response = await fetch("/query", { method: "POST", body: formData });
|
| 1044 |
if (!response.ok) {
|
| 1045 |
const errText = await response.text();
|
| 1046 |
let msg = response.statusText || ("HTTP " + response.status);
|
|
|
|
| 945 |
});
|
| 946 |
searchBtn.addEventListener("click", executeSearch);
|
| 947 |
|
| 948 |
+
function getApiUrl(path) {
|
| 949 |
+
if (window.API_BASE_URL) {
|
| 950 |
+
return window.API_BASE_URL.replace(/\/+$/, "") + path;
|
| 951 |
+
}
|
| 952 |
+
const stored = localStorage.getItem("VECTOR_API_URL");
|
| 953 |
+
if (stored) {
|
| 954 |
+
return stored.replace(/\/+$/, "") + path;
|
| 955 |
+
}
|
| 956 |
+
return path;
|
| 957 |
+
}
|
| 958 |
+
|
| 959 |
async function executeSearch() {
|
| 960 |
const text = queryInput.value.trim();
|
| 961 |
if (!text) return;
|
|
|
|
| 974 |
fieldNoteText.textContent = `"${text}"`;
|
| 975 |
|
| 976 |
try {
|
| 977 |
+
const response = await fetch(getApiUrl("/query"), { method: "POST", body: formData });
|
| 978 |
if (!response.ok) {
|
| 979 |
const errText = await response.text();
|
| 980 |
let msg = response.statusText || ("HTTP " + response.status);
|
|
|
|
| 1051 |
formData.append("cross_lingual", isCrossLingual ? "true" : "false");
|
| 1052 |
|
| 1053 |
try {
|
| 1054 |
+
const response = await fetch(getApiUrl("/query"), { method: "POST", body: formData });
|
| 1055 |
if (!response.ok) {
|
| 1056 |
const errText = await response.text();
|
| 1057 |
let msg = response.statusText || ("HTTP " + response.status);
|