(ide: IDE)
| 20 | } |
| 21 | |
| 22 | export async function startLocalOllama(ide: IDE): Promise<any> { |
| 23 | let startCommand: string | undefined; |
| 24 | |
| 25 | switch (process.platform) { |
| 26 | case "darwin": //MacOS |
| 27 | startCommand = "open -a Ollama.app\n"; |
| 28 | break; |
| 29 | |
| 30 | case "win32": //Windows |
| 31 | startCommand = '& "ollama app.exe"\n'; |
| 32 | break; |
| 33 | |
| 34 | default: //Linux... |
| 35 | const start_script_path = path.resolve(__dirname, "./start_ollama.sh"); |
| 36 | if (await ide.fileExists(`file:/${start_script_path}`)) { |
| 37 | startCommand = `set -e && chmod +x ${start_script_path} && ${start_script_path}\n`; |
| 38 | console.log(`Ollama Linux startup script at : ${start_script_path}`); |
| 39 | } else { |
| 40 | return ide.showToast( |
| 41 | "error", |
| 42 | `Cannot start Ollama: could not find ${start_script_path}!`, |
| 43 | ); |
| 44 | } |
| 45 | } |
| 46 | if (startCommand) { |
| 47 | return ide.runCommand(startCommand, { |
| 48 | reuseTerminal: true, |
| 49 | terminalName: "Start Ollama", |
| 50 | }); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | export async function getRemoteModelInfo( |
| 55 | modelId: string, |
no test coverage detected