import { useState } from 'react' import copy from 'copy-to-clipboard' import { exec } from 'child_process' import * as path from 'path' import * as fs from 'fs' import { DocumentDuplicateIcon } from '@heroicons/react/24/outline' import { app } from '@electron/remote' import OllamaIcon from './ollama.svg' const ollama = app.isPackaged ? path.join(process.resourcesPath, 'ollama') : path.resolve(process.cwd(), '..', 'ollama') async function installCLI(callback: () => void) { const symlinkPath = '/usr/local/bin/ollama' if (fs.existsSync(symlinkPath) && fs.readlinkSync(symlinkPath) === ollama) { callback && callback() return } const command = ` do shell script "ln -F -s ${ollama} /usr/local/bin/ollama" with administrator privileges ` exec(`osascript -e '${command}'`, (error: Error | null, stdout: string, stderr: string) => { if (error) { console.error(`cli: failed to install cli: ${error.message}`) callback && callback() return } callback && callback() }) } export default function () { const [step, setStep] = useState(0) const command = 'ollama run orca' return (
{step === 0 && ( <>

Welcome to Ollama

Let's get you up and running with your own large language models.

)} {step === 1 && ( <>

Install the command line

> ollama

You will be prompted for administrator access

)} {step === 2 && ( <>

Run your first model

                  {command}
                

Run this command in your favorite terminal.

)}
) }