fix: update style cortex dialog (#5245)

This commit is contained in:
Faisal Amir 2025-06-12 00:09:19 +07:00 committed by GitHub
parent 35a0a4e9a5
commit d2e88ffdc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,13 +18,10 @@ export function CortexFailureDialog() {
useEffect(() => { useEffect(() => {
let unlisten: (() => void) | undefined let unlisten: (() => void) | undefined
const setupListener = async () => { const setupListener = async () => {
unlisten = await listen<null>( unlisten = await listen<null>('cortex_max_restarts_reached', (event) => {
'cortex_max_restarts_reached', console.log('Cortex max restarts reached event received:', event)
(event) => { setShowDialog(true)
console.log('Cortex max restarts reached event received:', event) })
setShowDialog(true)
}
)
} }
setupListener() setupListener()
@ -55,32 +52,38 @@ export function CortexFailureDialog() {
<Dialog open={showDialog} onOpenChange={setShowDialog}> <Dialog open={showDialog} onOpenChange={setShowDialog}>
<DialogContent> <DialogContent>
<DialogHeader> <DialogHeader>
<DialogTitle>{t('cortexFailureDialog.title', 'Local AI Engine Issue')}</DialogTitle> <DialogTitle>
{t('cortexFailureDialog.title', 'Local AI Engine Issue')}
</DialogTitle>
</DialogHeader> </DialogHeader>
<DialogDescription> <DialogDescription>
{t('cortexFailureDialog.description', 'The local AI engine (Cortex) failed to start after multiple attempts. This might prevent some features from working correctly.')} {t(
'cortexFailureDialog.description',
'The local AI engine (Cortex) failed to start after multiple attempts. This might prevent some features from working correctly.'
)}
</DialogDescription> </DialogDescription>
<DialogFooter className="gap-2 sm:gap-0"> <DialogFooter className="flex gap-2">
<Button <Button
asChild
variant="default" variant="default"
className="bg-transparent border border-main-view-fg/20 hover:bg-main-view-fg/10" className="bg-transparent border border-main-view-fg/20 hover:bg-main-view-fg/4"
onClick={() => { onClick={() => {
window.open('https://jan.ai/support', '_blank')
setShowDialog(false) setShowDialog(false)
}} }}
> >
{t('cortexFailureDialog.contactSupport', 'Contact Support')} <a
href="https://jan.ai/support"
target="_blank"
rel="noopener noreferrer"
>
<span className="text-main-view-fg/70">
{t('cortexFailureDialog.contactSupport', 'Contact Support')}
</span>
</a>
</Button> </Button>
<Button <Button onClick={handleRestartJan}>
variant="default"
className="bg-transparent border border-main-view-fg/20 hover:bg-main-view-fg/10"
onClick={handleRestartJan}
>
{t('cortexFailureDialog.restartJan', 'Restart Jan')} {t('cortexFailureDialog.restartJan', 'Restart Jan')}
</Button> </Button>
<Button onClick={() => setShowDialog(false)}>
{t('common.okay', 'Okay')}
</Button>
</DialogFooter> </DialogFooter>
</DialogContent> </DialogContent>
</Dialog> </Dialog>