From 72d467c6d5ff4bb12760d7cd85c08b2bad4b0569 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sat, 21 Jun 2025 23:43:43 +0800 Subject: [PATCH] vision is now working in ollama owui --- koboldcpp.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/koboldcpp.py b/koboldcpp.py index d6f90405f..2b8954e7a 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -2262,6 +2262,11 @@ ws ::= | " " | "\n" [ \t]{0,20} # content can be a string or an array of objects curr_content = message.get("content",None) + if api_format==7: #ollama handle vision + imgs = message.get("images",None) + if imgs and len(imgs) > 0: + for img in imgs: + images_added.append(img) if not curr_content: pass # do nothing elif isinstance(curr_content, str): @@ -3127,7 +3132,7 @@ Change Mode
response_body = (json.dumps({"temperature":0.75,"speed":1,"length_penalty":1,"repetition_penalty":1,"top_p":1,"top_k":4,"enable_text_splitting":True,"stream_chunk_size":100}).encode()) #some random voices for them to enjoy elif self.path.endswith('/api/tags') or self.path.endswith('/api/ps'): #ollama compatible - response_body = (json.dumps({"models":[{"name":"koboldcpp","model":friendlymodelname,"modified_at":"2024-07-19T15:26:55.6122841+08:00","expires_at": "2055-06-04T19:06:25.5433636+08:00","size":394998579,"size_vram":394998579,"digest":"b5dc5e784f2a3ee1582373093acf69a2f4e2ac1710b253a001712b86a61f88bb","details":{"parent_model":"","format":"gguf","family":"koboldcpp","families":["koboldcpp"],"parameter_size":"128M","quantization_level":"Q4_0"}}]}).encode()) + response_body = (json.dumps({"models":[{"name":"koboldcpp","model":f"{friendlymodelname}:latest","modified_at":"2024-07-19T15:26:55.6122841+08:00","expires_at": "2055-06-04T19:06:25.5433636+08:00","size":394998579,"size_vram":394998579,"digest":"b5dc5e784f2a3ee1582373093acf69a2f4e2ac1710b253a001712b86a61f88bb","details":{"parent_model":"","format":"gguf","family":"koboldcpp","families":["koboldcpp"],"parameter_size":"128M","quantization_level":"Q4_0"}},{"name":"koboldcpp","model":friendlymodelname,"modified_at":"2024-07-19T15:26:55.6122841+08:00","expires_at": "2055-06-04T19:06:25.5433636+08:00","size":394998579,"size_vram":394998579,"digest":"b5dc5e784f2a3ee1582373093acf69a2f4e2ac1710b253a001712b86a61f88bb","details":{"parent_model":"","format":"gguf","family":"koboldcpp","families":["koboldcpp"],"parameter_size":"128M","quantization_level":"Q4_0"}}]}).encode()) elif self.path.endswith('/api/version'): #ollama compatible, NOT the kcpp version response_body = (json.dumps({"version":"0.7.0"}).encode())