Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions web-app/src/containers/dialogs/BackendUpdater.tsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,61 @@
import { useBackendUpdater } from '@/hooks/useBackendUpdater'

Check warning on line 1 in web-app/src/containers/dialogs/BackendUpdater.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

1 line is not covered with tests

import { IconDownload } from '@tabler/icons-react'
import { Button } from '@/components/ui/button'

Check warning on line 4 in web-app/src/containers/dialogs/BackendUpdater.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

3-4 lines are not covered with tests

import { useState, useEffect } from 'react'
import { cn } from '@/lib/utils'
import { useTranslation } from '@/i18n/react-i18next-compat'
import { toast } from 'sonner'

Check warning on line 9 in web-app/src/containers/dialogs/BackendUpdater.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

6-9 lines are not covered with tests

const BackendUpdater = () => {
const { t } = useTranslation()
const { updateState, updateBackend, checkForUpdate, setRemindMeLater } =
useBackendUpdater()

Check warning on line 14 in web-app/src/containers/dialogs/BackendUpdater.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

11-14 lines are not covered with tests

const handleUpdate = async () => {
try {
await updateBackend()
setRemindMeLater(true)
toast.success(t('settings:backendUpdater.updateSuccess'))
} catch (error) {
console.error('Backend update failed:', error)
toast.error(t('settings:backendUpdater.updateError'))
}
}

Check warning on line 25 in web-app/src/containers/dialogs/BackendUpdater.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

16-25 lines are not covered with tests

// Check for updates when component mounts
useEffect(() => {
checkForUpdate()
}, [checkForUpdate])

Check warning on line 30 in web-app/src/containers/dialogs/BackendUpdater.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

28-30 lines are not covered with tests

const [backendUpdateState, setBackendUpdateState] = useState({
remindMeLater: false,
isUpdateAvailable: false,
})

Check warning on line 35 in web-app/src/containers/dialogs/BackendUpdater.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

32-35 lines are not covered with tests

useEffect(() => {
setBackendUpdateState({
remindMeLater: updateState.remindMeLater,
isUpdateAvailable: updateState.isUpdateAvailable,
})
}, [updateState])

Check warning on line 42 in web-app/src/containers/dialogs/BackendUpdater.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

37-42 lines are not covered with tests

// Don't show if user clicked remind me later or auto update is enabled
if (backendUpdateState.remindMeLater || updateState.autoUpdateEnabled)
// Don't show if user clicked remind me later
if (backendUpdateState.remindMeLater) {
console.log('BackendUpdater: Not showing notification due to:', {
remindMeLater: backendUpdateState.remindMeLater,
})
return null
}

Check warning on line 50 in web-app/src/containers/dialogs/BackendUpdater.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

45-50 lines are not covered with tests

return (
<>
{backendUpdateState.isUpdateAvailable && (
<div
className={cn(
'fixed z-50 min-w-[300px] 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'
)}

Check warning on line 58 in web-app/src/containers/dialogs/BackendUpdater.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

52-58 lines are not covered with tests
>
<div className="px-0 py-4">
<div className="px-4">
Expand Down
5 changes: 1 addition & 4 deletions web-app/src/routes/settings/providers/$providerName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,9 @@ function ProviderDetail() {

if (selectedFile && typeof selectedFile === 'string') {
// Process the file path: replace spaces with dashes and convert to lowercase
const processedFilePath = selectedFile
.replace(/\s+/g, '-')
.toLowerCase()

// Install the backend using the llamacpp extension
await installBackend(processedFilePath)
await installBackend(selectedFile)

// Extract filename from the selected file path and replace spaces with dashes
const fileName = (
Expand Down
Loading