* chore: enable shortcut zoom (#5261) * chore: enable shortcut zoom * chore: update shortcut setting * fix: thinking block (#5263) * Merge pull request #5262 from menloresearch/chore/sync-new-hub-data chore: sync new hub data * ✨enhancement: model run improvement (#5268) * fix: mcp tool error handling * fix: error message * fix: trigger download from recommend model * fix: can't scroll hub * fix: show progress * ✨enhancement: prompt users to increase context size * ✨enhancement: rearrange action buttons for a better UX * 🔧chore: clean up logics --------- Co-authored-by: Faisal Amir <urmauur@gmail.com> * fix: glitch download from onboarding (#5269) * ✨enhancement: Model sources should not be hard coded from frontend (#5270) * 🐛fix: default onboarding model should use recommended quantizations (#5273) * 🐛fix: default onboarding model should use recommended quantizations * ✨enhancement: show context shift option in provider settings * 🔧chore: wording * 🔧 config: add to gitignore * 🐛fix: Jan-nano repo name changed (#5274) * 🚧 wip: disable showSpeedToken in ChatInput * 🐛 fix: commented out the wrong import * fix: masking value MCP env field (#5276) * ✨ feat: add token speed to each message that persist * ♻️ refactor: to follow prettier convention * 🐛 fix: exclude deleted field * 🧹 clean: all the missed console.log * ✨enhancement: out of context troubleshooting (#5275) * ✨enhancement: out of context troubleshooting * 🔧refactor: clean up * ✨enhancement: add setting chat width container (#5289) * ✨enhancement: add setting conversation width * ✨enahncement: cleanup log and change improve accesibility * ✨enahcement: move const beta version * 🐛fix: optional additional_information gpu (#5291) * 🐛fix: showing release notes for beta and prod (#5292) * 🐛fix: showing release notes for beta and prod * ♻️refactor: make an utils env * ♻️refactor: hide MCP for production * ♻️refactor: simplify the boolean expression fetch release note --------- Co-authored-by: Faisal Amir <urmauur@gmail.com> Co-authored-by: LazyYuuki <huy2840@gmail.com> Co-authored-by: Bui Quang Huy <34532913+LazyYuuki@users.noreply.github.com>
143 lines
4.5 KiB
TypeScript
143 lines
4.5 KiB
TypeScript
import { useAppUpdater } from '@/hooks/useAppUpdater'
|
|
|
|
import { IconDownload } from '@tabler/icons-react'
|
|
import { Button } from '@/components/ui/button'
|
|
|
|
import { useState, useEffect } from 'react'
|
|
import { useReleaseNotes } from '@/hooks/useReleaseNotes'
|
|
import { RenderMarkdown } from '../RenderMarkdown'
|
|
import { cn, isDev } from '@/lib/utils'
|
|
import { isNightly, isBeta } from '@/lib/version'
|
|
|
|
const DialogAppUpdater = () => {
|
|
const {
|
|
updateState,
|
|
downloadAndInstallUpdate,
|
|
checkForUpdate,
|
|
setRemindMeLater,
|
|
} = useAppUpdater()
|
|
const [showReleaseNotes, setShowReleaseNotes] = useState(false)
|
|
|
|
const handleUpdate = () => {
|
|
downloadAndInstallUpdate()
|
|
setRemindMeLater(true)
|
|
}
|
|
|
|
const { release, fetchLatestRelease } = useReleaseNotes()
|
|
|
|
useEffect(() => {
|
|
if (!isDev()) {
|
|
fetchLatestRelease(isBeta)
|
|
}
|
|
}, [fetchLatestRelease])
|
|
|
|
// Check for updates when component mounts
|
|
useEffect(() => {
|
|
checkForUpdate()
|
|
}, [checkForUpdate])
|
|
|
|
const [appUpdateState, setAppUpdateState] = useState({
|
|
remindMeLater: false,
|
|
isUpdateAvailable: false,
|
|
})
|
|
|
|
useEffect(() => {
|
|
setAppUpdateState({
|
|
remindMeLater: updateState.remindMeLater,
|
|
isUpdateAvailable: updateState.isUpdateAvailable,
|
|
})
|
|
}, [updateState])
|
|
|
|
if (appUpdateState.remindMeLater) return null
|
|
|
|
return (
|
|
<>
|
|
{appUpdateState.isUpdateAvailable && (
|
|
<div
|
|
className={cn(
|
|
'fixed z-50 w-[400px] bottom-3 right-3 bg-main-view text-main-view-fg flex items-center justify-center border border-main-view-fg/10 rounded-lg shadow-md'
|
|
)}
|
|
>
|
|
<div className="px-0 py-4">
|
|
<div className="px-4">
|
|
<div className="flex items-start gap-2">
|
|
<IconDownload
|
|
size={20}
|
|
className="shrink-0 text-main-view-fg/60 mt-1"
|
|
/>
|
|
<div>
|
|
<div className="text-base font-medium">
|
|
New Version: Jan {updateState.updateInfo?.version}
|
|
</div>
|
|
<div className="mt-1 text-main-view-fg/70 font-normal mb-2">
|
|
There's a new app update available to download.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{showReleaseNotes && (
|
|
<div className="max-h-[500px] p-4 w-[400px] overflow-y-scroll text-sm font-normal leading-relaxed">
|
|
{isNightly && !isBeta ? (
|
|
<p className="text-sm font-normal">
|
|
You are using a nightly build. This version is built from
|
|
the latest development branch and may not have release
|
|
notes.
|
|
</p>
|
|
) : (
|
|
<RenderMarkdown
|
|
components={{
|
|
a: ({ ...props }) => (
|
|
<a
|
|
{...props}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
/>
|
|
),
|
|
h2: ({ ...props }) => (
|
|
<h2 {...props} className="!text-xl !mt-0" />
|
|
),
|
|
}}
|
|
content={release?.body}
|
|
/>
|
|
)}
|
|
</div>
|
|
)}
|
|
|
|
<div className="pt-3 px-4">
|
|
<div className="flex gap-x-4 w-full items-center justify-between">
|
|
<Button
|
|
variant="link"
|
|
className="px-0 text-main-view-fg/70"
|
|
onClick={() => setShowReleaseNotes(!showReleaseNotes)}
|
|
>
|
|
{showReleaseNotes ? 'Hide' : 'Show'} release notes
|
|
</Button>
|
|
<div className="flex gap-x-5">
|
|
<Button
|
|
variant="link"
|
|
className="px-0 text-main-view-fg/70 remind-me-later"
|
|
onClick={() => setRemindMeLater(true)}
|
|
>
|
|
Remind me later
|
|
</Button>
|
|
<Button
|
|
onClick={handleUpdate}
|
|
disabled={updateState.isDownloading}
|
|
>
|
|
{updateState.isDownloading
|
|
? 'Downloading...'
|
|
: 'Update Now'}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default DialogAppUpdater
|