17
app.py
17
app.py
@@ -1,6 +1,23 @@
|
||||
# app.py — slim orchestrator
|
||||
import mimetypes
|
||||
import os
|
||||
|
||||
|
||||
def register_static_mime_types() -> None:
|
||||
"""Force stable JS module MIME types across platforms.
|
||||
|
||||
Some native Windows setups inherit stale/incorrect registry mappings for
|
||||
``.js``/``.mjs``, which can make Starlette serve ES modules with a non-JS
|
||||
``Content-Type`` and cause the UI to load but fail on click. Re-register the
|
||||
standard MIME types at startup so static assets are served consistently.
|
||||
"""
|
||||
|
||||
mimetypes.add_type("text/javascript", ".js")
|
||||
mimetypes.add_type("application/javascript", ".mjs")
|
||||
|
||||
|
||||
register_static_mime_types()
|
||||
|
||||
# Windows: force HuggingFace/fastembed to COPY model files instead of symlinking.
|
||||
# On a network-share/UNC data dir Windows can't follow HF's symlinks ([WinError
|
||||
# 1463]), so the ONNX embedding model fails to load. huggingface_hub reads this
|
||||
|
||||
Reference in New Issue
Block a user