feat(ui): show fallback notice when using offline model list

This commit is contained in:
LuisMIguelFurlanettoSousa 2026-03-25 21:37:09 -03:00
parent a9eec096ce
commit c04cbd25a8
2 changed files with 16 additions and 2 deletions

View File

@ -249,6 +249,7 @@ class API {
const response = await this.client.get<{
models: NomadOllamaModel[]
hasMore: boolean
source?: 'api' | 'fallback'
}>('/ollama/models', {
params: { sort: 'pulls', ...params },
})

View File

@ -131,12 +131,20 @@ export default function ModelsPage(props: {
initialData: { models: props.models.availableModels, hasMore: false },
})
const isUsingFallback = availableModelData?.source === 'fallback'
async function handleForceRefresh() {
forceRefreshRef.current = true
setIsForceRefreshing(true)
await refetch()
const result = await refetch()
setIsForceRefreshing(false)
addNotification({ message: 'Model list refreshed from remote.', type: 'success' })
const refreshSource = result.data?.source
addNotification({
message: refreshSource === 'fallback'
? 'Could not reach model service. Showing offline list.'
: 'Model list refreshed from remote.',
type: refreshSource === 'fallback' ? 'warning' : 'success',
})
}
async function handleInstallModel(modelName: string) {
@ -312,6 +320,11 @@ export default function ModelsPage(props: {
Refresh Models
</StyledButton>
</div>
{isUsingFallback && (
<Alert variant="info">
Showing offline model list. Connect to the internet and refresh for the full catalog.
</Alert>
)}
<StyledTable<NomadOllamaModel>
className="font-semibold mt-4"
rowLines={true}