Skip to content

Commit

Permalink
fix: ollama.ts lint and typecheck issues (#2538)
Browse files Browse the repository at this point in the history
  • Loading branch information
kattouf authored Dec 31, 2024
1 parent 5cb1cb7 commit 47c8676
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/ollama.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
const ListModelGenerator: Fig.Generator = {
script: ["bash", "-c", "ollama ls | awk '!/NAME/ { print $1 }'"],
postProcess: (out) => out.trim().split("\n"),
postProcess: (out) => {
return out
.trim()
.split("\n")
.map((model) => ({ name: model }));
},
};

const RunModelGenerator: Fig.Generator = {
script: ["bash", "-c", "ollama ps | awk '!/NAME/ { print $1 }'"],
postProcess: (out) => out.trim().split("\n"),
postProcess: (out) => {
return out
.trim()
.split("\n")
.map((model) => ({ name: model }));
},
};

const completionSpec: Fig.Spec = {
Expand Down Expand Up @@ -81,9 +91,9 @@ const completionSpec: Fig.Spec = {
name: "cp",
description: "Copy a model",
args: {
name: "SOURCE",
generators: ListModelGenerator,
},
name: "SOURCE",
generators: ListModelGenerator,
},
},
{
name: "rm",
Expand Down

0 comments on commit 47c8676

Please sign in to comment.