From 4f6771e7874f401dd6e873da908cdb62a6156da6 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Fri, 17 Apr 2026 14:52:33 +0200 Subject: [PATCH] Update backend and frontend assets for chat session handling --- backend/main.py | 8 +++++--- dist/index.html | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/main.py b/backend/main.py index 80c4cd7..364d138 100644 --- a/backend/main.py +++ b/backend/main.py @@ -771,8 +771,10 @@ async def chat(req: schemas.ChatRequest, db: Session = Depends(get_db)): persist_file_text=True, ) + session_pk = session.id + user_row = models.ChatMessage( - session_pk=session.id, + session_pk=session_pk, role='user', content=req.message, attachments_json=json.dumps(user_attachments or []), @@ -799,7 +801,7 @@ async def chat(req: schemas.ChatRequest, db: Session = Depends(get_db)): try: db_sess = SessionLocal() db_sess.add(models.ChatMessage( - session_pk=session.id, + session_pk=session_pk, role='assistant', content=full_reply, sources_json=json.dumps(sources or []), @@ -817,7 +819,7 @@ async def chat(req: schemas.ChatRequest, db: Session = Depends(get_db)): raise HTTPException(status_code=502, detail=f"Ollama error: {e}") as_row = models.ChatMessage( - session_pk=session.id, role='assistant', content=reply, + session_pk=session_pk, role='assistant', content=reply, sources_json=json.dumps(sources or []) ) db.add(as_row) diff --git a/dist/index.html b/dist/index.html index e9589e0..56863c3 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,8 +5,8 @@ LLM Desktop - - + +