Skip to content

Commit

Permalink
fea: list remote and installed models
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-souza committed Sep 26, 2024
1 parent 6613237 commit d3ed683
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lua/ollero/ollero.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local utils = require("shared.utils")
local di = require("di")
local commands = require("ollero.commands")
local strings = require("shared.strings")

local term = di.resolve("term")
local logger = di.resolve("logger")
Expand Down Expand Up @@ -70,7 +71,16 @@ end

---List Models
function Ollero.list_models()
local options = ollama_v2.fetch_models()
local options = ollama_v2.list()
local online_options = ollama_v2.fetch_models()

options[#options] = "-----------------"

for _, model in ipairs(online_options) do
if strings.is_valid(model) then
table.insert(options, model .. " (remote)")
end
end

---@param choice string
local function on_select(choice)
Expand Down
1 change: 1 addition & 0 deletions lua/shared/strings.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local M = {}

function M.is_valid(str)
str = str or ""
return str and #str > 0
end

Expand Down

0 comments on commit d3ed683

Please sign in to comment.