moficica app.py

This commit is contained in:
DFFM-maker 2025-12-25 18:47:42 +01:00
parent c48c0330a0
commit 4e1640ae49
4 changed files with 117 additions and 29 deletions

Binary file not shown.

19
app.py
View File

@ -54,10 +54,23 @@ async def connect_to_qdrant():
async def get_embeddings(text):
import ollama
client = ollama.Client(host=os.getenv('OLLAMA_HOST', '192.168.1.243'), port=int(os.getenv('OLLAMA_PORT', 11434)))
response = client.embed(model='nomic-embed-text', input=text)
return response['embedding']
# Costruisci l'URL completo: http://IP:PORT
# È meglio usare la stessa logica usata nella funzione message (OLLAMA_API_BASE)
host_url = os.getenv('OLLAMA_API_BASE', 'http://192.168.1.243:11434')
# Inizializza il client passando SOLO l'host completo
client = ollama.Client(host=host_url)
# Aggiungi il controllo lunghezza per evitare crash su testi lunghi
if len(text) > 12000:
text = text[:12000]
response = client.embed(model='nomic-embed-text', input=text)
# Gestione compatibilità versioni
if 'embeddings' in response:
return response['embeddings'][0]
return response['embedding']
@cl.on_chat_start
async def chat_start():
# Set the user's email to a hardcoded value for testing purposes

125
error.log
View File

@ -1,34 +1,109 @@
postgres-1 |
postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres-1 |
postgres-1 | 2025-12-25 00:01:23.681 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 00:01:23.682 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgres-1 | 2025-12-25 00:01:23.683 UTC [1] LOG: listening on IPv6 address "::", port 5432
postgres-1 | 2025-12-25 00:01:23.701 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres-1 | 2025-12-25 00:01:23.733 UTC [32] LOG: database system was shut down at 2025-12-25 00:01:07 UTC
postgres-1 | 2025-12-25 00:01:23.760 UTC [1] LOG: database system is ready to accept connections
postgres-1 | 2025-12-25 00:06:23.753 UTC [30] LOG: checkpoint starting: time
chainlit-app-1 | 2025-12-25 13:40:39 - INFO - chainlit - Your app is available at http://0.0.0.0:8000
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 | \__, |\__,_|_| \__,_|_| |_|\__|
postgres-1 | 2025-12-25 00:06:23.823 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.020 s, sync=0.010 s, total=0.071 s; sync files=2, longest=0.005 s, average=0.005 s; distance=0 kB, estimate=0 kB; lsn=0/1BEF820, redo lsn=0/1BEF7C8
qdrant-1 | |_|
qdrant-1 |
qdrant-1 | Access web UI at https://ui.qdrant.tech/?v=v1.0.0
qdrant-1 |
qdrant-1 | [2025-12-25T00:01:23.464Z INFO storage::content_manager::consensus::persistent] Initializing new raft state at ./storage/raft_state
qdrant-1 | [2025-12-25T00:01:23.498Z INFO qdrant] Distributed mode disabled
qdrant-1 | [2025-12-25T00:01:23.498Z INFO qdrant] Telemetry reporting enabled, id: 232f5d55-4dfb-454c-86ec-cff97638ebc1
qdrant-1 | [2025-12-25T00:01:23.499Z INFO qdrant::tonic] Qdrant gRPC listening on 6334
qdrant-1 | [2025-12-25T00:01:23.503Z INFO actix_server::builder] Starting 3 workers
qdrant-1 | [2025-12-25T00:01:23.504Z INFO actix_server::server] Actix runtime found; starting in Actix runtime
chainlit-app-1 | 2025-12-25 13:48:37 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it.
chainlit-app-1 | 2025-12-25 13:48:44 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it.
chainlit-app-1 | 2025-12-25 13:48:45 - WARNING - chainlit - Translated markdown file for it-IT not found. Defaulting to chainlit.md.
chainlit-app-1 | 2025-12-25 13:49:27 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it.
chainlit-app-1 | 2025-12-25 13:49:36 - INFO - httpx - HTTP Request: POST http://192.168.1.243:11434/api/chat "HTTP/1.1 200 OK"
chainlit-app-1 | 2025-12-25 13:50:01 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it.
chainlit-app-1 | 2025-12-25 13:50:54 - WARNING - chainlit - Translation file for it-IT not found. Using parent translation it.
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