mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 01:50:44 +08:00
fix(chat): handle missing branding dir and full-width layout
Create optional _local/branding directory at startup to avoid StaticFiles FileNotFoundError, and force standalone chat root containers to occupy full width. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
38de5a305f
commit
04050747ae
2 changed files with 15 additions and 0 deletions
|
|
@ -9,6 +9,11 @@
|
|||
<link rel="stylesheet" href="/admin/assets/theme-deepseek.css" />
|
||||
<link rel="stylesheet" href="/admin/assets/theme-presets.css" />
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
min-width: 100%;
|
||||
}
|
||||
body.theme-ds-body.chat-standalone-page {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
|
|
@ -24,6 +29,8 @@
|
|||
flex-direction: column;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
min-width: 100%;
|
||||
}
|
||||
.chat-app--login {
|
||||
flex: 1;
|
||||
|
|
@ -37,6 +44,8 @@
|
|||
#app .chat-layout {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
min-width: 100%;
|
||||
}
|
||||
.chat-sess-row {
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -236,6 +236,12 @@ async def _lifespan(app: FastAPI): # type: ignore[no-untyped-def]
|
|||
def create_app() -> FastAPI:
|
||||
app = FastAPI(title="ops-gateway", version="0.1", lifespan=_lifespan)
|
||||
brand_assets_dir = (Path(PROJECT_ROOT) / "_local" / "branding").resolve()
|
||||
try:
|
||||
brand_assets_dir.mkdir(parents=True, exist_ok=True)
|
||||
except Exception:
|
||||
# Branding assets are optional; if we can't create the directory (permissions),
|
||||
# the static mount should still be safe when empty.
|
||||
pass
|
||||
app.mount("/admin/brand-assets", StaticFiles(directory=str(brand_assets_dir), check_dir=False), name="admin-brand-assets")
|
||||
app.mount("/admin/assets", StaticFiles(directory=str(admin_static_dir())), name="admin-assets")
|
||||
app.include_router(build_admin_router())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue