fix: check for updates should show no update are availale on the latest build (#2075)

This commit is contained in:
Louis 2024-02-18 20:55:31 +07:00 committed by GitHub
parent 9244fb9367
commit 3ea8c6071c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 25 additions and 7 deletions

View File

@ -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()

View File

@ -4,6 +4,7 @@
"main": "./build/main.js",
"author": "Jan <service@jan.ai>",
"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": {

View File

@ -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)[] = [
{
@ -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' },

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}