@@ -8,7 +8,7 @@ export class Menu {
88 }
99
1010 createMenuItems = ( currentLanguage : string | undefined , isLanguageEnabled : boolean ) : vscode . QuickPickItem [ ] => {
11- return [
11+ let menuItems = [
1212 {
1313 label : `${ this . app . extConfig . enabled ? 'Disable' : 'Enable' } All Completions` ,
1414 description : `Turn ${ this . app . extConfig . enabled ? 'off' : 'on' } completions globally`
@@ -22,15 +22,86 @@ export class Menu {
2222 } ,
2323 {
2424 label : "$(book) View Documentation..." ,
25- }
26- ] . filter ( Boolean ) as vscode . QuickPickItem [ ] ;
25+ } ]
26+
27+ if ( process . platform === 'darwin' ) { // if mac os
28+ menuItems . push (
29+ {
30+ label : "Start model Qwen2.5-Coder-1.5B-Q8_0-GGUF (<= 8GB VRAM)" ,
31+ description : `Requires brew, installs/upgrades llama.cpp server, downloads the model if not available, and runs llama.cpp server`
32+ } ,
33+ {
34+ label : "Start model Qwen2.5-Coder-3B-Q8_0-GGUF (<= 16GB VRAM)" ,
35+ description : `Requires brew, installs/upgrades llama.cpp server, downloads the model if not available, and runs llama.cpp server`
36+ } ,
37+ {
38+ label : "Start model Qwen2.5-Coder-7B-Q8_0-GGUF (> 16GB VRAM)" ,
39+ description : `Requires brew, installs/upgrades llama.cpp server, downloads the model if not available, and runs llama.cpp server`
40+ } ,
41+ {
42+ label : "Start model Qwen2.5-Coder-1.5B-Q8_0-GGUF (CPU Only)" ,
43+ description : `Requires brew, installs/upgrades llama.cpp server, downloads the model if not available, and runs llama.cpp server`
44+ } ,
45+ {
46+ label : "Start model Qwen2.5-Coder-0.5B-Q8_0-GGUF (CPU Only)" ,
47+ description : `Requires brew, installs/upgrades llama.cpp server, downloads the model if not available, and runs llama.cpp server`
48+ } )
49+ }
50+
51+ menuItems . push (
52+ {
53+ label : "Start llama.cpp server with custom command from launch_cmd property" ,
54+ description : `Runs the command from property launch_cmd`
55+ } ,
56+ {
57+ label : "Stop llama.cpp server" ,
58+ description : `Stops llama.cpp server if it was started from llama.vscode menu."`
59+ } )
60+
61+ return menuItems . filter ( Boolean ) as vscode . QuickPickItem [ ] ;
2762 }
2863
2964 handleMenuSelection = async ( selected : vscode . QuickPickItem , currentLanguage : string | undefined , languageSettings : Record < string , boolean > ) => {
65+ const DEFAULT_PORT_FIM_MODEL = "8012"
66+ const PRESET_PLACEHOLDER = "[preset]" ;
67+ const MODEL_PLACEHOLDER = "[model]"
68+ let endpointParts = this . app . extConfig . endpoint . split ( ":" ) ;
69+ let port = endpointParts [ endpointParts . length - 1 ]
70+ if ( ! Number . isInteger ( Number ( port ) ) ) port = DEFAULT_PORT_FIM_MODEL
71+ let llmMacVramTemplate = " brew install llama.cpp && llama-server --" + PRESET_PLACEHOLDER + " --port " + port
72+ let llmMacCpuTemplate = " brew install llama.cpp && llama-server -hf " + MODEL_PLACEHOLDER + " --port " + port + " -ub 1024 -b 1024 -dt 0.1 --ctx-size 0 --cache-reuse 256"
73+
3074 switch ( selected . label ) {
3175 case "$(gear) Edit Settings..." :
3276 await vscode . commands . executeCommand ( 'workbench.action.openSettings' , 'llama-vscode' ) ;
3377 break ;
78+ case "$(gear) Start model Qwen2.5-Coder-1.5B-Q8_0-GGUF (<= 8GB VRAM)" :
79+ await this . app . llamaServer . killCmd ( ) ;
80+ await this . app . llamaServer . shellCmd ( llmMacVramTemplate . replace ( PRESET_PLACEHOLDER , "fim-qwen-1.5b-default" ) ) ;
81+ break ;
82+ case "Start model Qwen2.5-Coder-3B-Q8_0-GGUF (<= 16GB VRAM)" :
83+ await this . app . llamaServer . killCmd ( ) ;
84+ await this . app . llamaServer . shellCmd ( llmMacVramTemplate . replace ( PRESET_PLACEHOLDER , "fim-qwen-3b-default" ) ) ;
85+ break ;
86+ case "Start model Qwen2.5-Coder-7B-Q8_0-GGUF (> 16GB VRAM)" :
87+ await this . app . llamaServer . killCmd ( ) ;
88+ await this . app . llamaServer . shellCmd ( llmMacVramTemplate . replace ( PRESET_PLACEHOLDER , "fim-qwen-7b-default" ) ) ;
89+ break ;
90+ case "Start model Qwen2.5-Coder-1.5B-Q8_0-GGUF (CPU Only)" :
91+ await this . app . llamaServer . killCmd ( ) ;
92+ await this . app . llamaServer . shellCmd ( llmMacCpuTemplate . replace ( MODEL_PLACEHOLDER , "ggml-org/Qwen2.5-Coder-1.5B-Q8_0-GGUF" ) ) ;
93+ break ;
94+ case "Start model Qwen2.5-Coder-0.5B-Q8_0-GGUF (CPU Only)" :
95+ await this . app . llamaServer . killCmd ( ) ;
96+ await this . app . llamaServer . shellCmd ( llmMacCpuTemplate . replace ( MODEL_PLACEHOLDER , "ggml-org/Qwen2.5-Coder-0.5B-Q8_0-GGUF" ) ) ;
97+ break ;
98+ case "Start llama.cpp server with custom command from launch_cmd property" :
99+ await this . app . llamaServer . killCmd ( ) ;
100+ await this . app . llamaServer . shellCmd ( this . app . extConfig . launch_cmd ) ;
101+ break ;
102+ case "Stop llama.cpp server" :
103+ await this . app . llamaServer . killCmd ( ) ;
104+ break ;
34105 case "$(book) View Documentation..." :
35106 await vscode . env . openExternal ( vscode . Uri . parse ( 'https://github.com/ggml-org/llama.vscode' ) ) ;
36107 break ;
0 commit comments