Spaces:
Running
Running
File size: 1,131 Bytes
d5a8353 0b71579 3531886 f32f280 3531886 a5dd8da 0b71579 254023e 0b71579 f32f280 a5dd8da 0ab1b6a a5dd8da 0b71579 4f65b76 0b71579 07d416c 0b71579 3531886 3de1d9f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import { serve } from '@hono/node-server'
import Groq from 'groq-sdk'
import { Hono } from 'hono'
import { logger } from 'hono/logger'
const app = new Hono()
// const cache = new Map()
const client = new Groq()
const systemPrompt = `
Kamu adalah seorang developer frontend ahli.
Buatkan kode HTML untuk sebuah halaman web menggunakan class dari Tailwind CSS.
Pastikan hasilnya terlihat modern dan profesional.
PENTING: Respon kamu harus berisi kode HTML saja.
Jangan sertakan penjelasan, komentar, atau markdown code block.
`.trim()
app.use(logger())
app.get('/fetch', async (c) =>
c.html(await (await fetch(c.req.query('url'))).text())
)
app.get('*', async (c) =>
c.html(
(
await client.chat.completions.create({
messages: [
{ role: 'system', content: systemPrompt },
{ role: 'user', content: `Bikinin HTML buat halaman ${c.req.path}` }
],
model: 'meta-llama/llama-4-maverick-17b-128e-instruct'
})
).choices[0].message.content || 'error'
)
)
const port = process.env.PORT || 7860
console.log('App running on port', port)
serve({ fetch: app.fetch, port }) |