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() { function ask() {
curl http://localhost:11434/api/generate -d "{ curl http://localhost:11434/api/generate -d "{
\"model\":\"''${OLLAMA_MODEL}\", \"model\":\"''${OLLAMA_MODEL}\",
\"raw\":true,
\"prompt\":\"''${*}\" \"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 echo
} }

View file

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