sync update from LAN repo (source dhk-1 @ 3b1ec5b4)
This commit is contained in:
1 parent
da6521b6cb
commit
264e2200d6
995 files changed
+148105
-13399
No files matched your search
@@ -10,7 +10,7 @@ from pathlib import Path
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi.responses import FileResponse, Response
|
||||
|
||||
from deerflow.config import get_app_config
|
||||
from deerflow.html_runtime.addresses import html_map_tile_url, html_runtime_base_url
|
||||
|
||||
router = APIRouter(prefix="/api/public/html-runtime", tags=["html-runtime"])
|
||||
|
||||
@@ -26,6 +26,8 @@ _STATIC_ASSETS = {
|
||||
"alpine.min.js": "application/javascript",
|
||||
"echarts.min.js": "application/javascript",
|
||||
"g6.min.js": "application/javascript",
|
||||
"leaflet.js": "application/javascript",
|
||||
"leaflet.css": "text/css",
|
||||
}
|
||||
_GEO_MAP_ASSETS = {
|
||||
"china-provinces.geojson": "application/geo+json",
|
||||
@@ -57,8 +59,8 @@ async def get_deerflow_html_runtime() -> Response:
|
||||
path = _RUNTIME_DIR / "deerflow-runtime.js"
|
||||
if not path.is_file():
|
||||
raise HTTPException(status_code=503, detail="HTML runtime is not installed")
|
||||
config = get_app_config().html_runtime
|
||||
base_url = config.base_url.rstrip("/")
|
||||
base_url = html_runtime_base_url()
|
||||
tile_url = html_map_tile_url()
|
||||
runtime_config = {
|
||||
"geoMaps": {
|
||||
"china-provinces": f"{base_url}/maps/china-provinces.geojson",
|
||||
@@ -66,6 +68,7 @@ async def get_deerflow_html_runtime() -> Response:
|
||||
"japan-prefectures": f"{base_url}/maps/japan-prefectures.geojson",
|
||||
"taiwan-counties": f"{base_url}/maps/taiwan-counties.geojson",
|
||||
},
|
||||
"mapTileUrl": tile_url,
|
||||
}
|
||||
prefix = f"window.DEERFLOW_HTML_RUNTIME_CONFIG={json.dumps(runtime_config)};\n"
|
||||
return Response(
|
||||
|
||||
Reference in new issue
Block a user