fix: clear logs should not delete the folder (#4806)
This commit is contained in:
parent
74f6682263
commit
39e5649454
@ -1 +1 @@
|
|||||||
1.0.11-rc8
|
1.0.11-rc9
|
||||||
|
|||||||
@ -7,19 +7,15 @@ import {
|
|||||||
ArrowLeftIcon,
|
ArrowLeftIcon,
|
||||||
DownloadIcon,
|
DownloadIcon,
|
||||||
FileJson,
|
FileJson,
|
||||||
RefreshCwIcon,
|
|
||||||
SettingsIcon,
|
SettingsIcon,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
|
|
||||||
import Spinner from '@/containers/Loader/Spinner'
|
|
||||||
import ModelDownloadButton from '@/containers/ModelDownloadButton'
|
import ModelDownloadButton from '@/containers/ModelDownloadButton'
|
||||||
|
|
||||||
import ModelLabel from '@/containers/ModelLabel'
|
import ModelLabel from '@/containers/ModelLabel'
|
||||||
|
|
||||||
import { MainViewState } from '@/constants/screens'
|
import { MainViewState } from '@/constants/screens'
|
||||||
|
|
||||||
import { useRefreshModelList } from '@/hooks/useEngineManagement'
|
|
||||||
|
|
||||||
import { MarkdownTextMessage } from '@/screens/Thread/ThreadCenterPanel/TextMessage/MarkdownTextMessage'
|
import { MarkdownTextMessage } from '@/screens/Thread/ThreadCenterPanel/TextMessage/MarkdownTextMessage'
|
||||||
|
|
||||||
import { toGigabytes } from '@/utils/converter'
|
import { toGigabytes } from '@/utils/converter'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { fs } from '@janhq/core'
|
import { fs, joinPath } from '@janhq/core'
|
||||||
import { Button, Input, ScrollArea, Switch } from '@janhq/joi'
|
import { Button, Input, ScrollArea, Switch } from '@janhq/joi'
|
||||||
import { useAtom, useAtomValue } from 'jotai'
|
import { useAtom, useAtomValue } from 'jotai'
|
||||||
import { FolderOpenIcon } from 'lucide-react'
|
import { FolderOpenIcon } from 'lucide-react'
|
||||||
@ -22,7 +22,9 @@ const Privacy = () => {
|
|||||||
*/
|
*/
|
||||||
const clearLogs = async () => {
|
const clearLogs = async () => {
|
||||||
try {
|
try {
|
||||||
await fs.rm(`file://logs`)
|
for (const file of await fs.readdirSync(`file://logs`)) {
|
||||||
|
await fs.rm(await joinPath(['file://logs', file]))
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error clearing logs: ', err)
|
console.error('Error clearing logs: ', err)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user