11import type { ModelData } from "./model-data" ;
22import 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
5261function 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