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 (
Let's get you up and running with your own large language models.
> ollama
You will be prompted for administrator access
{command}
Run this command in your favorite terminal.