import { useState } from 'react' import copy from 'copy-to-clipboard' import { exec as cbExec } 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' import { promisify } from 'util' const ollama = app.isPackaged ? path.join(process.resourcesPath, 'ollama') : path.resolve(process.cwd(), '..', 'ollama') const exec = promisify(cbExec) async function installCLI() { const symlinkPath = '/usr/local/bin/ollama' if (fs.existsSync(symlinkPath) && fs.readlinkSync(symlinkPath) === ollama) { return } const command = `do shell script "ln -F -s ${ollama} /usr/local/bin/ollama" with administrator privileges` try { await exec(`osascript -e '${command}'`) } catch (error) { console.error(`cli: failed to install cli: ${error.message}`) return } } 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.

)}
) }