From d4c823b3a2965ce733b50c4a7edb1ff32dadf30a Mon Sep 17 00:00:00 2001 From: juvdiaz Date: Wed, 10 Jun 2026 10:34:00 -0600 Subject: [PATCH] Add dedicated website translation model --- README.md | 6 ++++-- apps/website/Dockerfile | 2 +- apps/website/ollama/Modelfile | 15 +++++++++++++++ apps/website/ollama/README.md | 13 +++++++++++++ apps/website/web-app.yaml | 2 +- 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 apps/website/ollama/Modelfile create mode 100644 apps/website/ollama/README.md diff --git a/README.md b/README.md index 622963d..01d995f 100644 --- a/README.md +++ b/README.md @@ -652,8 +652,10 @@ curated source files, with the Nahuatl home page intentionally biased toward as many Nahuatl words as possible while keeping technical terms understandable. Unsupported browser languages use the same-origin `/translate.php` endpoint, which calls Ollama server-side through `OLLAMA_HOST` and `OLLAMA_MODEL`; the -browser never calls the private Ollama IP directly. Generated runtime language -JSON is saved through `save_lang.php` on the website PVC. +browser never calls the private Ollama IP directly. The default model is the +custom `website-translator` Ollama model defined in +`apps/website/ollama/Modelfile`. Generated runtime language JSON is saved +through `save_lang.php` on the website PVC. The CV page has two client-side presentation modes: diff --git a/apps/website/Dockerfile b/apps/website/Dockerfile index b472592..59513d0 100644 --- a/apps/website/Dockerfile +++ b/apps/website/Dockerfile @@ -87,7 +87,7 @@ RUN rm -f /var/www/localhost/htdocs/index.html && \ ENV WEBSITE_LANG_WRITE_DIR=/var/www/localhost/htdocs/db/lang ENV OLLAMA_HOST=http://192.168.100.68:11434 -ENV OLLAMA_MODEL=llama3.2:3b +ENV OLLAMA_MODEL=website-translator USER apache diff --git a/apps/website/ollama/Modelfile b/apps/website/ollama/Modelfile new file mode 100644 index 0000000..d749bfe --- /dev/null +++ b/apps/website/ollama/Modelfile @@ -0,0 +1,15 @@ +FROM llama3.2:3b + +PARAMETER temperature 0 +PARAMETER top_p 0.2 +PARAMETER num_ctx 8192 + +SYSTEM """ +You are a translation engine only. + +Translate every input string into the requested target language. +Preserve the input order exactly. +Preserve URLs, email addresses, product names, code identifiers, version numbers, and HTML entities. +Return only a valid JSON array of translated strings. +Do not return markdown, comments, explanations, or surrounding text. +""" diff --git a/apps/website/ollama/README.md b/apps/website/ollama/README.md new file mode 100644 index 0000000..aaacb7a --- /dev/null +++ b/apps/website/ollama/README.md @@ -0,0 +1,13 @@ +# Website Translation Model + +This directory defines the Ollama model used by the website translation endpoint. + +Create or update the model on the Ollama host: + +```sh +ollama create website-translator -f apps/website/ollama/Modelfile +``` + +The website uses `OLLAMA_MODEL=website-translator`. Recreate the model after +changing the `Modelfile`, then restart the website pods so the cache key includes +the active model name. diff --git a/apps/website/web-app.yaml b/apps/website/web-app.yaml index 15ce711..c6f14b4 100644 --- a/apps/website/web-app.yaml +++ b/apps/website/web-app.yaml @@ -71,7 +71,7 @@ spec: - name: OLLAMA_HOST value: http://192.168.100.68:11434 - name: OLLAMA_MODEL - value: llama3.2:3b + value: website-translator - name: TRANSLATION_REDIS_HOST value: website-redis - name: TRANSLATION_REDIS_PORT