From d87b75680732d21b2683e1dcc203215fbec36d3e Mon Sep 17 00:00:00 2001 From: Gordon Quad Date: Fri, 8 Mar 2024 17:53:18 +0000 Subject: [PATCH] Add ability to specify ollama url in provider options --- lua/model/providers/ollama.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/model/providers/ollama.lua b/lua/model/providers/ollama.lua index b060756..1d90910 100644 --- a/lua/model/providers/ollama.lua +++ b/lua/model/providers/ollama.lua @@ -4,7 +4,10 @@ local juice = require('model.util.juice') ---@type Provider return { - request_completion = function(handlers, params) + request_completion = function(handlers, params, options) + local opts = vim.tbl_extend('force', { + url = 'http://localhost:11434', + }, options or {}) local stop_marquee = juice.handler_marquee_or_notify( 'ollama: ' .. params.model, handlers.segment, @@ -13,7 +16,7 @@ return { ) return curl.stream({ - url = 'http://localhost:11434/api/generate', + url = opts.url .. '/api/generate', headers = { ['Content-Type'] = 'application/json', },