128
129 <script>
130 async function testPlant() {
131 const plantName = document.getElementById('plantInput').value.trim();
132 const responseContent = document.getElementById('responseContent');
177
178 // Copy URL to clipboard
179 function copyUrl() {
180 const urlText = document.getElementById('urlDisplay').textContent;
181 navigator.clipboard.writeText(urlText).then(() => {
34
35 <script>
36 async function loadData() {
37 try {
38 const response = await fetch('/admin/cache/full');
66 }
67
68 async function clearCache() {
69 if (!confirm('Are you sure you want to clear all cached data? This action cannot be undone.')) {
70 return;
15 * @returns {Promise<any>} Das gespeicherte Kleidungsstück-Objekt.
16 */
17export async function addWardrobeItem(imageUrl: string, description: string) {
18 if (!imageUrl || !description || description.trim() === "") {
19 throw new Error("imageUrl und description sind erforderlich.");
43 * @returns {Promise<Array<any>>} Eine Liste von Kleidungsstück-Objekten.
44 */
45export async function getWardrobe() {
46 // Ruft alle Schlüssel (IDs) ab, die zum Benutzer gehören.
47 const userWardrobeKeys = (await db.get(`user_wardrobe_keys:${USER_ID}`)) || [];
62// Dies ist der HTTP-Endpunkt deiner Val. Val Town stellt diese Funktion über eine URL bereit.
63// Sie reagiert auf POST-Anfragen (zum Hinzufügen von Items) und GET-Anfragen (zum Abrufen von Items).
64export default async function(req: Request): Promise<Response> {
65 if (req.method === "POST") {
66 try {
1export default async function(req: Request): Promise<Response> {
2 if (req.method !== "POST") {
3 return new Response("Only POST allowed", { status: 405 });
66}
67
68async function sendTwilioMessage(to: string, body: string) {
69 const res = await fetch(
70 `https://api.twilio.com/2010-04-01/Accounts/${Deno.env.get("TWILIO_ACCOUNT_SID")}/Messages.json`,
1
2export default async function(req) {
3 return new Response(`undefined`, {
4 headers: { 'Content-Type': 'text/html' }
1
2export default async function(req) {
3 return new Response(`undefined`, {
4 headers: { 'Content-Type': 'text/html' }
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [clicked, setClicked] = useState(0);
6 return (
1
2export default async function(req) {
3 return new Response(`undefined`, {
4 headers: { 'Content-Type': 'text/html' }
1
2export default async function(req) {
3 return new Response(`undefined`, {
4 headers: { 'Content-Type': 'text/html' }
9// PDF parsing is now handled by unpdf library
10
11// Function to validate and clean recipe data
12function validateAndCleanRecipe(recipe: any): Recipe {
13 // Ensure required fields exist
14 if (!recipe.title || typeof recipe.title !== "string") {
75}
76
77// Function to convert fractional Unicode characters to decimal values
78function convertFractionsToDecimals(text: string): string {
79 const fractionMap: { [key: string]: string } = {
80 "¼": "0.25",
Simple functional CSS library for Val Town
A helper function to build a file's email
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.