Public
Back
Version 36
5/30/2024
/** @jsx jsx */
import { Hono } from "npm:hono@3";
import { jsx } from "npm:hono@3/jsx";
import { Nighthawks } from "https://esm.town/v/yawnxyz/nighthawks";
const app = new Hono();
const nighthawks = new Nighthawks();
let char = null;
async function generateText(prompt) {
if (char) {
let response = await char.gen({ prompt });
return response.content;
}
return "No character available.";
}
async function createCharacter() {
await nighthawks.createCharacter();
console.log('---> char', nighthawks.characters[0])
return char;
}
// Server-side rendering
app.get("/", async (c) => {
const html = `
<html>
<head>
<title>Hono/JSX Example</title>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<div class="py-2 px-4" x-data="formData()">
<h1 class="text-4xl font-bold mt-2 mb-4">Welcome to the Hono/JSX/Alpine 🏔️🏔️ Example!</h1>
<button @click="createNewCharacter" class="bg-green-500 text-white rounded-md px-4 py-2 mb-4">Create New Character</button>
yawnxyz-nighthawkschat.web.val.run
Updated: May 31, 2024