skip to finish cli step if cli is already available

This commit is contained in:
Bruce MacDonald 2024-03-19 09:29:28 +01:00
parent a467bd3f6c
commit 44c05abd22
2 changed files with 12 additions and 5 deletions

View File

@ -16,7 +16,10 @@ enum Step {
}
export default function () {
const [step, setStep] = useState<Step>(Step.WELCOME)
const urlParams = new URLSearchParams(window.location.search);
const stepParam = urlParams.get('step');
const initialStep = stepParam ? Number(stepParam) : Step.WELCOME;
const [step, setStep] = useState<Step>(initialStep);
const [commandCopied, setCommandCopied] = useState<boolean>(false)
const command = 'ollama run llama2'
@ -29,7 +32,7 @@ export default function () {
<div className='mx-auto text-center'>
<h1 className='mb-6 mt-4 text-2xl tracking-tight text-gray-900'>Welcome to Ollama</h1>
<p className='mx-auto w-[65%] text-sm text-gray-400'>
Let's get you up and running with your own large language models.
{stepParam} Let's get you up and running with your own large language models.
</p>
<button
onClick={() => setStep(Step.CLI)}

View File

@ -57,7 +57,7 @@ app.on('ready', async () => {
await init()
})
function firstRunWindow() {
function firstRunWindow(isInstalled: boolean) {
// Create the browser window.
welcomeWindow = new BrowserWindow({
width: 400,
@ -75,7 +75,11 @@ function firstRunWindow() {
require('@electron/remote/main').enable(welcomeWindow.webContents)
welcomeWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY)
let url = MAIN_WINDOW_WEBPACK_ENTRY
if (isInstalled) {
url += '?step=2' // set the window to the finish screen
}
welcomeWindow.loadURL(url);
welcomeWindow.on('ready-to-show', () => welcomeWindow.show())
welcomeWindow.on('closed', () => {
if (process.platform === 'darwin') {
@ -263,7 +267,7 @@ async function init() {
// This is the first run or the CLI is no longer installed
app.setLoginItemSettings({ openAtLogin: true })
firstRunWindow()
firstRunWindow(isInstalled)
}
// Quit when all windows are closed, except on macOS. There, it's common