web: skip pre-releases
This commit is contained in:
parent
f1ff892fdd
commit
dc642aa07d
1 changed files with 3 additions and 2 deletions
|
@ -14,11 +14,12 @@ export async function GET(req: Request) {
|
||||||
const res = await fetch('https://api.github.com/repos/jmorganca/ollama/releases', { next: { revalidate: 60 } })
|
const res = await fetch('https://api.github.com/repos/jmorganca/ollama/releases', { next: { revalidate: 60 } })
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
|
|
||||||
if (data.length === 0) {
|
const latest = data?.filter((f: any) => !f.prerelease)?.[0]
|
||||||
|
|
||||||
|
if (!latest) {
|
||||||
return new Response('not found', { status: 404 })
|
return new Response('not found', { status: 404 })
|
||||||
}
|
}
|
||||||
|
|
||||||
const latest = data[0]
|
|
||||||
const assets = latest.assets || []
|
const assets = latest.assets || []
|
||||||
|
|
||||||
if (assets.length === 0) {
|
if (assets.length === 0) {
|
||||||
|
|
Loading…
Reference in a new issue