diff --git a/admin/inertia/lib/api.ts b/admin/inertia/lib/api.ts index a47f326..13c54c6 100644 --- a/admin/inertia/lib/api.ts +++ b/admin/inertia/lib/api.ts @@ -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 }, }) diff --git a/admin/inertia/pages/settings/models.tsx b/admin/inertia/pages/settings/models.tsx index 2da3be2..837854f 100644 --- a/admin/inertia/pages/settings/models.tsx +++ b/admin/inertia/pages/settings/models.tsx @@ -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 + {isUsingFallback && ( + + Showing offline model list. Connect to the internet and refresh for the full catalog. + + )} className="font-semibold mt-4" rowLines={true}