Ask: Better printing.

This commit is contained in:
Dmitry Voronin 2024-10-23 20:29:27 +03:00
parent 93c1ae56d8
commit 0781453676
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 5 additions and 6 deletions

View file

@ -6,8 +6,9 @@
function ask() {
curl http://localhost:11434/api/generate -d "{
\"model\":\"''${OLLAMA_MODEL}\",
\"raw\":true,
\"prompt\":\"''${*}\"
}" 2> /dev/null | parallel -j1 -- "echo {} | jq -r .response | tr -d '\n'"
}" 2> /dev/null | parallel -j1 -- "printf '%s\n' {} | jq -r .response | sed -e 's/^$/\+\+\+/' | tr -d '\n' | sed -e 's/\+\+\+/\n/'"
echo
}

View file

@ -24,10 +24,8 @@ in
};
config = lib.mkIf cfg.enable {
environment = {
# Specify default model.
variables.OLLAMA_MODEL = cfg.primaryModel;
};
environment.variables.OLLAMA_MODEL = cfg.primaryModel;
systemd.services = {
# Enable Ollama server.