Merge branch 'dev' into feat/path-to-cortexcpp

This commit is contained in:
Louis 2024-11-06 13:55:27 +07:00 committed by GitHub
commit c92b809883
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 35 deletions

View File

@ -47,9 +47,6 @@ async function migrateThemes() {
const themes = readdirSync(join(appResourcePath(), 'themes')) const themes = readdirSync(join(appResourcePath(), 'themes'))
for (const theme of themes) { for (const theme of themes) {
const themePath = join(appResourcePath(), 'themes', theme) const themePath = join(appResourcePath(), 'themes', theme)
if (existsSync(themePath) && !lstatSync(themePath).isDirectory()) {
continue
}
await checkAndMigrateTheme(theme, themePath) await checkAndMigrateTheme(theme, themePath)
} }
} }
@ -64,21 +61,11 @@ async function checkAndMigrateTheme(
) )
if (existingTheme) { if (existingTheme) {
const desTheme = join(janDataThemesFolder, existingTheme) const desTheme = join(janDataThemesFolder, existingTheme)
if (!existsSync(desTheme) || !lstatSync(desTheme).isDirectory()) return console.debug('Updating theme', existingTheme)
rmdirSync(desTheme, { recursive: true })
const desThemeData = JSON.parse( cpSync(sourceThemePath, join(janDataThemesFolder, sourceThemeName), {
readFileSync(join(desTheme, 'theme.json'), 'utf-8') recursive: true,
) })
const sourceThemeData = JSON.parse(
readFileSync(join(sourceThemePath, 'theme.json'), 'utf-8')
)
if (desThemeData.version !== sourceThemeData.version) {
console.debug('Updating theme', existingTheme)
rmdirSync(desTheme, { recursive: true })
cpSync(sourceThemePath, join(janDataThemesFolder, sourceThemeName), {
recursive: true,
})
}
} else { } else {
console.debug('Adding new theme', sourceThemeName) console.debug('Adding new theme', sourceThemeName)
cpSync(sourceThemePath, join(janDataThemesFolder, sourceThemeName), { cpSync(sourceThemePath, join(janDataThemesFolder, sourceThemeName), {

View File

@ -1,7 +1,7 @@
import { useCallback, useEffect, useMemo, useState } from 'react' import { useCallback, useEffect, useMemo, useState } from 'react'
import { extractInferenceParams, extractModelLoadParams } from '@janhq/core' import { extractInferenceParams, extractModelLoadParams } from '@janhq/core'
import { Accordion, AccordionItem, Input, Tooltip } from '@janhq/joi' import { Accordion, AccordionItem, Input } from '@janhq/joi'
import { useAtomValue, useSetAtom } from 'jotai' import { useAtomValue, useSetAtom } from 'jotai'
import { AlertTriangleIcon, CheckIcon, CopyIcon, InfoIcon } from 'lucide-react' import { AlertTriangleIcon, CheckIcon, CopyIcon, InfoIcon } from 'lucide-react'
@ -95,7 +95,7 @@ const LocalServerRightPanel = () => {
<div className="mt-2"> <div className="mt-2">
<Input <Input
value={selectedModel?.id || ''} value={selectedModel?.id || ''}
className="cursor-pointer" className="cursor-pointer text-[hsla(var(--text-secondary))]"
readOnly readOnly
suffixIcon={ suffixIcon={
clipboard.copied ? ( clipboard.copied ? (
@ -104,17 +104,12 @@ const LocalServerRightPanel = () => {
className="text-[hsla(var(--success-bg))]" className="text-[hsla(var(--success-bg))]"
/> />
) : ( ) : (
<Tooltip <CopyIcon
trigger={ size={14}
<CopyIcon className="cursor-pointer text-[hsla(var(--text-secondary))]"
size={14} onClick={() => {
className="text-[hsla(var(--text-secondary))]" clipboard.copy(selectedModel?.id)
onClick={() => { }}
clipboard.copy(selectedModel?.id)
}}
/>
}
content="Copy Model ID"
/> />
) )
} }

View File

@ -94,7 +94,7 @@ const ModelDownloadRow: React.FC<Props> = ({
return ( return (
<div className="flex flex-col gap-4 rounded border border-[hsla(var(--app-border))] p-3 md:flex-row md:items-center md:justify-between xl:w-full"> <div className="flex flex-col gap-4 rounded border border-[hsla(var(--app-border))] p-3 md:flex-row md:items-center md:justify-between xl:w-full">
<div className="flex max-w-[50%] justify-between"> <div className="flex max-w-[50%] justify-between">
<div className="flex"> <div className="flex min-w-[280px] max-w-[280px]">
{quantization && ( {quantization && (
<Badge variant="soft" className="mr-1"> <Badge variant="soft" className="mr-1">
{quantization} {quantization}
@ -109,9 +109,11 @@ const ModelDownloadRow: React.FC<Props> = ({
{fileName} {fileName}
</h1> </h1>
</div> </div>
<Badge theme="secondary" className="hidden md:flex"> <div className="md:min-w-[90px] md:max-w-[90px]">
{toGibibytes(fileSize)} <Badge theme="secondary" className="ml-4 hidden md:flex">
</Badge> {toGibibytes(fileSize)}
</Badge>
</div>
</div> </div>
{downloadedModel ? ( {downloadedModel ? (