Add Ollama translation model command
This commit is contained in:
parent
d4c823b3a2
commit
2b636b97e2
|
|
@ -657,6 +657,13 @@ 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.
|
||||
|
||||
Create or refresh the Ollama model on the Debian server before deploying a
|
||||
website image that points at it:
|
||||
|
||||
```bash
|
||||
./lab.sh website-translation-model
|
||||
```
|
||||
|
||||
The CV page has two client-side presentation modes:
|
||||
|
||||
- `Elegant`: dark, minimal, terminal-inspired styling with a square profile
|
||||
|
|
|
|||
32
lab.sh
32
lab.sh
|
|
@ -2893,6 +2893,33 @@ refresh_argocd_application() {
|
|||
kubectl --kubeconfig "${KUBECONFIG}" patch application "${app}" -n argocd --type merge -p '{"metadata":{"annotations":{"argocd.argoproj.io/refresh":"hard"}}}' >/dev/null
|
||||
}
|
||||
|
||||
website_translation_model() {
|
||||
local model_name="${WEBSITE_TRANSLATION_MODEL:-website-translator}"
|
||||
local modelfile="${WEBSITE_TRANSLATION_MODELFILE:-${REPO_ROOT}/apps/website/ollama/Modelfile}"
|
||||
|
||||
require_debian_server "website-translation-model"
|
||||
|
||||
if ! command -v ollama >/dev/null 2>&1; then
|
||||
echo "ollama is not installed or not in PATH on this Debian server." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -r "${modelfile}" ]]; then
|
||||
echo "Ollama Modelfile is not readable: ${modelfile}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Creating or updating Ollama model ${model_name} from ${modelfile}..."
|
||||
ollama create "${model_name}" -f "${modelfile}"
|
||||
|
||||
if ! ollama list | awk -v model="${model_name}" 'NR > 1 && ($1 == model || $1 == model ":latest") { found = 1 } END { exit found ? 0 : 1 }'; then
|
||||
echo "Ollama model ${model_name} was not found after creation." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Ollama model ${model_name} is ready."
|
||||
}
|
||||
|
||||
apps() {
|
||||
local buildx_builder_ready=false
|
||||
local demos_image_built=false
|
||||
|
|
@ -3244,6 +3271,9 @@ case "${1:-}" in
|
|||
apps)
|
||||
apps
|
||||
;;
|
||||
website-translation-model)
|
||||
website_translation_model
|
||||
;;
|
||||
deploy-gitea)
|
||||
deploy_gitea
|
||||
;;
|
||||
|
|
@ -3272,7 +3302,7 @@ case "${1:-}" in
|
|||
nuke
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {up|rebuild-cluster|apps|deploy-gitea|bootstrap-gitea-repo|backup-gitea|drill-gitea-restore|install-gitea-runner|move-prometheus-stack-workers|doctor-versions|openwrt|nuke}"
|
||||
echo "Usage: $0 {up|rebuild-cluster|apps|website-translation-model|deploy-gitea|bootstrap-gitea-repo|backup-gitea|drill-gitea-restore|install-gitea-runner|move-prometheus-stack-workers|doctor-versions|openwrt|nuke}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Reference in New Issue