1export default function stripFences(content: string) {
2 return content.replace(/```[\s\S]*?\n([\s\S]*?)\n```/g, "$1");
3}
54 // Initialize Monaco Editor without RequireJS
55 window.require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.51.0/min/vs' } });
56 window.require(['vs/editor/editor.main'], function () {
57 // Define a custom Monokai Light theme
58 monaco.editor.defineTheme('monokai-light', {
66 { token: 'number', foreground: 'ae81ff' },
67 { token: 'type', foreground: '66d9ef' }, // Lightened blue
68 { token: 'function', foreground: 'a6e22e' }, // Lightened green
69 ],
70 colors: {
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [details, setDetails] = useState("");
7 const [isLoading, setIsLoading] = useState(false);
40}
41
42function client() {
43 createRoot(document.getElementById("root")).render(<App />);
44}
48}
49
50export default async function server(request: Request): Promise<Response> {
51 return new Response(
52 `
1export default async function (req: Request): Promise<Response> {
2 const headers = req.headers;
3 const url = new URL(req.url);
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [systemMessage, setSystemMessage] = useState("You are a helpful assistant");
7 const [userMessage, setUserMessage] = useState("");
73}
74
75function client() {
76 createRoot(document.getElementById("root")).render(<App />);
77}
81}
82
83export default async function server(request: Request): Promise<Response> {
84 return new Response(
85 `
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function (req: Request): Promise<Response> {
4 if (req.method !== "POST") {
5 return new Response("Method Not Allowed", { status: 405 });
1import { email } from "https://esm.town/v/std/email";
2
3async function getWeather() {
4 const response = await fetch(
5 "https://api.open-meteo.com/v1/forecast?latitude=48.7758&longitude=9.1829¤t=temperature_2m,weathercode&daily=weathercode,temperature_2m_max,temperature_2m_min&timezone=Europe%2FBerlin"
8}
9
10function getWeatherDescription(weathercode: number) {
11 const weatherCodes: { [key: number]: string } = {
12 0: "Clear sky",
30}
31
32export default async function (interval: Interval) {
33 const now = new Date();
34 const dayOfWeek = now.getDay();
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function (req: Request): Promise<Response> {
4 // Check if the request method is POST
5 if (req.method !== "POST") {
4import { email } from "https://esm.town/v/std/email";
5
6function App() {
7 const [subject, setSubject] = useState("");
8 const [message, setMessage] = useState("");
67}
68
69function client() {
70 createRoot(document.getElementById("root")).render(<App />);
71}
73if (typeof document !== "undefined") { client(); }
74
75export default async function server(request: Request): Promise<Response> {
76 if (request.method === "POST" && new URL(request.url).pathname === "/send-email") {
77 const { subject, message } = await request.json();
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const initialFormData = useMemo(() => ({
7 textInput: '',
193}
194
195function client() {
196 const root = document.getElementById("root");
197 if (root) {
204}
205
206export default async function server(request: Request): Promise<Response> {
207 return new Response(
208 `
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",