Skip to content

Commit 88528ee

Browse files
committed
handle absolute image paths
1 parent 23a8348 commit 88528ee

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

MyApp.ServiceInterface/AgentServices.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,10 @@ public object Get(GetOllamaGenerateTask request)
804804
var image = ollama.Images[i];
805805
if (image.StartsWith('/') || image.StartsWith("../"))
806806
{
807-
var imageBytes = File.ReadAllBytes(appData.ContentRootPath.CombineWith(image));
807+
var usePath = image.StartsWith('/')
808+
? image
809+
: appData.ContentRootPath.CombineWith(image);
810+
var imageBytes = File.ReadAllBytes(usePath);
808811
var base64 = Convert.ToBase64String(imageBytes);
809812
ollama.Images[i] = base64;
810813
}

0 commit comments

Comments
 (0)