fix: use configured port from server_address for local Ollama connections (fixes #332)
When is_local=True, the Ollama host URL previously hardcoded port 11434, ignoring the port specified in provider_server_address in config.ini. Users who need to run Ollama on a non-default port (e.g. because 11434 is already in use) had no way to configure this without editing source code. Now the port is extracted from provider_server_address when present, falling back to 11434 if only a hostname is given.
This commit is contained in:
@@ -165,7 +165,11 @@ class Provider:
|
|||||||
Use local or remote Ollama server to generate text.
|
Use local or remote Ollama server to generate text.
|
||||||
"""
|
"""
|
||||||
thought = ""
|
thought = ""
|
||||||
host = f"{self.internal_url}:11434" if self.is_local else f"http://{self.server_address}"
|
if self.is_local:
|
||||||
|
server_port = self.server_address.split(":")[-1] if ":" in str(self.server_address) else "11434"
|
||||||
|
host = f"{self.internal_url}:{server_port}"
|
||||||
|
else:
|
||||||
|
host = f"http://{self.server_address}"
|
||||||
client = OllamaClient(host=host)
|
client = OllamaClient(host=host)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user