Delete unused files and update API calls

This commit is contained in:
n4ze3m
2024-03-03 19:55:43 +05:30
parent e0c2c0c745
commit 0351beeaae
18 changed files with 389 additions and 211 deletions

View File

@@ -60,10 +60,13 @@ export const isOllamaRunning = async () => {
}
}
export const getAllModels = async () => {
export const getAllModels = async ({ returnEmpty = false }: { returnEmpty?: boolean }) => {
const baseUrl = await getOllamaURL()
const response = await fetch(`${cleanUrl(baseUrl)}/api/tags`)
if (!response.ok) {
if (returnEmpty) {
return []
}
throw new Error(response.statusText)
}
const json = await response.json()