88};
89
90function App() {
91 const canvasRef = useRef(null);
92 const [isLoaded, setIsLoaded] = useState(false);
168 const mouse = new THREE.Vector2();
169
170 function onMouseMove(event) {
171 mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
172 mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
187 window.addEventListener("mousemove", onMouseMove, false);
188
189 function animate(time) {
190 requestAnimationFrame(animate);
191
252}
253
254function client() {
255 console.log("Client function called");
256 const root = document.getElementById("root");
257 if (root) {
264
265if (typeof document !== "undefined") {
266 console.log("Document is defined, calling client function");
267 client();
268}
269
270export default async function server(request: Request): Promise<Response> {
271 console.log("Server function called");
272 return new Response(
273 `
37};
38
39function App() {
40 const canvasRef = useRef(null);
41 const [renderer, setRenderer] = useState(null);
214 setOutput(''); // Clear previous output
215 try {
216 const safeEval = new Function('chs', 'data', 'setData', 'addChunkToScene', 'addModelToScene', `
217 ${code}
218 return { data, output: console.log };
321}
322
323function client() {
324 createRoot(document.getElementById("root")).render(<App />);
325}
327if (typeof document !== "undefined") { client(); }
328
329export default async function server(request: Request): Promise<Response> {
330 return new Response(`
331 <html>
1import process from "node:process";
2
3export async function getModelBuilder(spec: {
4 type?: "llm" | "chat" | "embedding";
5 provider?: "openai" | "huggingface";
65 ],
66 ]);
67 // Return function to prevent "Serialization Error"
68 return () => setup(spec);
69}
1import process from "node:process";
2
3export async function getModelBuilder(spec: {
4 type?: "llm" | "chat" | "embedding";
5 provider?: "openai" | "huggingface";
65 ],
66 ]);
67 // Return function to prevent "Serialization Error"
68 return () => setup(spec);
69}
48```
49
50You can allow anyone to signup by returning a boolean from the verifyEmail function:
51
52```ts
4import { deleteCookie, getCookies, setCookie } from "jsr:@std/http/cookie";
5
6async function createSession(email: string, hostname: string) {
7 const sessionID = crypto.randomUUID();
8 const expiresAt = new Date();
24}
25
26async function getSession(sessionID: string, hostname: string) {
27 try {
28 const res = await sqlite.execute({
50}
51
52async function deleteSession(sessionID: string) {
53 await sqlite.execute({
54 sql: `DELETE FROM lastlogin_session WHERE sessionID=?`,
65};
66
67export function lastlogin(
68 handler: (req: Request) => Response | Promise<Response>,
69 options: LastLoginOptions,
23];
24
25export default async function server(request: Request): Promise<Response> {
26 // Enable CORS for Framer
27 const headers = new Headers({
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 return (
7 <div className="container">
25}
26
27function client() {
28 createRoot(document.getElementById("root")).render(<App />);
29}
33}
34
35export default async function server(request: Request): Promise<Response> {
36 return new Response(
37 `
1export default async function server(request: Request): Promise<Response> {
2 const url = new URL(request.url);
3 const a = Number(url.searchParams.get('a'));
1export default async function server(request: Request): Promise<Response> {
2 // Check if the request method is GET
3 if (request.method === 'GET') {
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.