Skip to content

Commit 7983478

Browse files
committed
resolve review comments
1 parent 31fdf54 commit 7983478

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

packages/tasks/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export { snippets };
4747
export { SKUS, DEFAULT_MEMORY_OPTIONS } from "./hardware";
4848
export type { HardwareSpec, SkuType } from "./hardware";
4949
export { LOCAL_APPS } from "./local-apps";
50-
export type { LocalApp, LocalAppKey } from "./local-apps";
50+
export type { LocalApp, LocalAppKey, LocalAppSnippet } from "./local-apps";
5151

5252
export { DATASET_LIBRARIES_UI_ELEMENTS } from "./dataset-libraries";
5353
export type { DatasetLibraryUiElement, DatasetLibraryKey } from "./dataset-libraries";

packages/tasks/src/local-apps.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import type { ModelData } from "./model-data";
22
import type { PipelineType } from "./pipelines";
33

4-
interface Snippet {
4+
export interface LocalAppSnippet {
5+
/**
6+
* Title of the snippet
7+
*/
58
title: string;
6-
setup: string;
7-
command: string;
9+
/**
10+
* Optional setup guide
11+
*/
12+
setup?: string;
13+
/**
14+
* Content (or command) to be run
15+
*/
16+
content: string;
817
}
918

1019
/**
@@ -45,15 +54,15 @@ export type LocalApp = {
4554
* And if not (mostly llama.cpp), snippet to copy/paste in your terminal
4655
* Support the placeholder {{GGUF_FILE}} that will be replaced by the gguf file path or the list of available files.
4756
*/
48-
snippet: (model: ModelData, filepath?: string) => string | string[] | Snippet | Snippet[];
57+
snippet: (model: ModelData, filepath?: string) => string | string[] | LocalAppSnippet | LocalAppSnippet[];
4958
}
5059
);
5160

5261
function isGgufModel(model: ModelData) {
5362
return model.tags.includes("gguf");
5463
}
5564

56-
const snippetLlamacpp = (model: ModelData, filepath?: string): Snippet[] => {
65+
const snippetLlamacpp = (model: ModelData, filepath?: string): LocalAppSnippet[] => {
5766
const command = (binary: string) =>
5867
[
5968
"# Load and run the model:",
@@ -67,7 +76,7 @@ const snippetLlamacpp = (model: ModelData, filepath?: string): Snippet[] => {
6776
{
6877
title: "Install from brew",
6978
setup: "brew install llama.cpp",
70-
command: command("llama-cli"),
79+
content: command("llama-cli"),
7180
},
7281
{
7382
title: "Use pre-built binary",
@@ -76,7 +85,7 @@ const snippetLlamacpp = (model: ModelData, filepath?: string): Snippet[] => {
7685
"# Download pre-built binary from:",
7786
"# https://github.com/ggerganov/llama.cpp/releases",
7887
].join("\n"),
79-
command: command("./llama-cli"),
88+
content: command("./llama-cli"),
8089
},
8190
{
8291
title: "Build from source code",
@@ -85,7 +94,7 @@ const snippetLlamacpp = (model: ModelData, filepath?: string): Snippet[] => {
8594
"cd llama.cpp",
8695
"LLAMA_CURL=1 make llama-cli",
8796
].join("\n"),
88-
command: command("./llama-cli"),
97+
content: command("./llama-cli"),
8998
},
9099
];
91100
};

0 commit comments

Comments
 (0)