Skip to content

Commit

Permalink
fix: check for updates should show no update are availale on the late…
Browse files Browse the repository at this point in the history
…st build (janhq#2075)
  • Loading branch information
louis-jan authored Feb 18, 2024
1 parent 9244fb9 commit 3ea8c60
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion electron/handlers/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export function handleAppUpdates() {
/* New Update Available */
autoUpdater.on('update-available', async (_info: any) => {
const action = await dialog.showMessageBox({
message: `Update available. Do you want to download the latest update?`,
title: 'Update Available',
message: 'Would you like to download and install it now?',
buttons: ['Download', 'Later'],
})
if (action.response === 0) await autoUpdater.downloadUpdate()
Expand Down
1 change: 1 addition & 0 deletions electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"main": "./build/main.js",
"author": "Jan <[email protected]>",
"license": "MIT",
"productName": "Jan",
"homepage": "https://github.com/janhq/jan/tree/main/electron",
"description": "Use offline LLMs with your own data. Run open source models like Llama2 or Falcon on your internal computers/servers.",
"build": {
Expand Down
22 changes: 19 additions & 3 deletions electron/utils/menu.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @ts-nocheck
import { app, Menu, shell } from 'electron'
const isMac = process.platform === 'darwin'
import { app, Menu, shell, dialog } from 'electron'
import { autoUpdater } from 'electron-updater'
import { log } from '@janhq/core/node'
const isMac = process.platform === 'darwin'

const template: (Electron.MenuItemConstructorOptions | Electron.MenuItem)[] = [
{
Expand All @@ -12,7 +13,22 @@ const template: (Electron.MenuItemConstructorOptions | Electron.MenuItem)[] = [
label: 'Check for Updates...',
click: () =>
// Check for updates and notify user if there are any
autoUpdater.checkForUpdatesAndNotify(),
autoUpdater
.checkForUpdatesAndNotify()
.then((updateCheckResult) => {
if (
!updateCheckResult?.updateInfo ||
updateCheckResult?.updateInfo.version === app.getVersion()
) {
dialog.showMessageBox({
message: `No updates available.`,
})
return
}
})
.catch((error) => {
log('Error checking for updates:' + JSON.stringify(error))
}),
},
{ type: 'separator' },
{ role: 'services' },
Expand Down
2 changes: 1 addition & 1 deletion models/mistral-ins-7b-q4/model.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"author": "MistralAI, The Bloke",
"tags": ["Featured", "7B", "Foundational Model"],
"size": 4370000000,
"cover": "https://raw.githubusercontent.com/janhq/jan/main/models/mistral-ins-7b-q4/cover.png"
"cover": "https://raw.githubusercontent.com/janhq/jan/dev/models/mistral-ins-7b-q4/cover.png"
},
"engine": "nitro"
}
2 changes: 1 addition & 1 deletion models/openhermes-neural-7b/model.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "Intel, Jan",
"tags": ["7B", "Merged", "Featured"],
"size": 4370000000,
"cover": "https://raw.githubusercontent.com/janhq/jan/main/models/openhermes-neural-7b/cover.png"
"cover": "https://raw.githubusercontent.com/janhq/jan/dev/models/openhermes-neural-7b/cover.png"
},
"engine": "nitro"
}
2 changes: 1 addition & 1 deletion models/trinity-v1.2-7b/model.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "Jan",
"tags": ["7B", "Merged", "Featured"],
"size": 4370000000,
"cover": "https://raw.githubusercontent.com/janhq/jan/main/models/trinity-v1.2-7b/cover.png"
"cover": "https://raw.githubusercontent.com/janhq/jan/dev/models/trinity-v1.2-7b/cover.png"
},
"engine": "nitro"
}

0 comments on commit 3ea8c60

Please sign in to comment.