Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b206b07
Add AWS Lambda RIE setup in Dockerfile and update README
amanfrinati Oct 6, 2025
5023a35
Refactor and extend Docker Compose for chatbot services
amanfrinati Oct 6, 2025
9e4f937
Fix typo in README: correct "Copile" to "Compile"
amanfrinati Oct 6, 2025
a20f081
Update environment configuration and Docker compose settings
amanfrinati Oct 7, 2025
1da4745
Refactor env vars structure for consistency and maintainability
amanfrinati Oct 7, 2025
57f3a72
Merge branch 'refs/heads/main' into CAI-302-upgrade-local-langfuse-to-v3
amanfrinati Oct 27, 2025
4d8fff8
Merge branch 'refs/heads/main' into CAI-302-upgrade-local-langfuse-to-v3
amanfrinati Oct 28, 2025
d7b7591
merge main and try to fix redis persistence
batdevis Oct 28, 2025
f8d2da5
Remove redundant Terraform backend initialization logs
amanfrinati Oct 28, 2025
80cf1f5
Merge remote-tracking branch 'origin/CAI-302-upgrade-local-langfuse-t…
amanfrinati Oct 28, 2025
f558e57
fix redis persistence
batdevis Oct 28, 2025
5915612
Merge branch 'CAI-302-upgrade-local-langfuse-to-v3' of github.com:pag…
batdevis Oct 28, 2025
560b2d7
Remove redundant Terraform backend initialization logs
amanfrinati Oct 28, 2025
acfa364
docker compose name
batdevis Oct 28, 2025
8fbfe99
langfuse host
batdevis Oct 28, 2025
0dc768c
Simplify Docker Compose commands by removing redundant flags
amanfrinati Oct 28, 2025
f9bf2ec
Merge branch 'main' into CAI-302-upgrade-local-langfuse-to-v3
amanfrinati Oct 28, 2025
71da56b
Refactor: Consolidate Langfuse environment variables in .env.langfuse
amanfrinati Oct 28, 2025
e4a1e6a
remove comments
batdevis Oct 28, 2025
69a35e9
Merge branch 'main' into CAI-302-upgrade-local-langfuse-to-v3
amanfrinati Oct 29, 2025
76a0bd9
Merge branch 'main' into CAI-302-upgrade-local-langfuse-to-v3
marcobottaro Oct 29, 2025
f63e3ab
Update apps/chatbot/src/modules/chatbot.py
amanfrinati Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/solid-groups-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chatbot": minor
---

Replace Langfuse v2 with Langufuse v3.112.0 in the local environment
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ apps/chatbot/test.py
!apps/chatbot/docker/files
apps/chatbot/docker/volume
apps/chatbot/.env
!apps/chatbot/.env.langfuse
apps/chatbot/empty_htmls.json
apps/chatbot/.google_service_account.json

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In order to get the Strapi API token needed in the .env.local:

See the repository <https://github.com/pagopa/developer-portal-cms/>

### Copile the applications and the packages in the monorepo
### Compile the applications and the packages in the monorepo

Run the following command from the root folder.

Expand Down
25 changes: 1 addition & 24 deletions apps/chatbot/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CHB_EMBED_MODEL_ID=amazon.titan-embed-text-v2:0
CHB_ENGINE_SIMILARITY_TOPK=5
CHB_ENGINE_USE_ASYNC=False
CHB_ENGINE_USE_STREAMING=False
CHB_LANGFUSE_HOST=http://langfuse:3000
CHB_LANGFUSE_HOST=http://langfuse-web:3000
CHB_MAX_DAILY_EVALUATIONS=200
CHB_MODEL_ID=gemini-2.0-flash
CHB_MODEL_MAXTOKENS=768
Expand All @@ -34,30 +34,7 @@ CHB_SESSION_MAX_DURATION_DAYS=1
CHB_USE_PRESIDIO=True
CHB_WEBSITE_URL=https://dev.developer.pagopa.it
CORS_DOMAINS=["*"]
#openssl rand -hex 32
ENCRYPTION_KEY=2abaf4fa2ed4e3326639fce670f8fa0e26f6d2b6bd89c6d2d2487942c64011e8
environment=local
LAMBDA_TASK_ROOT=/app
LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES=false
LANGFUSE_INIT_ORG_ID=devportal
LANGFUSE_INIT_ORG_NAME=devportal
LANGFUSE_INIT_PROJECT_ID=monitor-123
LANGFUSE_INIT_PROJECT_NAME=Monitor
LANGFUSE_INIT_PROJECT_PUBLIC_KEY=pk-xxx
LANGFUSE_INIT_PROJECT_SECRET_KEY=sk-xxx
LANGFUSE_INIT_USER_EMAIL=devportal@localhost.io
LANGFUSE_INIT_USER_NAME=devportal
LANGFUSE_INIT_USER_PASSWORD=abcd1234
LOG_LEVEL=DEBUG
NEXTAUTH_SECRET=mysecret
NEXTAUTH_URL=http://localhost:4001
POSTGRES_DB=postgres
POSTGRES_HOST=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_PORT=5432
POSTGRES_USER=postgres
# do not move `DATABASE_URL` before `POSTGRES_*` variables
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
PYTHONPATH=/app
SALT=mysalt
TELEMETRY_ENABLED=true
54 changes: 54 additions & 0 deletions apps/chatbot/.env.langfuse
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
NEXTAUTH_URL=http://localhost:4001
NEXTAUTH_SECRET=mysecret
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/postgres
SALT=mysalt
TELEMETRY_ENABLED=true

LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES=false
LANGFUSE_INIT_ORG_ID=pagopa-123
LANGFUSE_INIT_ORG_NAME=PagoPA
LANGFUSE_INIT_PROJECT_ID=monitor-123
LANGFUSE_INIT_PROJECT_NAME=Monitor
LANGFUSE_INIT_PROJECT_PUBLIC_KEY=pk-lf-1a5df1e2-770f-4391-9a7a-4aa5f6b4a72b
LANGFUSE_INIT_PROJECT_SECRET_KEY=sk-lf-f144905b-b3d9-4a67-bd6d-a638cddd5774
LANGFUSE_INIT_USER_EMAIL=user@example.com
LANGFUSE_INIT_USER_NAME=user
LANGFUSE_INIT_USER_PASSWORD=abcd1234

# Generate with openssl rand -hex 32
ENCRYPTION_KEY=2abaf4fa2ed4e3326639fce670f8fa0e26f6d2b6bd89c6d2d2487942c64011e8

CLICKHOUSE_MIGRATION_URL=clickhouse://clickhouse:9000
CLICKHOUSE_URL=http://clickhouse:8123
CLICKHOUSE_USER=clickhouse
CLICKHOUSE_PASSWORD=clickhouse
CLICKHOUSE_CLUSTER_ENABLED=false
LANGFUSE_USE_AZURE_BLOB=false
LANGFUSE_S3_EVENT_UPLOAD_BUCKET=langfuse
LANGFUSE_S3_EVENT_UPLOAD_REGION=auto
LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID=minio
LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY=miniosecret
LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT=http://minio:9000
LANGFUSE_S3_EVENT_UPLOAD_FORCE_PATH_STYLE=true
LANGFUSE_S3_EVENT_UPLOAD_PREFIX=events/
LANGFUSE_S3_MEDIA_UPLOAD_BUCKET=langfuse
LANGFUSE_S3_MEDIA_UPLOAD_REGION=auto
LANGFUSE_S3_MEDIA_UPLOAD_ACCESS_KEY_ID=minio
LANGFUSE_S3_MEDIA_UPLOAD_SECRET_ACCESS_KEY=miniosecret
LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT=http://localhost:9090
LANGFUSE_S3_MEDIA_UPLOAD_FORCE_PATH_STYLE=true
LANGFUSE_S3_MEDIA_UPLOAD_PREFIX=media/
LANGFUSE_S3_BATCH_EXPORT_ENABLED=false
LANGFUSE_S3_BATCH_EXPORT_BUCKET=langfuse
LANGFUSE_S3_BATCH_EXPORT_PREFIX=exports/
LANGFUSE_S3_BATCH_EXPORT_REGION=auto
LANGFUSE_S3_BATCH_EXPORT_ENDPOINT=http://minio:9000
LANGFUSE_S3_BATCH_EXPORT_EXTERNAL_ENDPOINT=http://localhost:9090
LANGFUSE_S3_BATCH_EXPORT_ACCESS_KEY_ID=minio
LANGFUSE_S3_BATCH_EXPORT_SECRET_ACCESS_KEY=miniosecret
LANGFUSE_S3_BATCH_EXPORT_FORCE_PATH_STYLE=true
LANGFUSE_INGESTION_QUEUE_DELAY_MS=
LANGFUSE_INGESTION_CLICKHOUSE_WRITE_INTERVAL_MS=
EMAIL_FROM_ADDRESS=
SMTP_CONNECTION_URL=
REDIS_CONNECTION_STRING=redis://valkey:6379
9 changes: 6 additions & 3 deletions apps/chatbot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ When you're done, shut down all the containers with
In order to run the chatbot locally for the first time, you need to:

- install [Docker Compose](https://docs.docker.com/compose/install/),
- create `.env.local` file running:
- create local files running:

cp .env.example .env.local
```
cp .env.example .env.local
cp .google_service_account.json.example .google_service_account.json
```

and fill it in,
and fill it in with your environment variables

- run the following bash scripts:

Expand Down
13 changes: 6 additions & 7 deletions apps/chatbot/docker/app.local.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ RUN apt-get update && \
zip \
less

RUN curl -Lo /usr/local/bin/aws-lambda-rie \
https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && \
chmod +x /usr/local/bin/aws-lambda-rie && \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install

ENV PYTHONPATH=/app
ENV PIP_ROOT_USER_ACTION=ignore

Expand All @@ -27,6 +20,12 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2
unzip awscliv2.zip && \
./aws/install

RUN mkdir -p /tmp/.aws-lambda-rie \
&& curl -Lo /tmp/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie \
&& chmod +x /tmp/.aws-lambda-rie/aws-lambda-rie \
&& cp /tmp/.aws-lambda-rie/aws-lambda-rie /usr/local/bin/aws-lambda-rie \
&& rm -rf /tmp/.aws-lambda-rie

WORKDIR /app
COPY ./pyproject.toml .
COPY ./poetry.lock .
Expand Down
2 changes: 2 additions & 0 deletions apps/chatbot/docker/compose.test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
name: chatbot-test

services:
api-test:
build:
Expand Down
Loading
Loading