page.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import Downloader from './downloader'
  2. import Signup from './signup'
  3. export default async function Download() {
  4. const res = await fetch('https://api.github.com/repos/jmorganca/ollama/releases', { next: { revalidate: 60 } })
  5. const data = await res.json()
  6. if (data.length === 0) {
  7. return null
  8. }
  9. const latest = data[0]
  10. const assets = latest.assets || []
  11. if (assets.length === 0) {
  12. return null
  13. }
  14. // todo: get the correct asset for the current arch/os
  15. const asset = assets.find(
  16. (a: any) => a.name.toLowerCase().includes('darwin') && a.name.toLowerCase().includes('.zip')
  17. )
  18. if (!asset) {
  19. return null
  20. }
  21. return (
  22. <main className='flex min-h-screen max-w-2xl flex-col p-4 lg:p-24 items-center mx-auto'>
  23. <img src='/ollama.png' className='w-16 h-auto' />
  24. <section className='my-12 text-center'>
  25. <h2 className='my-2 max-w-md text-3xl tracking-tight'>Downloading Ollama</h2>
  26. <h3 className='text-sm text-neutral-500'>
  27. Problems downloading?{' '}
  28. <a href={asset.browser_download_url} className='underline'>
  29. Try again
  30. </a>
  31. </h3>
  32. <Downloader url={asset.browser_download_url} />
  33. </section>
  34. <section className='max-w-sm flex flex-col w-full items-center border border-neutral-200 rounded-xl px-8 pt-8 pb-2'>
  35. <p className='text-lg leading-tight text-center mb-6 max-w-[260px]'>Sign up for updates</p>
  36. <Signup />
  37. </section>
  38. </main>
  39. )
  40. }