From e628816ea8e5bea0f584c8b68046f30d528c8e25 Mon Sep 17 00:00:00 2001 From: "Max P." Date: Sun, 5 Oct 2025 20:13:42 +0200 Subject: [PATCH] feat(config): enhance Ollama configuration with dynamic path support --- pyvtt.settings.sample.json | 13 ++++++++----- src/pyvtt/libs/ollama.py | 3 ++- src/pyvtt/models/config.py | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pyvtt.settings.sample.json b/pyvtt.settings.sample.json index 0b10fa2..a21e8ef 100644 --- a/pyvtt.settings.sample.json +++ b/pyvtt.settings.sample.json @@ -2,23 +2,26 @@ "audio_file": "/tmp/pyvtt_recording.wav", "output_file": "/tmp/pyvtt_transcript.txt", "whisper_path": "/path/to/whisper-cli", - "language": "en", "socket_path": "/tmp/pyvtt.sock", "ollama_url": "http://localhost", + "ollama_path": "/api/chat", "ollama_port": 12345, "presets": [ { "name": "Default", "language": "en", "whisper_model": "/path/to/default-whisper-model.bin", - "ollama_model": "default-model", - "ollama_prompt": "Provide a detailed response to the following text:\n\n" + "ollama": "disable" }, { "name": "Quick English", "whisper_model": "/path/to/quick-whisper-model.bin", - "ollama_model": "quick-model", - "ollama_prompt": "Quickly correct the following English text for grammar and punctuation:\n\n" + "ollama_model": "gemma3:4b", + "ollama_context": 131072, + "ollama_prompt": [ + "Quickly correct the following English text for grammar and punctuation:\n", + "\n" + ] }, { "name": "German Correction", diff --git a/src/pyvtt/libs/ollama.py b/src/pyvtt/libs/ollama.py index e175c7d..061da5e 100644 --- a/src/pyvtt/libs/ollama.py +++ b/src/pyvtt/libs/ollama.py @@ -14,6 +14,7 @@ class OllamaClient: """ self.base_url = config.ollama_url self.port = config.ollama_port + self.path = config.ollama_path def send_chat( self, @@ -52,7 +53,7 @@ class OllamaClient: "stream": False } - endpoint = f"{self.base_url}:{self.port}/api/chat" + endpoint = f"{self.base_url}:{self.port}{self.path}" # Anfrage an Ollama senden und Antwort extrahieren try: diff --git a/src/pyvtt/models/config.py b/src/pyvtt/models/config.py index e10c829..a341538 100644 --- a/src/pyvtt/models/config.py +++ b/src/pyvtt/models/config.py @@ -20,6 +20,7 @@ class AppConfig(BaseModel): whisper_path: str socket_path: str ollama_url: str + ollama_path: str ollama_port: int journal_path: str presets: List[PresetConfig]