From f6952e980cf779db73fce8795f94ccd49b67ab93 Mon Sep 17 00:00:00 2001 From: DFFM-maker Date: Fri, 26 Dec 2025 08:45:40 +0100 Subject: [PATCH] Fix: RAG implementation and connection fix --- .../69fae64f-b4b8-465e-b4ef-83e6bcf21fbe.txt | 109 -------- .../1d8acaad-0cea-45f6-998b-950a78140b01.txt | 109 -------- .gitignore | 5 + __pycache__/app.cpython-310.pyc | Bin 4424 -> 4667 bytes app.py | 259 ++++++++++-------- error.log | 118 ++++---- 6 files changed, 228 insertions(+), 372 deletions(-) delete mode 100644 .files/7b4a28f6-17ec-4557-aa7a-eb5a68c4f8b7/69fae64f-b4b8-465e-b4ef-83e6bcf21fbe.txt delete mode 100644 .files/fb8f5a48-1655-49e4-b9dd-238f9a463b25/1d8acaad-0cea-45f6-998b-950a78140b01.txt diff --git a/.files/7b4a28f6-17ec-4557-aa7a-eb5a68c4f8b7/69fae64f-b4b8-465e-b4ef-83e6bcf21fbe.txt b/.files/7b4a28f6-17ec-4557-aa7a-eb5a68c4f8b7/69fae64f-b4b8-465e-b4ef-83e6bcf21fbe.txt deleted file mode 100644 index 334bbef9..00000000 --- a/.files/7b4a28f6-17ec-4557-aa7a-eb5a68c4f8b7/69fae64f-b4b8-465e-b4ef-83e6bcf21fbe.txt +++ /dev/null @@ -1,109 +0,0 @@ -chainlit-app-1 | 2025-12-25 17:32:55 - INFO - chainlit - Your app is available at http://0.0.0.0:8000 -chainlit-app-1 | 2025-12-25 17:36:13 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:36:13 - WARNING - chainlit - Translated markdown file for it-IT not found. Defaulting to chainlit.md. -chainlit-app-1 | 2025-12-25 17:36:13 - INFO - chainlit - Missing custom logo. Falling back to default logo. -chainlit-app-1 | 2025-12-25 17:39:46 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:39:47 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:39:47 - WARNING - chainlit - Translated markdown file for it-IT not found. Defaulting to chainlit.md. -chainlit-app-1 | 2025-12-25 17:39:51 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:39:56 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/chat "HTTP/1.1 200 OK" -qdrant-1 | _ _ -qdrant-1 | __ _ __| |_ __ __ _ _ __ | |_ -qdrant-1 | / _` |/ _` | '__/ _` | '_ \| __| -qdrant-1 | | (_| | (_| | | | (_| | | | | |_ -qdrant-1 | \__, |\__,_|_| \__,_|_| |_|\__| -qdrant-1 | |_| -qdrant-1 | -qdrant-1 | Access web UI at https://ui.qdrant.tech/?v=v1.0.0 -qdrant-1 | -qdrant-1 | [2025-12-25T16:38:00.816Z INFO storage::content_manager::consensus::persistent] Initializing new raft state at ./storage/raft_state -qdrant-1 | [2025-12-25T16:38:00.861Z INFO qdrant] Distributed mode disabled -qdrant-1 | [2025-12-25T16:38:00.861Z INFO qdrant] Telemetry reporting enabled, id: e6113e43-627c-471d-8374-0f1b61799d76 -qdrant-1 | [2025-12-25T16:38:00.872Z INFO qdrant::tonic] Qdrant gRPC listening on 6334 -qdrant-1 | [2025-12-25T16:38:00.890Z INFO actix_server::builder] Starting 3 workers -qdrant-1 | [2025-12-25T16:38:00.890Z INFO actix_server::server] Actix runtime found; starting in Actix runtime -qdrant-1 | [2025-12-25T16:39:02.504Z INFO actix_server::server] SIGTERM received; starting graceful shutdown -qdrant-1 | [2025-12-25T16:39:02.505Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | [2025-12-25T16:39:02.508Z INFO actix_server::accept] Accept thread stopped -qdrant-1 | [2025-12-25T16:39:02.508Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | [2025-12-25T16:39:02.508Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | _ _ -qdrant-1 | __ _ __| |_ __ __ _ _ __ | |_ -qdrant-1 | / _` |/ _` | '__/ _` | '_ \| __| -qdrant-1 | | (_| | (_| | | | (_| | | | | |_ -qdrant-1 | \__, |\__,_|_| \__,_|_| |_|\__| -qdrant-1 | |_| -qdrant-1 | -qdrant-1 | Access web UI at https://ui.qdrant.tech/?v=v1.0.0 -qdrant-1 | -qdrant-1 | [2025-12-25T16:43:53.592Z INFO storage::content_manager::consensus::persistent] Loading raft state from ./storage/raft_state -qdrant-1 | [2025-12-25T16:43:53.612Z INFO qdrant] Distributed mode disabled -qdrant-1 | [2025-12-25T16:43:53.612Z INFO qdrant] Telemetry reporting enabled, id: 2a83356a-9770-47d3-a0bd-638f75769522 -qdrant-1 | [2025-12-25T16:43:53.615Z INFO qdrant::tonic] Qdrant gRPC listening on 6334 -qdrant-1 | [2025-12-25T16:43:53.616Z INFO actix_server::builder] Starting 3 workers -qdrant-1 | [2025-12-25T16:43:53.617Z INFO actix_server::server] Actix runtime found; starting in Actix runtime -qdrant-1 | [2025-12-25T16:56:42.005Z INFO actix_server::server] SIGTERM received; starting graceful shutdown -qdrant-1 | [2025-12-25T16:56:42.006Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | [2025-12-25T16:56:42.006Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | [2025-12-25T16:56:42.007Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | [2025-12-25T16:56:42.007Z INFO actix_server::accept] Accept thread stopped -qdrant-1 | _ _ -qdrant-1 | __ _ __| |_ __ __ _ _ __ | |_ -qdrant-1 | / _` |/ _` | '__/ _` | '_ \| __| -qdrant-1 | | (_| | (_| | | | (_| | | | | |_ -qdrant-1 | \__, |\__,_|_| \__,_|_| |_|\__| -qdrant-1 | |_| -qdrant-1 | -qdrant-1 | Access web UI at https://ui.qdrant.tech/?v=v1.0.0 -qdrant-1 | -qdrant-1 | [2025-12-25T16:56:52.790Z INFO storage::content_manager::consensus::persistent] Loading raft state from ./storage/raft_state -qdrant-1 | [2025-12-25T16:56:52.796Z INFO qdrant] Distributed mode disabled -qdrant-1 | [2025-12-25T16:56:52.796Z INFO qdrant] Telemetry reporting enabled, id: f821b8ea-9ee5-497e-a172-dfebf253f7b1 -qdrant-1 | [2025-12-25T16:56:52.797Z INFO qdrant::tonic] Qdrant gRPC listening on 6334 -qdrant-1 | [2025-12-25T16:56:52.798Z INFO actix_server::builder] Starting 3 workers -qdrant-1 | [2025-12-25T16:56:52.798Z INFO actix_server::server] Actix runtime found; starting in Actix runtime -postgres-1 | -postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization -postgres-1 | -postgres-1 | 2025-12-25 16:38:01.071 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit -postgres-1 | 2025-12-25 16:38:01.072 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 -postgres-1 | 2025-12-25 16:38:01.072 UTC [1] LOG: listening on IPv6 address "::", port 5432 -postgres-1 | 2025-12-25 16:38:01.093 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" -postgres-1 | 2025-12-25 16:38:01.126 UTC [32] LOG: database system was shut down at 2025-12-25 14:34:55 UTC -postgres-1 | 2025-12-25 16:38:01.155 UTC [1] LOG: database system is ready to accept connections -postgres-1 | 2025-12-25 16:39:02.495 UTC [1] LOG: received fast shutdown request -postgres-1 | 2025-12-25 16:39:02.505 UTC [1] LOG: aborting any active transactions -postgres-1 | 2025-12-25 16:39:02.521 UTC [1] LOG: background worker "logical replication launcher" (PID 35) exited with exit code 1 -postgres-1 | 2025-12-25 16:39:02.521 UTC [30] LOG: shutting down -postgres-1 | 2025-12-25 16:39:02.533 UTC [30] LOG: checkpoint starting: shutdown immediate -postgres-1 | 2025-12-25 16:39:02.601 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.019 s, sync=0.009 s, total=0.079 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEF980, redo lsn=0/1BEF980 -postgres-1 | 2025-12-25 16:39:02.644 UTC [1] LOG: database system is shut down -postgres-1 | -postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization -postgres-1 | -postgres-1 | 2025-12-25 16:43:53.946 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit -postgres-1 | 2025-12-25 16:43:53.947 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 -postgres-1 | 2025-12-25 16:43:53.947 UTC [1] LOG: listening on IPv6 address "::", port 5432 -postgres-1 | 2025-12-25 16:43:53.965 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" -postgres-1 | 2025-12-25 16:43:53.990 UTC [32] LOG: database system was shut down at 2025-12-25 16:39:02 UTC -postgres-1 | 2025-12-25 16:43:54.013 UTC [1] LOG: database system is ready to accept connections -postgres-1 | 2025-12-25 16:48:54.089 UTC [30] LOG: checkpoint starting: time -postgres-1 | 2025-12-25 16:48:54.175 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.036 s, sync=0.009 s, total=0.088 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFA88, redo lsn=0/1BEFA30 -postgres-1 | 2025-12-25 16:56:42.002 UTC [1] LOG: received fast shutdown request -postgres-1 | 2025-12-25 16:56:42.018 UTC [1] LOG: aborting any active transactions -postgres-1 | 2025-12-25 16:56:42.026 UTC [1] LOG: background worker "logical replication launcher" (PID 35) exited with exit code 1 -postgres-1 | 2025-12-25 16:56:42.030 UTC [30] LOG: shutting down -postgres-1 | 2025-12-25 16:56:42.039 UTC [30] LOG: checkpoint starting: shutdown immediate -postgres-1 | 2025-12-25 16:56:42.086 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 0 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.004 s, sync=0.001 s, total=0.057 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFB38, redo lsn=0/1BEFB38 -postgres-1 | 2025-12-25 16:56:42.131 UTC [1] LOG: database system is shut down -postgres-1 | -postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization -postgres-1 | -postgres-1 | 2025-12-25 16:56:43.530 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit -postgres-1 | 2025-12-25 16:56:43.532 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 -postgres-1 | 2025-12-25 16:56:43.532 UTC [1] LOG: listening on IPv6 address "::", port 5432 -postgres-1 | 2025-12-25 16:56:43.552 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" -postgres-1 | 2025-12-25 16:56:43.585 UTC [32] LOG: database system was shut down at 2025-12-25 16:56:42 UTC -postgres-1 | 2025-12-25 16:56:43.616 UTC [1] LOG: database system is ready to accept connections -postgres-1 | 2025-12-25 17:01:43.645 UTC [30] LOG: checkpoint starting: time -postgres-1 | 2025-12-25 17:01:43.712 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.019 s, sync=0.009 s, total=0.068 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFC40, redo lsn=0/1BEFBE8 diff --git a/.files/fb8f5a48-1655-49e4-b9dd-238f9a463b25/1d8acaad-0cea-45f6-998b-950a78140b01.txt b/.files/fb8f5a48-1655-49e4-b9dd-238f9a463b25/1d8acaad-0cea-45f6-998b-950a78140b01.txt deleted file mode 100644 index 334bbef9..00000000 --- a/.files/fb8f5a48-1655-49e4-b9dd-238f9a463b25/1d8acaad-0cea-45f6-998b-950a78140b01.txt +++ /dev/null @@ -1,109 +0,0 @@ -chainlit-app-1 | 2025-12-25 17:32:55 - INFO - chainlit - Your app is available at http://0.0.0.0:8000 -chainlit-app-1 | 2025-12-25 17:36:13 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:36:13 - WARNING - chainlit - Translated markdown file for it-IT not found. Defaulting to chainlit.md. -chainlit-app-1 | 2025-12-25 17:36:13 - INFO - chainlit - Missing custom logo. Falling back to default logo. -chainlit-app-1 | 2025-12-25 17:39:46 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:39:47 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:39:47 - WARNING - chainlit - Translated markdown file for it-IT not found. Defaulting to chainlit.md. -chainlit-app-1 | 2025-12-25 17:39:51 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:39:56 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/chat "HTTP/1.1 200 OK" -qdrant-1 | _ _ -qdrant-1 | __ _ __| |_ __ __ _ _ __ | |_ -qdrant-1 | / _` |/ _` | '__/ _` | '_ \| __| -qdrant-1 | | (_| | (_| | | | (_| | | | | |_ -qdrant-1 | \__, |\__,_|_| \__,_|_| |_|\__| -qdrant-1 | |_| -qdrant-1 | -qdrant-1 | Access web UI at https://ui.qdrant.tech/?v=v1.0.0 -qdrant-1 | -qdrant-1 | [2025-12-25T16:38:00.816Z INFO storage::content_manager::consensus::persistent] Initializing new raft state at ./storage/raft_state -qdrant-1 | [2025-12-25T16:38:00.861Z INFO qdrant] Distributed mode disabled -qdrant-1 | [2025-12-25T16:38:00.861Z INFO qdrant] Telemetry reporting enabled, id: e6113e43-627c-471d-8374-0f1b61799d76 -qdrant-1 | [2025-12-25T16:38:00.872Z INFO qdrant::tonic] Qdrant gRPC listening on 6334 -qdrant-1 | [2025-12-25T16:38:00.890Z INFO actix_server::builder] Starting 3 workers -qdrant-1 | [2025-12-25T16:38:00.890Z INFO actix_server::server] Actix runtime found; starting in Actix runtime -qdrant-1 | [2025-12-25T16:39:02.504Z INFO actix_server::server] SIGTERM received; starting graceful shutdown -qdrant-1 | [2025-12-25T16:39:02.505Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | [2025-12-25T16:39:02.508Z INFO actix_server::accept] Accept thread stopped -qdrant-1 | [2025-12-25T16:39:02.508Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | [2025-12-25T16:39:02.508Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | _ _ -qdrant-1 | __ _ __| |_ __ __ _ _ __ | |_ -qdrant-1 | / _` |/ _` | '__/ _` | '_ \| __| -qdrant-1 | | (_| | (_| | | | (_| | | | | |_ -qdrant-1 | \__, |\__,_|_| \__,_|_| |_|\__| -qdrant-1 | |_| -qdrant-1 | -qdrant-1 | Access web UI at https://ui.qdrant.tech/?v=v1.0.0 -qdrant-1 | -qdrant-1 | [2025-12-25T16:43:53.592Z INFO storage::content_manager::consensus::persistent] Loading raft state from ./storage/raft_state -qdrant-1 | [2025-12-25T16:43:53.612Z INFO qdrant] Distributed mode disabled -qdrant-1 | [2025-12-25T16:43:53.612Z INFO qdrant] Telemetry reporting enabled, id: 2a83356a-9770-47d3-a0bd-638f75769522 -qdrant-1 | [2025-12-25T16:43:53.615Z INFO qdrant::tonic] Qdrant gRPC listening on 6334 -qdrant-1 | [2025-12-25T16:43:53.616Z INFO actix_server::builder] Starting 3 workers -qdrant-1 | [2025-12-25T16:43:53.617Z INFO actix_server::server] Actix runtime found; starting in Actix runtime -qdrant-1 | [2025-12-25T16:56:42.005Z INFO actix_server::server] SIGTERM received; starting graceful shutdown -qdrant-1 | [2025-12-25T16:56:42.006Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | [2025-12-25T16:56:42.006Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | [2025-12-25T16:56:42.007Z INFO actix_server::worker] Shutting down idle worker -qdrant-1 | [2025-12-25T16:56:42.007Z INFO actix_server::accept] Accept thread stopped -qdrant-1 | _ _ -qdrant-1 | __ _ __| |_ __ __ _ _ __ | |_ -qdrant-1 | / _` |/ _` | '__/ _` | '_ \| __| -qdrant-1 | | (_| | (_| | | | (_| | | | | |_ -qdrant-1 | \__, |\__,_|_| \__,_|_| |_|\__| -qdrant-1 | |_| -qdrant-1 | -qdrant-1 | Access web UI at https://ui.qdrant.tech/?v=v1.0.0 -qdrant-1 | -qdrant-1 | [2025-12-25T16:56:52.790Z INFO storage::content_manager::consensus::persistent] Loading raft state from ./storage/raft_state -qdrant-1 | [2025-12-25T16:56:52.796Z INFO qdrant] Distributed mode disabled -qdrant-1 | [2025-12-25T16:56:52.796Z INFO qdrant] Telemetry reporting enabled, id: f821b8ea-9ee5-497e-a172-dfebf253f7b1 -qdrant-1 | [2025-12-25T16:56:52.797Z INFO qdrant::tonic] Qdrant gRPC listening on 6334 -qdrant-1 | [2025-12-25T16:56:52.798Z INFO actix_server::builder] Starting 3 workers -qdrant-1 | [2025-12-25T16:56:52.798Z INFO actix_server::server] Actix runtime found; starting in Actix runtime -postgres-1 | -postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization -postgres-1 | -postgres-1 | 2025-12-25 16:38:01.071 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit -postgres-1 | 2025-12-25 16:38:01.072 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 -postgres-1 | 2025-12-25 16:38:01.072 UTC [1] LOG: listening on IPv6 address "::", port 5432 -postgres-1 | 2025-12-25 16:38:01.093 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" -postgres-1 | 2025-12-25 16:38:01.126 UTC [32] LOG: database system was shut down at 2025-12-25 14:34:55 UTC -postgres-1 | 2025-12-25 16:38:01.155 UTC [1] LOG: database system is ready to accept connections -postgres-1 | 2025-12-25 16:39:02.495 UTC [1] LOG: received fast shutdown request -postgres-1 | 2025-12-25 16:39:02.505 UTC [1] LOG: aborting any active transactions -postgres-1 | 2025-12-25 16:39:02.521 UTC [1] LOG: background worker "logical replication launcher" (PID 35) exited with exit code 1 -postgres-1 | 2025-12-25 16:39:02.521 UTC [30] LOG: shutting down -postgres-1 | 2025-12-25 16:39:02.533 UTC [30] LOG: checkpoint starting: shutdown immediate -postgres-1 | 2025-12-25 16:39:02.601 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.019 s, sync=0.009 s, total=0.079 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEF980, redo lsn=0/1BEF980 -postgres-1 | 2025-12-25 16:39:02.644 UTC [1] LOG: database system is shut down -postgres-1 | -postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization -postgres-1 | -postgres-1 | 2025-12-25 16:43:53.946 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit -postgres-1 | 2025-12-25 16:43:53.947 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 -postgres-1 | 2025-12-25 16:43:53.947 UTC [1] LOG: listening on IPv6 address "::", port 5432 -postgres-1 | 2025-12-25 16:43:53.965 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" -postgres-1 | 2025-12-25 16:43:53.990 UTC [32] LOG: database system was shut down at 2025-12-25 16:39:02 UTC -postgres-1 | 2025-12-25 16:43:54.013 UTC [1] LOG: database system is ready to accept connections -postgres-1 | 2025-12-25 16:48:54.089 UTC [30] LOG: checkpoint starting: time -postgres-1 | 2025-12-25 16:48:54.175 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.036 s, sync=0.009 s, total=0.088 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFA88, redo lsn=0/1BEFA30 -postgres-1 | 2025-12-25 16:56:42.002 UTC [1] LOG: received fast shutdown request -postgres-1 | 2025-12-25 16:56:42.018 UTC [1] LOG: aborting any active transactions -postgres-1 | 2025-12-25 16:56:42.026 UTC [1] LOG: background worker "logical replication launcher" (PID 35) exited with exit code 1 -postgres-1 | 2025-12-25 16:56:42.030 UTC [30] LOG: shutting down -postgres-1 | 2025-12-25 16:56:42.039 UTC [30] LOG: checkpoint starting: shutdown immediate -postgres-1 | 2025-12-25 16:56:42.086 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 0 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.004 s, sync=0.001 s, total=0.057 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFB38, redo lsn=0/1BEFB38 -postgres-1 | 2025-12-25 16:56:42.131 UTC [1] LOG: database system is shut down -postgres-1 | -postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization -postgres-1 | -postgres-1 | 2025-12-25 16:56:43.530 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit -postgres-1 | 2025-12-25 16:56:43.532 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 -postgres-1 | 2025-12-25 16:56:43.532 UTC [1] LOG: listening on IPv6 address "::", port 5432 -postgres-1 | 2025-12-25 16:56:43.552 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" -postgres-1 | 2025-12-25 16:56:43.585 UTC [32] LOG: database system was shut down at 2025-12-25 16:56:42 UTC -postgres-1 | 2025-12-25 16:56:43.616 UTC [1] LOG: database system is ready to accept connections -postgres-1 | 2025-12-25 17:01:43.645 UTC [30] LOG: checkpoint starting: time -postgres-1 | 2025-12-25 17:01:43.712 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.019 s, sync=0.009 s, total=0.068 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFC40, redo lsn=0/1BEFBE8 diff --git a/.gitignore b/.gitignore index b0ac3ed9..b4d08883 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ +.env +__pycache__/ +*.pyc .aider* +workspaces/ +qdrant_storage/ \ No newline at end of file diff --git a/__pycache__/app.cpython-310.pyc b/__pycache__/app.cpython-310.pyc index e9542507d2bb7f4c93f684c6cbc1cdef91563c75..19b4f21cc689d8baf5ebceced6d14381fefb3b3d 100644 GIT binary patch literal 4667 zcmZu#O>o=B6~-%zdfYgYHClY9y*h2d&#MnUVH8Vr%rn6sXp}NX`Fs6)l{-D+5_#nL(3 zwe?)a&FDJoW>K4Ur;&4Wjl7$OoF#0L5n16pu-qY$a|^!F8y0ynw9Vb3D7Yhjc5T!z zis3Ehj-fr?Z%>G#82Qw2C&j23L%m0giwV?w#iZDSdP?jSQ>gd(d~I6n6Vsm>_nEsN zy#s>EgEzTA>r)G(hXh+T$_M|2vl)wJmN>#wz6u(CnJ0x0g!G!~Ts`ocD#?TX4&eDH^LRX|BfH|jaCp=YGI?Z z2lD<()0fW<@9nRkR5&R9cucP~IMgXrPHcqoR@Cxpe&mi^zIbu&(p+`!%0l(sx#juC z`&X4}&7L@M^7T`dlV@M6oUEKWb9(mV$up-uc7XHTC#{S8a3)i6>uMq23q zanu%`b9kZ>3T3RZ9#>{;Z1XNd&x)B~f^Ts$Ih1HFUL^(kcY;V&!&_xL;bD|mEl;f` z)>;@el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3(w!PNg-|JtH;{5_JSobC4`>n+&XH$xLhkgehcZc?K|x-0K_g!PvA$PJF+m_2B!B z+^Y76Mlao6jnj>M&z4pr-*@CFf^WJ}K={qbVr=sfgx?o>S@bhJr$X_F9P5wA*?5G^ z_jE80Y=q+QbSVB2_4CuzIMvUpZ{cKjwEL?F4->n8MtH~}Jj^J0+*pzmn45k92UN zzd$z8h__I6#|acl1URK2l%>02C*a~&M1GYj%9d4(8X^-pbXgy)e;c$! z7n_N`v)RqB2@#4C@-IZ1QdeItb?1JK{3|MT+Rd=WJzlB>oai10O+R1i7VhtO!KKPC zFQ}|<`Hf9%jF^U?g3OO_Btw4~c?4Pq_#shAOX2GBtn^ zr6jUzR^&sOFd?2HE+f%>?xqGQNs?~YcIims1+|09E!x2k&;xW4J(l48F3v$1?=wVAepGv+J2RG9^8yl1Z6m`b7Tc7DUXu$P++bj@di|r z>Sg3kazq|KsHsen?xm&?Uqn4II3gq^c!JUi7gxutW3w67??nS?;RUXVc~l9zI}qY) zG{_H9!|EWHbZw>TD&0!;o{CE9R$EvXwNdGh9K+P7kV@vz+APZume`n)GEDS!meR-A zjP9`cL;cabRxlj)8bgYSC&u&OoWU9sAuP+zu^9xkEa(o64jm(h-6rrPnbOTiFBt{) zidv_>UY;6cWj0jl2TflNZ0Td1M?I~?N7Va0Rhv{H>S^xmnOjyUgRH1bFj8t0?+_=w zx>O8TwxFy|saYvJ$s>C|3CSwfCRxlKxt!AXNusBE>fL3(jW2bY-n*2}M&!h{X5-$J e-BF!mx~W52kk@}q+tzK%&Z0Qxc$S&-4*Ne)UO|Nb diff --git a/app.py b/app.py index db278c95..eed03f6e 100644 --- a/app.py +++ b/app.py @@ -4,159 +4,204 @@ import re from datetime import datetime import shutil import uuid -import ollama -from qdrant_client import QdrantClient, models +import ollama # Import spostato all'inizio per efficienza +from qdrant_client import QdrantClient +from qdrant_client.http.models import PointStruct -# --- CONFIGURAZIONE --- +# Define user roles mapping USER_ROLES = { 'moglie@esempio.com': 'business', 'ingegnere@esempio.com': 'engineering', 'architetto@esempio.com': 'architecture', 'admin@esempio.com': 'admin' } + +# Define the path for workspaces WORKSPACES_DIR = "./workspaces" -# URL Config -OLLAMA_URL = os.getenv('OLLAMA_API_BASE', 'http://192.168.1.243:11434') -QDRANT_URL = "http://qdrant:6333" # Nome del servizio nel docker-compose - -# Client Globali -aclient = ollama.AsyncClient(host=OLLAMA_URL) # Per la chat (veloce) -# Client sincrono per embedding (più stabile per operazioni batch) -embed_client = ollama.Client(host=OLLAMA_URL) - -# --- FUNZIONI UTILITY --- - def create_workspace(user_role): - path = os.path.join(WORKSPACES_DIR, user_role) - os.makedirs(path, exist_ok=True) + workspace_path = os.path.join(WORKSPACES_DIR, user_role) + if not os.path.exists(workspace_path): + os.makedirs(workspace_path) def save_code_to_file(code, user_role): timestamp = datetime.now().strftime("%Y%m%d%H%M%S") file_name = f"code_{timestamp}.py" file_path = os.path.join(WORKSPACES_DIR, user_role, file_name) - with open(file_path, "w", encoding="utf-8") as file: + + with open(file_path, "w") as file: file.write(code) + return file_path -def get_qdrant_client(): - return QdrantClient(url=QDRANT_URL) +def limit_history(history): + if len(history) > 20: + history = history[-20:] + return history -def ensure_collection(client): +async def connect_to_qdrant(): + client = QdrantClient("http://qdrant:6333") + collection_name = "documents" + try: - client.get_collection("documents") - except: + client.get_collection(collection_name) + except Exception as e: client.create_collection( - collection_name="documents", - vectors_config=models.VectorParams(size=768, distance=models.Distance.COSINE) + collection_name=collection_name, + vectors_config={"size": 768, "distance": "Cosine"} ) + + return client -def get_embeddings(text): - # Taglia il testo se troppo lungo per evitare errori (max safe context) - text = text[:8000] - response = embed_client.embed(model='nomic-embed-text', input=text) - # Gestisce diversi formati di risposta delle versioni Ollama +async def get_embeddings(text): + # --- CORREZIONE CRITICA --- + # Inizializza il client usando l'URL completo (come in message), NON 'host=...' + # Questo evita l'errore "127.0.0.1:porta casuale" + ollama_api_base = os.getenv('OLLAMA_API_BASE', 'http://192.168.1.243:11434') + client = ollama.Client(ollama_api_base) + + # Controllo lunghezza testo + if len(text) > 12000: + text = text[:12000] + + response = client.embed(model='nomic-embed-text', input=text) + + # Gestione compatibilità risposta (embedding vs embeddings) if 'embeddings' in response: return response['embeddings'][0] return response['embedding'] -# --- LOGICA CHAT --- +# Nuova funzione per CERCARE nei documenti (RAG) +async def search_qdrant(query_text, user_role): + """Cerca documenti pertinenti su Qdrant""" + try: + qdrant_client = await connect_to_qdrant() + query_embedding = await get_embeddings(query_text) + + # Cerca i 3 documenti più simili alla domanda + search_result = qdrant_client.search( + collection_name="documents", + query_vector=query_embedding, + limit=3 + ) + + contexts = [] + for hit in search_result: + if 'payload' in hit and 'file_name' in hit['payload']: + contexts.append(f"Documento: {hit['payload']['file_name']}") + + return "\n".join(contexts) + except Exception as e: + print(f"Errore ricerca: {e}") + return "" @cl.on_chat_start async def chat_start(): - user_email = "admin@esempio.com" # In prod, prendilo dagli header/auth + # Set the user's email to a hardcoded value for testing purposes + user_email = "admin@esempio.com" + + # Determine the user's role based on the email user_role = USER_ROLES.get(user_email, 'guest') + # Create workspace directory if it doesn't exist create_workspace(user_role) + # Initialize history in the session cl.user_session.set("history", []) + + # Set the user's role in the session cl.user_session.set("role", user_role) - # Inizializza Qdrant all'avvio - try: - q_client = get_qdrant_client() - ensure_collection(q_client) - status_msg = "✅ System ready. Qdrant connected." - except Exception as e: - status_msg = f"⚠️ System ready, but Qdrant error: {e}" - - await cl.Message(content=f"Welcome {user_role}! {status_msg}").send() + # Send a welcome message based on the user's role + if user_role == 'admin': + await cl.Message(content="Welcome, Admin!").send() + elif user_role == 'engineering': + await cl.Message(content="Welcome, Engineer!").send() + elif user_role == 'business': + await cl.Message(content="Welcome, Business User!").send() + elif user_role == 'architecture': + await cl.Message(content="Welcome, Architect!").send() + else: + await cl.Message(content="Welcome, Guest!").send() @cl.on_message -async def message(message: cl.Message): +async def message(message): + # Retrieve the user's role from the session user_role = cl.user_session.get("role", 'guest') - history = cl.user_session.get("history", []) - # 1. GESTIONE FILE CARICATI (RAG) - if message.elements: - processing_msg = cl.Message(content="⚙️ Elaborazione file in corso...") - await processing_msg.send() - - q_client = get_qdrant_client() - uploaded_files = [] - - for element in message.elements: - # Salva su disco - dest_path = os.path.join(WORKSPACES_DIR, user_role, element.name) - shutil.copyfile(element.path, dest_path) - uploaded_files.append(element.name) - - # Se è testo, indicizza su Qdrant - if element.name.endswith('.txt') or element.name.endswith('.md') or element.name.endswith('.py'): - try: - with open(dest_path, 'r', encoding='utf-8') as f: - content = f.read() - - vector = get_embeddings(content) - - point_id = str(uuid.uuid4()) - q_client.upsert( - collection_name="documents", - points=[models.PointStruct( - id=point_id, - vector=vector, - payload={"filename": element.name, "text": content[:500]} # Salviamo un'anteprima - )] - ) - except Exception as e: - await cl.Message(content=f"❌ Errore indicizzazione {element.name}: {e}").send() - - await processing_msg.remove() - await cl.Message(content=f"📂 File salvati e indicizzati: {', '.join(uploaded_files)}").send() - - # 2. AGGIORNA STORIA E CHAT - history.append({"role": "user", "content": message.content}) + if not user_role: + await cl.Message(content="User role not found").send() + return - msg = cl.Message(content="") - await msg.send() + # Initialize the Ollama client + ollama_api_base = os.getenv('OLLAMA_API_BASE', 'http://192.168.1.243:11434') - full_response = "" - - # Streaming della risposta try: - async for part in await aclient.chat(model='qwen2.5-coder:7b', messages=history, stream=True): - token = part['message']['content'] - full_response += token - await msg.stream_token(token) + client = ollama.Client(ollama_api_base) - await msg.update() + # Retrieve the history from the session and limit it + history = cl.user_session.get("history", []) + history = limit_history(history) - # 3. ESTRAZIONE CODICE (Salvataggio automatico) - code_blocks = re.findall(r"```python(.*?)```", full_response, re.DOTALL) - if code_blocks: - files_generated = [] - for code in code_blocks: - code = code.strip() - if code: - path = save_code_to_file(code, user_role) - files_generated.append(cl.File(name=os.path.basename(path), path=path)) + # --- RAG STEP: Cerca nei documenti prima di chattare --- + context_text = await search_qdrant(message.content, user_role) + + # Se trova documenti, inietta il contesto come "System Message" + if context_text: + system_prompt = f"Contexto dai documenti:\n{context_text}\n\nRispondi usando questo contesto." + history.insert(0, {"role": "system", "content": system_prompt}) + + # Append the new user message to the history + history.append({"role": "user", "content": message.content}) + + # Check for Uploads + if message.elements: + uploaded_files = [] + for element in message.elements: + try: + # Save file to disk + dest_path = os.path.join(WORKSPACES_DIR, user_role, element.name) + with open(element.path, 'rb') as src, open(dest_path, 'wb') as dst: + shutil.copyfileobj(src, dst) + + # Indexing on Qdrant if .txt + if element.name.endswith('.txt'): + with open(dest_path, 'r') as f: + content = f.read() + + embeddings = await get_embeddings(content) + qdrant_client = await connect_to_qdrant() + point_id = uuid.uuid4() + point = PointStruct(id=point_id, vector=embeddings, payload={"file_name": element.name}) + qdrant_client.upsert(collection_name="documents", points=[point]) + + await cl.Message(content=f"Documento '{element.name}' indicizzato.").send() + + uploaded_files.append(element.name) + except Exception as e: + await cl.Message(content=f"Error saving {element.name}: {e}").send() - if files_generated: - await cl.Message(content="💾 Ho estratto il codice per te:", elements=files_generated).send() - - # Aggiorna storia - history.append({"role": "assistant", "content": full_response}) + if uploaded_files: + await cl.Message(content=f"Files saved: {', '.join(uploaded_files)}").send() + + # Call the model + response = client.chat(model='qwen2.5-coder:7b', messages=history) + + # Extract code blocks + code_blocks = re.findall(r"```python(.*?)```", response['message']['content'], re.DOTALL) + + elements = [] + if code_blocks: + for code in code_blocks: + file_path = save_code_to_file(code, user_role) + elements.append(cl.File(name=os.path.basename(file_path), path=file_path)) + + # Append AI response to history + history.append({"role": "assistant", "content": response['message']['content']}) cl.user_session.set("history", history) - + + # Send final message + await cl.Message(content=response['message']['content'], elements=elements).send() + except Exception as e: - await cl.Message(content=f"❌ Errore generazione AI: {e}").send() \ No newline at end of file + await cl.Message(content=f"Error: {e}").send() \ No newline at end of file diff --git a/error.log b/error.log index 334bbef9..5d66a3e8 100644 --- a/error.log +++ b/error.log @@ -1,17 +1,18 @@ -chainlit-app-1 | 2025-12-25 17:32:55 - INFO - chainlit - Your app is available at http://0.0.0.0:8000 -chainlit-app-1 | 2025-12-25 17:36:13 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:36:13 - WARNING - chainlit - Translated markdown file for it-IT not found. Defaulting to chainlit.md. -chainlit-app-1 | 2025-12-25 17:36:13 - INFO - chainlit - Missing custom logo. Falling back to default logo. -chainlit-app-1 | 2025-12-25 17:39:46 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:39:47 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:39:47 - WARNING - chainlit - Translated markdown file for it-IT not found. Defaulting to chainlit.md. -chainlit-app-1 | 2025-12-25 17:39:51 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. -chainlit-app-1 | 2025-12-25 17:39:56 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/chat "HTTP/1.1 200 OK" -qdrant-1 | _ _ +qdrant-1 | _ _ +chainlit-app-1 | 2025-12-25 18:05:12 - INFO - chainlit - Your app is available at http://0.0.0.0:8000 +postgres-1 | +postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization +postgres-1 | +postgres-1 | 2025-12-25 16:38:01.071 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit qdrant-1 | __ _ __| |_ __ __ _ _ __ | |_ qdrant-1 | / _` |/ _` | '__/ _` | '_ \| __| qdrant-1 | | (_| | (_| | | | (_| | | | | |_ qdrant-1 | \__, |\__,_|_| \__,_|_| |_|\__| +postgres-1 | 2025-12-25 16:38:01.072 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 +postgres-1 | 2025-12-25 16:38:01.072 UTC [1] LOG: listening on IPv6 address "::", port 5432 +postgres-1 | 2025-12-25 16:38:01.093 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" +postgres-1 | 2025-12-25 16:38:01.126 UTC [32] LOG: database system was shut down at 2025-12-25 14:34:55 UTC +postgres-1 | 2025-12-25 16:38:01.155 UTC [1] LOG: database system is ready to accept connections qdrant-1 | |_| qdrant-1 | qdrant-1 | Access web UI at https://ui.qdrant.tech/?v=v1.0.0 @@ -31,16 +32,54 @@ qdrant-1 | _ _ qdrant-1 | __ _ __| |_ __ __ _ _ __ | |_ qdrant-1 | / _` |/ _` | '__/ _` | '_ \| __| qdrant-1 | | (_| | (_| | | | (_| | | | | |_ +postgres-1 | 2025-12-25 16:39:02.495 UTC [1] LOG: received fast shutdown request +postgres-1 | 2025-12-25 16:39:02.505 UTC [1] LOG: aborting any active transactions +postgres-1 | 2025-12-25 16:39:02.521 UTC [1] LOG: background worker "logical replication launcher" (PID 35) exited with exit code 1 +postgres-1 | 2025-12-25 16:39:02.521 UTC [30] LOG: shutting down +postgres-1 | 2025-12-25 16:39:02.533 UTC [30] LOG: checkpoint starting: shutdown immediate +chainlit-app-1 | 2025-12-25 18:05:25 - INFO - httpx - HTTP Request: GET http://qdrant:6333 "HTTP/1.1 200 OK" +chainlit-app-1 | /app/app.py:43: UserWarning: Qdrant client version 1.16.2 is incompatible with server version 1.0.0. Major versions should match and minor version difference must not exceed 1. Set check_compatibility=False to skip version check. +chainlit-app-1 | return QdrantClient(url=QDRANT_URL) qdrant-1 | \__, |\__,_|_| \__,_|_| |_|\__| +chainlit-app-1 | 2025-12-25 18:05:25 - INFO - httpx - HTTP Request: GET http://qdrant:6333/collections/documents "HTTP/1.1 404 Not Found" +chainlit-app-1 | 2025-12-25 18:06:08 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. +chainlit-app-1 | 2025-12-25 18:06:10 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. qdrant-1 | |_| qdrant-1 | qdrant-1 | Access web UI at https://ui.qdrant.tech/?v=v1.0.0 qdrant-1 | qdrant-1 | [2025-12-25T16:43:53.592Z INFO storage::content_manager::consensus::persistent] Loading raft state from ./storage/raft_state qdrant-1 | [2025-12-25T16:43:53.612Z INFO qdrant] Distributed mode disabled +postgres-1 | 2025-12-25 16:39:02.601 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.019 s, sync=0.009 s, total=0.079 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEF980, redo lsn=0/1BEF980 +postgres-1 | 2025-12-25 16:39:02.644 UTC [1] LOG: database system is shut down +postgres-1 | +postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization +postgres-1 | +postgres-1 | 2025-12-25 16:43:53.946 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit +postgres-1 | 2025-12-25 16:43:53.947 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 +postgres-1 | 2025-12-25 16:43:53.947 UTC [1] LOG: listening on IPv6 address "::", port 5432 qdrant-1 | [2025-12-25T16:43:53.612Z INFO qdrant] Telemetry reporting enabled, id: 2a83356a-9770-47d3-a0bd-638f75769522 qdrant-1 | [2025-12-25T16:43:53.615Z INFO qdrant::tonic] Qdrant gRPC listening on 6334 qdrant-1 | [2025-12-25T16:43:53.616Z INFO actix_server::builder] Starting 3 workers +postgres-1 | 2025-12-25 16:43:53.965 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" +postgres-1 | 2025-12-25 16:43:53.990 UTC [32] LOG: database system was shut down at 2025-12-25 16:39:02 UTC +postgres-1 | 2025-12-25 16:43:54.013 UTC [1] LOG: database system is ready to accept connections +postgres-1 | 2025-12-25 16:48:54.089 UTC [30] LOG: checkpoint starting: time +postgres-1 | 2025-12-25 16:48:54.175 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.036 s, sync=0.009 s, total=0.088 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFA88, redo lsn=0/1BEFA30 +postgres-1 | 2025-12-25 16:56:42.002 UTC [1] LOG: received fast shutdown request +postgres-1 | 2025-12-25 16:56:42.018 UTC [1] LOG: aborting any active transactions +postgres-1 | 2025-12-25 16:56:42.026 UTC [1] LOG: background worker "logical replication launcher" (PID 35) exited with exit code 1 +postgres-1 | 2025-12-25 16:56:42.030 UTC [30] LOG: shutting down +postgres-1 | 2025-12-25 16:56:42.039 UTC [30] LOG: checkpoint starting: shutdown immediate +postgres-1 | 2025-12-25 16:56:42.086 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 0 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.004 s, sync=0.001 s, total=0.057 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFB38, redo lsn=0/1BEFB38 +postgres-1 | 2025-12-25 16:56:42.131 UTC [1] LOG: database system is shut down +postgres-1 | +postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization +postgres-1 | +chainlit-app-1 | 2025-12-25 18:06:10 - WARNING - chainlit - Translated markdown file for it-IT not found. Defaulting to chainlit.md. +chainlit-app-1 | 2025-12-25 18:06:13 - INFO - chainlit - Missing custom logo. Falling back to default logo. +chainlit-app-1 | 2025-12-25 18:06:21 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. +chainlit-app-1 | 2025-12-25 18:06:21 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. qdrant-1 | [2025-12-25T16:43:53.617Z INFO actix_server::server] Actix runtime found; starting in Actix runtime qdrant-1 | [2025-12-25T16:56:42.005Z INFO actix_server::server] SIGTERM received; starting graceful shutdown qdrant-1 | [2025-12-25T16:56:42.006Z INFO actix_server::worker] Shutting down idle worker @@ -62,43 +101,9 @@ qdrant-1 | [2025-12-25T16:56:52.796Z INFO qdrant] Telemetry reporting en qdrant-1 | [2025-12-25T16:56:52.797Z INFO qdrant::tonic] Qdrant gRPC listening on 6334 qdrant-1 | [2025-12-25T16:56:52.798Z INFO actix_server::builder] Starting 3 workers qdrant-1 | [2025-12-25T16:56:52.798Z INFO actix_server::server] Actix runtime found; starting in Actix runtime -postgres-1 | -postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization -postgres-1 | -postgres-1 | 2025-12-25 16:38:01.071 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit -postgres-1 | 2025-12-25 16:38:01.072 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 -postgres-1 | 2025-12-25 16:38:01.072 UTC [1] LOG: listening on IPv6 address "::", port 5432 -postgres-1 | 2025-12-25 16:38:01.093 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" -postgres-1 | 2025-12-25 16:38:01.126 UTC [32] LOG: database system was shut down at 2025-12-25 14:34:55 UTC -postgres-1 | 2025-12-25 16:38:01.155 UTC [1] LOG: database system is ready to accept connections -postgres-1 | 2025-12-25 16:39:02.495 UTC [1] LOG: received fast shutdown request -postgres-1 | 2025-12-25 16:39:02.505 UTC [1] LOG: aborting any active transactions -postgres-1 | 2025-12-25 16:39:02.521 UTC [1] LOG: background worker "logical replication launcher" (PID 35) exited with exit code 1 -postgres-1 | 2025-12-25 16:39:02.521 UTC [30] LOG: shutting down -postgres-1 | 2025-12-25 16:39:02.533 UTC [30] LOG: checkpoint starting: shutdown immediate -postgres-1 | 2025-12-25 16:39:02.601 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.019 s, sync=0.009 s, total=0.079 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEF980, redo lsn=0/1BEF980 -postgres-1 | 2025-12-25 16:39:02.644 UTC [1] LOG: database system is shut down -postgres-1 | -postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization -postgres-1 | -postgres-1 | 2025-12-25 16:43:53.946 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit -postgres-1 | 2025-12-25 16:43:53.947 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 -postgres-1 | 2025-12-25 16:43:53.947 UTC [1] LOG: listening on IPv6 address "::", port 5432 -postgres-1 | 2025-12-25 16:43:53.965 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" -postgres-1 | 2025-12-25 16:43:53.990 UTC [32] LOG: database system was shut down at 2025-12-25 16:39:02 UTC -postgres-1 | 2025-12-25 16:43:54.013 UTC [1] LOG: database system is ready to accept connections -postgres-1 | 2025-12-25 16:48:54.089 UTC [30] LOG: checkpoint starting: time -postgres-1 | 2025-12-25 16:48:54.175 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.036 s, sync=0.009 s, total=0.088 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFA88, redo lsn=0/1BEFA30 -postgres-1 | 2025-12-25 16:56:42.002 UTC [1] LOG: received fast shutdown request -postgres-1 | 2025-12-25 16:56:42.018 UTC [1] LOG: aborting any active transactions -postgres-1 | 2025-12-25 16:56:42.026 UTC [1] LOG: background worker "logical replication launcher" (PID 35) exited with exit code 1 -postgres-1 | 2025-12-25 16:56:42.030 UTC [30] LOG: shutting down -postgres-1 | 2025-12-25 16:56:42.039 UTC [30] LOG: checkpoint starting: shutdown immediate -postgres-1 | 2025-12-25 16:56:42.086 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 0 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.004 s, sync=0.001 s, total=0.057 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFB38, redo lsn=0/1BEFB38 -postgres-1 | 2025-12-25 16:56:42.131 UTC [1] LOG: database system is shut down -postgres-1 | -postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization -postgres-1 | +qdrant-1 | [2025-12-25T18:05:25.183Z INFO actix_web::middleware::logger] 172.18.0.4 "GET /collections/documents HTTP/1.1" 404 110 "-" "python-client/1.16.2 python/3.10.19" 0.007704 +qdrant-1 | [2025-12-25T18:05:30.499Z INFO actix_web::middleware::logger] 172.18.0.4 "PUT /collections/documents HTTP/1.1" 200 71 "-" "python-client/1.16.2 python/3.10.19" 5.311157 +qdrant-1 | [2025-12-25T18:06:22.662Z INFO actix_web::middleware::logger] 172.18.0.4 "GET /collections/documents HTTP/1.1" 200 413 "-" "python-client/1.16.2 python/3.10.19" 0.005606 postgres-1 | 2025-12-25 16:56:43.530 UTC [1] LOG: starting PostgreSQL 18.1 (Debian 18.1-1.pgdg13+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit postgres-1 | 2025-12-25 16:56:43.532 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgres-1 | 2025-12-25 16:56:43.532 UTC [1] LOG: listening on IPv6 address "::", port 5432 @@ -107,3 +112,22 @@ postgres-1 | 2025-12-25 16:56:43.585 UTC [32] LOG: database system was shu postgres-1 | 2025-12-25 16:56:43.616 UTC [1] LOG: database system is ready to accept connections postgres-1 | 2025-12-25 17:01:43.645 UTC [30] LOG: checkpoint starting: time postgres-1 | 2025-12-25 17:01:43.712 UTC [30] LOG: checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.019 s, sync=0.009 s, total=0.068 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEFC40, redo lsn=0/1BEFBE8 +chainlit-app-1 | 2025-12-25 18:06:21 - WARNING - chainlit - Translated markdown file for it-IT not found. Defaulting to chainlit.md. +chainlit-app-1 | 2025-12-25 18:06:22 - INFO - httpx - HTTP Request: GET http://qdrant:6333 "HTTP/1.1 200 OK" +chainlit-app-1 | 2025-12-25 18:06:22 - INFO - httpx - HTTP Request: GET http://qdrant:6333/collections/documents "HTTP/1.1 200 OK" +chainlit-app-1 | 2025-12-25 18:06:28 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. +chainlit-app-1 | 2025-12-25 18:06:36 - INFO - httpx - HTTP Request: GET http://qdrant:6333 "HTTP/1.1 200 OK" +chainlit-app-1 | 2025-12-25 18:06:37 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/embed "HTTP/1.1 500 Internal Server Error" +chainlit-app-1 | 2025-12-25 18:06:39 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/chat "HTTP/1.1 200 OK" +chainlit-app-1 | 2025-12-25 18:06:48 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. +chainlit-app-1 | 2025-12-25 18:07:02 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. +chainlit-app-1 | 2025-12-25 18:07:16 - INFO - httpx - HTTP Request: GET http://qdrant:6333 "HTTP/1.1 200 OK" +chainlit-app-1 | 2025-12-25 18:07:22 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/embed "HTTP/1.1 500 Internal Server Error" +chainlit-app-1 | 2025-12-25 18:07:22 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/chat "HTTP/1.1 200 OK" +chainlit-app-1 | 2025-12-25 18:07:49 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. +chainlit-app-1 | 2025-12-25 18:07:54 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. +chainlit-app-1 | 2025-12-25 18:08:15 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/chat "HTTP/1.1 200 OK" +chainlit-app-1 | 2025-12-25 18:08:30 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it. +chainlit-app-1 | 2025-12-25 18:08:57 - INFO - httpx - HTTP Request: GET http://qdrant:6333 "HTTP/1.1 200 OK" +chainlit-app-1 | 2025-12-25 18:09:03 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/embed "HTTP/1.1 500 Internal Server Error" +chainlit-app-1 | 2025-12-25 18:09:03 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/chat "HTTP/1.1 200 OK"