Add dedicated website translation model

This commit is contained in:
juvdiaz 2026-06-10 10:34:00 -06:00
parent c0b3eeef83
commit d4c823b3a2
5 changed files with 34 additions and 4 deletions

View File

@ -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. many Nahuatl words as possible while keeping technical terms understandable.
Unsupported browser languages use the same-origin `/translate.php` endpoint, Unsupported browser languages use the same-origin `/translate.php` endpoint,
which calls Ollama server-side through `OLLAMA_HOST` and `OLLAMA_MODEL`; the which calls Ollama server-side through `OLLAMA_HOST` and `OLLAMA_MODEL`; the
browser never calls the private Ollama IP directly. Generated runtime language browser never calls the private Ollama IP directly. The default model is the
JSON is saved through `save_lang.php` on the website PVC. 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: The CV page has two client-side presentation modes:

View File

@ -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 WEBSITE_LANG_WRITE_DIR=/var/www/localhost/htdocs/db/lang
ENV OLLAMA_HOST=http://192.168.100.68:11434 ENV OLLAMA_HOST=http://192.168.100.68:11434
ENV OLLAMA_MODEL=llama3.2:3b ENV OLLAMA_MODEL=website-translator
USER apache USER apache

View File

@ -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.
"""

View File

@ -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.

View File

@ -71,7 +71,7 @@ spec:
- name: OLLAMA_HOST - name: OLLAMA_HOST
value: http://192.168.100.68:11434 value: http://192.168.100.68:11434
- name: OLLAMA_MODEL - name: OLLAMA_MODEL
value: llama3.2:3b value: website-translator
- name: TRANSLATION_REDIS_HOST - name: TRANSLATION_REDIS_HOST
value: website-redis value: website-redis
- name: TRANSLATION_REDIS_PORT - name: TRANSLATION_REDIS_PORT