From 47c8676374f8d20d1ea3adc40db69c37586a0895 Mon Sep 17 00:00:00 2001 From: Vasiliy Kattouf Date: Tue, 31 Dec 2024 14:29:01 +0700 Subject: [PATCH] fix: ollama.ts lint and typecheck issues (#2538) --- src/ollama.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/ollama.ts b/src/ollama.ts index b4724f1e4606..0cf85c3d5f56 100644 --- a/src/ollama.ts +++ b/src/ollama.ts @@ -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 = { @@ -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",