From 53351fde28eaa1874a2a21da633473c0b873a7c3 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 10 Oct 2026 11:12:25 -0700 Subject: [PATCH] llm, add a finish for open-webui, fix config.yaml for Continue, possibly fix pull-models causing terminals to close when cancelled. --- tasks/workstation/linux/software/llm.yml | 48 +++++++++++++++++------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/tasks/workstation/linux/software/llm.yml b/tasks/workstation/linux/software/llm.yml index 7ec6815..a52d28e 100644 --- a/tasks/workstation/linux/software/llm.yml +++ b/tasks/workstation/linux/software/llm.yml @@ -325,7 +325,7 @@ owner: "{{ user }}" mode: "0755" - - name: Workstation | Linux | Software | LLMs | runit | open-webui | Script | File + - name: Workstation | Linux | Software | LLMs | runit | open-webui | Script | Run ansible.builtin.copy: dest: /etc/sv/open-webui/run content: | @@ -358,6 +358,25 @@ ghcr.io/open-webui/open-webui:main mode: "0755" + - name: Workstation | Linux | Software | LLMs | runit | open-webui | Script | Finish + ansible.builtin.copy: + dest: /etc/sv/open-webui/finish + content: | + #!/bin/sh + exec 2>&1 + # $1 is the exit code, $2 is the exit status byte (signal number if killed) + echo "Service finished with exit code: $1 and status: $2" + + echo "Stopping..." + docker stop open-webui && + echo "Container stopped" || + echo "Container already stopped." + echo "Deleting..." + docker rm -f open-webui && + echo "Container deleted" || + echo "Container already deleted." + mode: "0755" + - name: Workstation | Linux | Software | LLMs | runit | open-webui | Script | Log ansible.builtin.copy: dest: /etc/sv/open-webui/log/run @@ -459,11 +478,11 @@ {% for llm in llm_installs %} echo -e "\n\n Starting {{ llm.model }} \n\n" - ollama pull {{ llm.model }} || { - status=$? - echo "ERROR: Pull failed with status $status, exiting." + ollama pull {{ llm.model }} || + status=$? && + echo "ERROR: Pull failed with status $status, exiting." && return $status - } + {% endfor %} echo "Done!!" } @@ -574,20 +593,21 @@ models: {% for llm in llm_installs %} {% if llm.model in llm_models.stdout %} + - name: {{ llm.provider }} provider: ollama model: {{ llm.model }} defaultCompletionOptions: contextLength: {{ llm_context }} - maxTokens: {{ llm_context }} - - name: {{ llm.provider }}-auto - provider: ollama - model: {{ llm.model }} - defaultCompletionOptions: - contextLength: {{ llm_context }} - maxTokens: {{ llm_context }} - roles: - - autocomplete + maxTokens: {{ llm_context / 4 }} + #- name: {{ llm.provider }}_autocomplete + # provider: ollama + # model: {{ llm.model }} + # defaultCompletionOptions: + # contextLength: {{ llm_context }} + # maxTokens: {{ llm_context }} + # roles: + # - autocomplete {% endif %} {% endfor %} mode: "0644"