fix: add missing display_name to PluginModel creation in lifespan
The PluginModel.display_name column is NOT NULL but was not set when auto-installing builtin plugins during app startup, causing IntegrityError. Fix mirrors the pattern used in registry.install().
This commit is contained in:
+3
-2
@@ -120,6 +120,7 @@ async def lifespan(app: FastAPI):
|
|||||||
# Create DB record for this builtin plugin
|
# Create DB record for this builtin plugin
|
||||||
plugin_record = PluginModel(
|
plugin_record = PluginModel(
|
||||||
name=name,
|
name=name,
|
||||||
|
display_name=plugin.manifest.display_name,
|
||||||
version=plugin.manifest.version,
|
version=plugin.manifest.version,
|
||||||
status="installed",
|
status="installed",
|
||||||
active=True,
|
active=True,
|
||||||
@@ -186,7 +187,7 @@ def create_app() -> FastAPI:
|
|||||||
app.include_router(ai_copilot.router)
|
app.include_router(ai_copilot.router)
|
||||||
app.include_router(workflows.router)
|
app.include_router(workflows.router)
|
||||||
|
|
||||||
# ─── Register plugin routes (before SPA catch-all) ──────────────────
|
# ── Register plugin routes (before SPA catch-all) ────────────────
|
||||||
registry = get_registry()
|
registry = get_registry()
|
||||||
try:
|
try:
|
||||||
registry.discover_builtins()
|
registry.discover_builtins()
|
||||||
@@ -205,7 +206,7 @@ def create_app() -> FastAPI:
|
|||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.warning(f"Plugin discovery failed: {exc}")
|
logger.warning(f"Plugin discovery failed: {exc}")
|
||||||
|
|
||||||
# ─── Serve frontend static files (SPA) ───────────────────────────────
|
# ── Serve frontend static files (SPA) ────────────────────────────
|
||||||
# Mount built frontend assets (JS, CSS, images)
|
# Mount built frontend assets (JS, CSS, images)
|
||||||
frontend_dist = os.path.join(os.path.dirname(__file__), "..", "frontend", "dist")
|
frontend_dist = os.path.join(os.path.dirname(__file__), "..", "frontend", "dist")
|
||||||
if os.path.isdir(frontend_dist):
|
if os.path.isdir(frontend_dist):
|
||||||
|
|||||||
Reference in New Issue
Block a user