Back

Version 130

11/22/2024
import { OpenAI } from "https://esm.town/v/std/openai?v=5"
import { sqlite } from "https://esm.town/v/std/sqlite?v=6"
import { Chess } from "npm:chess.js"
import { Hono } from "npm:hono"

// sqlite.execute(`
// DROP TABLE chess_messages;
// `)

sqlite.execute(`
CREATE TABLE IF NOT EXISTS chess_moves (
id INTEGER PRIMARY KEY AUTOINCREMENT,
game_id TEXT NOT NULL,
move_san TEXT NOT NULL,
date DATETIME DEFAULT CURRENT_TIMESTAMP
)
`)

sqlite.execute(`
CREATE TABLE IF NOT EXISTS chess_messages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
game_id TEXT NOT NULL,
message TEXT NOT NULL,
date DATETIME DEFAULT CURRENT_TIMESTAMP
)
`)

const app = new Hono()

const script = (async () => {
const game_id = new URL(location.href).searchParams.get("id")

const { Chess } = await import("https://esm.sh/chess.js@1.0.0-beta.8")
const position = (await fetch(`/game/${game_id}`).then(r => r.json())).fen
const thinking = document.querySelector("#thinking")
thinking.className = "transition-opacity opacity-0"
tmcw-chatgptchess.web.val.run
Updated: November 22, 2024