guantao 16 часов назад
Родитель
Сommit
1a1b30d28b
1 измененных файлов с 1 добавлено и 10 удалено
  1. 1 10
      knowhub/server.py

+ 1 - 10
knowhub/server.py

@@ -2437,7 +2437,6 @@ def delete_requirement(req_id: str):
         raise
     except Exception as e:
         raise HTTPException(status_code=500, detail=str(e))
-<<<<<<< HEAD
 
 
 @app.post("/api/pattern/posts/batch")
@@ -2468,7 +2467,6 @@ def frontend():
     if not index_file.exists():
         return HTMLResponse("<h1>KnowHub Frontend Not Found</h1><p>Please ensure knowhub/frontend/dist/index.html exists. Run 'yarn build' in frontend directory.</p>", status_code=404)
     return FileResponse(str(index_file))
-=======
 # ===== Relation API =====
 
 @app.get("/api/relation/{table_name}")
@@ -2519,7 +2517,6 @@ async def get_relations(table_name: str, request: Request):
             cursor.close()
     except Exception as e:
         raise HTTPException(status_code=500, detail=str(e))
->>>>>>> origin/main
 
 @app.get("/category_tree.json")
 def serve_category_tree():
@@ -2529,11 +2526,10 @@ def serve_category_tree():
         return {"error": "Not Found"}
     return FileResponse(str(tree_file))
 
-<<<<<<< HEAD
 
 @app.get("/{frontend_path:path}")
 def frontend_spa_fallback(frontend_path: str):
-    """SPA 路由兜底:将非 API 的前端子路径回退到 index.html。"""
+    """SPA 路由兜底:将非 API 的前端子路径回退到 index.html,由 React Router 处理。"""
     if frontend_path.startswith("api/") or frontend_path.startswith("assets/"):
         raise HTTPException(status_code=404, detail="Not Found")
 
@@ -2541,11 +2537,6 @@ def frontend_spa_fallback(frontend_path: str):
     if "." in Path(frontend_path).name:
         raise HTTPException(status_code=404, detail="Not Found")
 
-=======
-@app.get("/{full_path:path}")
-def frontend(full_path: str):
-    """KnowHub 管理前端 — 所有非 API 路径都返回 index.html,由 React Router 处理"""
->>>>>>> origin/main
     index_file = STATIC_DIR / "index.html"
     if not index_file.exists():
         return HTMLResponse("<h1>KnowHub Frontend Not Found</h1><p>Please ensure knowhub/frontend/dist/index.html exists. Run 'yarn build' in frontend directory.</p>", status_code=404)