Spaces:
Sleeping
Sleeping
Commit
·
b2520cd
1
Parent(s):
90fb615
Hard fix namer
Browse files- routes/sessions.py +11 -0
- static/sessions.js +3 -2
routes/sessions.py
CHANGED
|
@@ -152,6 +152,17 @@ async def rename_session(
|
|
| 152 |
raise HTTPException(500, detail=f"Failed to rename session: {str(e)}")
|
| 153 |
|
| 154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
@app.delete("/sessions/delete")
|
| 156 |
async def delete_session(
|
| 157 |
user_id: str = Form(...),
|
|
|
|
| 152 |
raise HTTPException(500, detail=f"Failed to rename session: {str(e)}")
|
| 153 |
|
| 154 |
|
| 155 |
+
# Some deployments/proxies do not allow PUT; provide POST alias for compatibility
|
| 156 |
+
@app.post("/sessions/rename")
|
| 157 |
+
async def rename_session_post(
|
| 158 |
+
user_id: str = Form(...),
|
| 159 |
+
project_id: str = Form(...),
|
| 160 |
+
session_id: str = Form(...),
|
| 161 |
+
new_name: str = Form(...)
|
| 162 |
+
):
|
| 163 |
+
return await rename_session(user_id=user_id, project_id=project_id, session_id=session_id, new_name=new_name)
|
| 164 |
+
|
| 165 |
+
|
| 166 |
@app.delete("/sessions/delete")
|
| 167 |
async def delete_session(
|
| 168 |
user_id: str = Form(...),
|
static/sessions.js
CHANGED
|
@@ -248,8 +248,9 @@
|
|
| 248 |
formData.append('session_id', currentSessionId);
|
| 249 |
formData.append('new_name', newName);
|
| 250 |
|
|
|
|
| 251 |
const response = await fetch('/sessions/rename', {
|
| 252 |
-
method: '
|
| 253 |
body: formData
|
| 254 |
});
|
| 255 |
|
|
@@ -364,7 +365,7 @@
|
|
| 364 |
const sessionIndex = sessions.findIndex(s => s.session_id === sessionId);
|
| 365 |
if (sessionIndex !== -1) {
|
| 366 |
sessions[sessionIndex].name = newName;
|
| 367 |
-
sessions[sessionIndex].is_auto_named =
|
| 368 |
|
| 369 |
// Update the dropdown to reflect the new name
|
| 370 |
updateSessionDropdown();
|
|
|
|
| 248 |
formData.append('session_id', currentSessionId);
|
| 249 |
formData.append('new_name', newName);
|
| 250 |
|
| 251 |
+
// Use POST for broader proxy compatibility; backend has alias
|
| 252 |
const response = await fetch('/sessions/rename', {
|
| 253 |
+
method: 'POST',
|
| 254 |
body: formData
|
| 255 |
});
|
| 256 |
|
|
|
|
| 365 |
const sessionIndex = sessions.findIndex(s => s.session_id === sessionId);
|
| 366 |
if (sessionIndex !== -1) {
|
| 367 |
sessions[sessionIndex].name = newName;
|
| 368 |
+
sessions[sessionIndex].is_auto_named = false;
|
| 369 |
|
| 370 |
// Update the dropdown to reflect the new name
|
| 371 |
updateSessionDropdown();
|