Gardenonadmin.html4 matches
241
242// Fetch database info
243async function fetchDatabaseInfo() {
244try {
245const response = await fetch('/api/admin/db');
257
258// Render database info
259function renderDatabaseInfo() {
260if (!dbData) return;
261
299
300// Render a single table
301function renderTable(tableData, elements) {
302if (!tableData) return;
303
368
369// Toggle between table and JSON view
370function toggleView() {
371isJsonView = !isJsonView;
372
thirdTimerutils.ts2 matches
4* @returns {string} Formatted time string
5*/
6export function formatTime(seconds: number): string {
7const hours = Math.floor(seconds / 3600);
8const minutes = Math.floor((seconds % 3600) / 60);
24* @returns {string} Formatted duration string (e.g., "30s", "5m", "2h 30m")
25*/
26export function formatMinutes(minutes: number): string {
27if (minutes < 1) return `${Math.round(minutes * 60)}s`;
28if (minutes < 60) return `${Math.round(minutes)}m`;
thirdTimerTimerDisplay.tsx1 match
16}
1718export function TimerDisplay({
19state,
20currentSessionTime,
openHeartProtocolmain.tsx6 matches
57};
5859export default async function fetch(request: Request) {
60console.log(`Received ${request.method} request to ${request.url}`);
61if (request.method === "GET") {
70}
7172function error(text: string, code = 400) {
73console.log(`Error response: ${text} (${code})`);
74return new Response(text, { status: code });
75}
7677async function handleGet(request: Request) {
78console.log("Handling GET request");
79const [domain, ...uidParts] = url(request).pathname.slice(1).split("/");
105}
106107function url(request: Request) {
108return new URL(request.url);
109}
110111async function handlePost(request: Request) {
112console.log("Handling POST request");
113const urlObject = url(request);
146}
147148function ensureEmoji(emoji: string) {
149const segments = Array.from(new Intl.Segmenter("en", { granularity: "grapheme" }).segment(emoji.trim()));
150const parsedEmoji: string | null = segments.length > 0 ? segments[0].segment : null;
openHeartProtocolPOST.tsx1 match
1// Send an emoji
23export default async function post() {
4const urls = [
5"https://openheart.val.run/charmaineklee.com/OpenHeart",
146};
147148async function extractPdfTextNative(
149data: ArrayBuffer,
150fileName: string,
173}
174175async function callOpenAI(
176openaiInstance: OpenAI,
177systemPrompt: string,
231}
232233async function ingestDocumentForSuggestion(
234input: { documentFile?: File; clientInputSourceDescription: string },
235log: LogEntry[],
257}
258259function generateHtmlShell(initialQuery: string, sourceUrl: string) {
260const escapedQuery = initialQuery.replace(/</g, "<").replace(/>/g, ">");
261return `
286.hamburger-box { width: 30px; height: 22px; display: inline-block; position: relative; }
287.hamburger-inner { display: block; top: 50%; margin-top: -1px; }
288.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after { width: 30px; height: 2px; background-color: #ecf0f1; border-radius: 4px; position: absolute; transition-property: transform; transition-duration: 0.15s; transition-timing-function: ease; }
289.hamburger-inner::before, .hamburger-inner::after { content: ""; display: block; }
290.hamburger-inner::before { top: -8px; }
404</div>
405<script>
406(function() {
407const MAX_SUGGESTION_SELECTIONS = 15;
408445});
446447function navigateToView(viewId, params = {}) {
448currentView = viewId;
449for (const key in views) { views[key].classList.remove('active-view'); }
468}
469470function setupEventListeners() {
471hamburgerToggle.addEventListener('click', () => {
472const isExpanded = sidebar.classList.contains('expanded-mobile') || !sidebar.classList.contains('collapsed');
519}
520521function generateId() { return Date.now().toString(36) + Math.random().toString(36).substring(2); }
522function escapeHtml(unsafe) {
523if (unsafe === null || typeof unsafe === 'undefined') return '';
524return String(unsafe).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
525}
526527function renderDashboard() {
528views.dashboard.innerHTML = \`
529<h1>Dashboard</h1>
541ni_saveAnalysisButton, ni_taskSelectionInfo, ni_resultsSection;
542543function renderNewInquiryView(params = {}) {
544views['new-inquiry'].innerHTML = \`
545<h1>New Inquiry - IDDAE Workflow</h1>
640}
641642function iddae_setUIPhase(phase) {
643iddae_currentPhase = phase;
644ni_submitButton.classList.remove('loading');
677}
678679async function ni_handleIDDAESubmit(event) {
680event.preventDefault();
681ni_clearStatusMessages();
691}
692
693async function iddae_handleUploadAndSuggestTasks() {
694const file = ni_fileInput.files[0];
695if (!file) {
754}
755756async function iddae_handleFinalAnalysis() {
757const legalTaskQuery = ni_customLegalTaskQueryInput.value.trim();
758if (!legalTaskQuery) {
809}
810811function ni_addStatusMessage(message, type = 'info') {
812const entry = document.createElement('div');
813entry.className = \`status-entry \${type}\`;
817}
818819function ni_clearStatusMessages() {
820if(ni_statusContainer) ni_statusContainer.innerHTML = '';
821}
822823function ni_populateSuggestedTasks(groupedSuggestions = {}) {
824ni_suggestedTasksListDiv.innerHTML = '';
825updateTaskSelectionInfo();
892}
893894function handleGroupCheckboxChange(event) {
895const groupCheckbox = event.target;
896const category = groupCheckbox.dataset.category;
924}
925
926function updateCustomQueryFromSuggestions() {
927const selectedTasks = [];
928const taskCheckboxes = ni_suggestedTasksListDiv.querySelectorAll('input[type="checkbox"]:checked:not([id^="group-"])');
959}
960
961function updateTaskSelectionInfo(count) {
962if (typeof count === 'undefined') {
963count = ni_suggestedTasksListDiv.querySelectorAll('input[type="checkbox"]:checked:not([id^="group-"])').length;
968}
969970function ni_renderStructuredResults(data) {
971if (!data || !data.request_details) {
972ni_structuredResultsContainer.innerHTML = '<p>No valid analysis data to display.</p>';
1019}
10201021function renderHistoryView() {
1022views.history.innerHTML = \`
1023<h1>History</h1>
1033}
10341035function renderDocumentDetailView(docId) {
1036views['document-detail'].innerHTML = \`
1037<h1>Document Details</h1>
1043}
10441045function renderAnalysisDetailView(analysisId) {
1046views['analysis-detail'].innerHTML = \`
1047<h1>Analysis Details</h1>
1053}
1054
1055function renderSettingsView() {
1056views.settings.innerHTML = \`
1057<h1>Settings</h1>
1084}
10851086export default async function(req: Request) {
1087const openai = new OpenAI();
1088const url = new URL(req.url);
1275}
12761277async function runAnalysisWithProvidedText(
1278analysisInput: { legalTaskQuery: string; documentText: string; inputSourceDescription: string },
1279log: LogEntry[],
cronSiteMonitormain.tsx5 matches
36const NOTIFICATION_COOLDOWN_MS = 30 * 60 * 1000; // 30 minutes between notifications for same site
3738async function checkSite(url: string): Promise<SiteStatus> {
39const startTime = Date.now();
40const timestamp = new Date().toISOString();
96}
9798async function getSiteHistory(): Promise<Record<string, SiteHistory>> {
99try {
100return await blob.getJSON("uptime_history") || {};
104}
105106async function updateSiteHistory(history: Record<string, SiteHistory>) {
107await blob.setJSON("uptime_history", history);
108}
109110function shouldNotify(siteHistory: SiteHistory, currentStatus: SiteStatus): boolean {
111// Don't notify if site is up
112if (currentStatus.status === "up") return false;
125}
126127export default async function monitor() {
128console.log(`🔍 Starting uptime check for ${SITES_TO_MONITOR.length} sites...`);
129
pt-sandboxmain.ts2 matches
13};
1415function addWaterBodiesToMap(map: TownMap): TownMap {
16// Create a deep copy of the input map
17const newMap = map.map((row) => [...row]);
62}
6364function townMapGenerator({
65width = defaultMapSize.width,
66height = defaultMapSize.height,
prayaasnewgenaistarter-prompts.js2 matches
4"title": "Todo App",
5"code":
6"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Task Master</title>\n <link href=\"https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css\" rel=\"stylesheet\">\n</head>\n<body class=\"bg-gray-100\">\n <div class=\"max-w-md mx-auto mt-12 p-6 rounded-lg shadow-md bg-white\">\n <div class=\"flex justify-between items-center mb-6\">\n <h2 class=\"text-2xl font-bold\">Task Master</h2>\n <span class=\"text-gray-600\">Manage your tasks efficiently</span>\n </div>\n <ul class=\"todo-list\" id=\"todo-list\"></ul>\n <div class=\"add-todo mt-6 flex justify-between items-center\">\n <input type=\"text\" id=\"todo-input\" placeholder=\"Add new task\" class=\"w-full py-2 pl-10 text-sm text-gray-800 border border-gray-400 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-600 bg-gray-50\">\n <button type=\"button\" id=\"add-todo-btn\" class=\"ml-4 px-4 py-2 bg-green-500 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-green-700 hover:shadow-lg focus:bg-green-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-green-800 active:shadow-lg transition duration-150 ease-in-out\">Add Task</button>\n </div>\n <div class=\"mt-6 text-center text-gray-600\">\n Built on <a href=\"https://cerebrascoder.com\" target=\"_blank\" class=\"text-gray-900 underline\">Cerebras Coder</a>\n </div>\n </div>\n\n <script>\n // Get the todo list and add todo button elements\n const todoList = document.getElementById('todo-list');\n const addTodoBtn = document.getElementById('add-todo-btn');\n const todoInput = document.getElementById('todo-input');\n\n // Load todos from local storage\n let todos = JSON.parse(localStorage.getItem('todos')) || [];\n\n // Function to render the todo list\n function renderTodoList() {\n todoList.innerHTML = '';\n todos.forEach((todo, index) => {\n const todoItem = document.createElement('li');\n todoItem.innerHTML = `\n <div class=\"flex justify-between items-center py-4 border-b border-gray-300\">\n <div class=\"flex items-center\">\n <input type=\"checkbox\" id=\"todo-${index}\" class=\"mr-4\" ${todo.completed ? 'checked' : ''}>\n <span class=\"todo-text ${todo.completed ? 'text-gray-400 line-through' : 'text-gray-600'}\">${todo.text}</span>\n </div>\n <button type=\"button\" class=\"px-4 py-2 bg-red-500 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-red-700 hover:shadow-lg focus:bg-red-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-red-800 active:shadow-lg transition duration-150 ease-in-out delete-todo\" data-index=\"${index}\">Delete</button>\n </div>\n `;\n todoList.appendChild(todoItem);\n });\n }\n\n // Render the initial todo list\n renderTodoList();\n\n // Add event listener to the add todo button\n addTodoBtn.addEventListener('click', () => {\n const todoText = todoInput.value.trim();\n if (todoText) {\n todos.push({ text: todoText, completed: false });\n localStorage.setItem('todos', JSON.stringify(todos));\n todoInput.value = '';\n renderTodoList();\n }\n });\n\n // Add event listener to the todo list\n todoList.addEventListener('change', (e) => {\n if (e.target.type === 'checkbox') {\n const index = parseInt(e.target.id.split('-')[1]);\n todos[index].completed = e.target.checked;\n localStorage.setItem('todos', JSON.stringify(todos));\n renderTodoList();\n }\n });\n\n // Add event listener to the delete todo buttons\n todoList.addEventListener('click', (e) => {\n if (e.target.classList.contains('delete-todo')) {\n const index = parseInt(e.target.dataset.index);\n todos.splice(index, 1);\n localStorage.setItem('todos', JSON.stringify(todos));\n renderTodoList();\n }\n });\n </script>\n</body>\n</html>",
7"performance": {
8"tokensPerSecond": 2298.56,
26"title": "Markdown Editor",
27"code":
28"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Markdown Editor</title>\n <link href=\"https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css\" rel=\"stylesheet\">\n</head>\n<body class=\"bg-white\">\n <div class=\"max-w-full mx-auto p-4 pt-6 md:p-6 lg:p-8\">\n <h1 class=\"text-3xl text-center mb-4\">Markdown Editor</h1>\n <div class=\"flex flex-row\">\n <div class=\"editor p-4 rounded-lg border border-gray-200 w-full md:w-1/2\">\n <textarea id=\"editor\" class=\"w-full h-screen p-2 border border-gray-200 rounded-lg\" placeholder=\"Type your Markdown here...\"></textarea>\n </div>\n <div class=\"preview p-4 rounded-lg border border-gray-200 w-full md:w-1/2 ml-2 md:ml-4 lg:ml-8\">\n <div id=\"preview\"></div>\n </div>\n </div>\n <p class=\"text-center mt-4\">Built on <a href=\"https://cerebrascoder.com\">Cerebras Coder</a></p>\n </div>\n\n <script>\n const editor = document.getElementById('editor');\n const preview = document.getElementById('preview');\n\n // Initialize textarea with default markdown\n const defaultMarkdown = `\n# Introduction to Markdown\nMarkdown is a lightweight markup language that is easy to read and write. It is often used for formatting text in plain text editors, chat applications, and even web pages.\n\n## Headers\nHeaders are denoted by the # symbol followed by a space. The number of # symbols determines the level of the header:\n# Heading 1\n## Heading 2\n### Heading 3\n\n## Emphasis\nYou can use emphasis to make your text **bold** or *italic*:\n*Italics*\n**Bold**\n\n## Lists\nYou can use lists to organize your text:\n* Item 1\n* Item 2\n* Item 3\nOr\n1. Item 1\n2. Item 2\n3. Item 3\n\n## Links\nYou can use links to reference external resources:\n[Google](https://www.google.com)\n\n## Images\nYou can use images to add visual content:\n\n`;\n editor.value = defaultMarkdown;\n\n // Update preview on input\n editor.addEventListener('input', () => {\n const markdown = editor.value;\n const html = markdownToHtml(markdown);\n preview.innerHTML = html;\n });\n\n // Initialize preview with default markdown\n const defaultHtml = markdownToHtml(defaultMarkdown);\n preview.innerHTML = defaultHtml;\n\n // Function to convert Markdown to HTML\n function markdownToHtml(markdown) {\n // Bold\n markdown = markdown.replace(/\\*\\*(.*?)\\*\\*/g, '<b>$1</b>');\n\n // Italic\n markdown = markdown.replace(/\\*(.*?)\\*/g, '<i>$1</i>');\n\n // Links\n markdown = markdown.replace(/\\[(.*?)\\]\\((.*?)\\)/g, '<a href=\"$2\">$1</a>');\n\n // Images\n markdown = markdown.replace(/!\\[(.*?)\\]\\((.*?)\\)/g, '<img src=\"$2\" alt=\"$1\">');\n\n // Headings\n markdown = markdown.replace(/(^#{1,6} )(.*)/gm, (match, level, text) => {\n return `<h${level.length}>${text}</h${level.length}>`;\n });\n\n // Lists\n markdown = markdown.replace(/^(\\*|\\d+\\.) (.*)/gm, (match, marker, text) => {\n if (marker.startsWith('*')) {\n return `<li>${text}</li>`;\n } else {\n return `<li>${text}</li>`;\n }\n });\n\n // Line breaks\n markdown = markdown.replace(/\\n/g, '<br>');\n\n // Fix for nested lists\n markdown = markdown.replace(/<li><li>/g, '<li>');\n markdown = markdown.replace(/<\\/li><\\/li>/g, '</li>');\n\n // Wrap lists in ul\n markdown = markdown.replace(/(<li>.*<\\/li>)/g, '<ul>$1</ul>');\n\n return markdown;\n }\n </script>\n</body>\n</html>",
29"performance": {
30"tokensPerSecond": 4092.96,
prayaasnewgenaiqueries.ts5 matches
2import { ITERATIONS_TABLE, KEY, PROJECTS_TABLE, SCHEMA_VERSION } from "./migrations.ts";
34export async function createProject(prompt: string) {
5const projectResult = await sqlite.execute(
6`INSERT INTO ${PROJECTS_TABLE} (initial_prompt) VALUES (?)`,
11}
1213export async function getNextVersionNumber(projectId: number) {
14const data = await sqlite.execute(
15`SELECT version_number FROM ${ITERATIONS_TABLE}
21}
2223export async function insertVersion(projectId: number, versionNumber: number, prompt: string, code: string) {
24await sqlite.execute(
25`INSERT INTO ${ITERATIONS_TABLE}
29}
3031export async function getCodeInner(table: string, project: string, version?: string) {
32let data;
33if (version === undefined) {
50}
5152export async function getCode(project: string, version?: string) {
53// try to get code in the new table partition first
54const code = await getCodeInner(ITERATIONS_TABLE, project, version);