cerebras_coder_archivedindex2 matches
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
45async function servePublicFile(path: string): Promise<Response> {
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
task_managermain.tsx4 matches
14}
1516// DatabaseContent component
17function DatabaseContent({ data }: { data: Action[] }) {
18return (
19<pre className="bg-white dark:bg-gray-800 p-4 rounded-lg shadow-md overflow-auto dark:text-white border border-gray-200 dark:border-gray-700">{JSON.stringify(data, null, 2)}</pre>
219className="bg-green-500 hover:bg-green-600 text-white font-medium py-2 px-4 rounded-md mb-4 transition duration-200 dark:bg-green-600 dark:hover:bg-green-700"
220>
221{showDbContent ? 'Hide' : 'Show'} Database Content
222</button>
223{showDbContent && (
224<div className="mt-4">
225<DatabaseContent data={dbContent} />
226</div>
227)}
VOTelCollectormain.tsx9 matches
17} from "https://esm.sh/@opentelemetry/otlp-transformer@0.55.0";
18import { and, desc, relations, sql } from "https://esm.sh/drizzle-orm@0.39.3";
19import { drizzle, type LibSQLDatabase } from "https://esm.sh/drizzle-orm@0.39.3/libsql";
20import { integer, sqliteTable, text } from "https://esm.sh/drizzle-orm@0.39.3/sqlite-core";
21import { Hono } from "https://esm.sh/hono@4.7.0";
2526/******************************************************************
27* Database and Drizzle setup
28* ****************************************************************/
2939// (remember to remove "IF NOT EXISTS")
40// https://docs.val.town/std/sqlite/migrations/
41const migrateDatabase = async () => {
42await sqlite.execute(`
43CREATE TABLE IF NOT EXISTS \`otel_spans\` (
49};
5051// HACK - Migrate database on startup
52await migrateDatabase();
5354/******************************************************************
61};
62Variables: {
63db: LibSQLDatabase<typeof schema>;
64};
65};
6869/**
70* Middleware for setting up the database
71* and storing it on the Hono app's context
72*/
335"value": {
336"stringValue":
337"{\"OPENAI_API_KEY\":\"sk-proj-uoRQ71Oaz16IbDJRJXY5T3BlbkFJgqSSf3Xglg0V0V2FhFrO\",\"ANTHROPIC_API_KEY\":\"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\",\"DATABASE_URL\":\"postgresql://neondb_owner:XaenL6g5WApI@ep-proud-grass-a5r8g74c.us-east-2.aws.neon.tech/neondb?sslmode=require\",\"FPX_ENDPOINT\":\"http://localhost:8788/v1/traces\",\"FPX_LOG_LEVEL\":\"debug\",\"GOOSE_AVATARS\":{}}",
338},
339},
785"key": "fpx.http.request.env",
786"value": {
787"stringValue": "{\"OPENAI_API_KEY\":\"sk-proj-uoRQ71Oaz16IbDJRJXY5T3BlbkFJgqSSf3Xglg0V0V2FhFrO\",\"ANTHROPIC_API_KEY\":\"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\",\"DATABASE_URL\":\"postgresql://neondb_owner:XaenL6g5WApI@ep-proud-grass-a5r8g74c.us-east-2.aws.neon.tech/neondb?sslmode=require\",\"FPX_ENDPOINT\":\"http://localhost:8788/v1/traces\",\"FPX_LOG_LEVEL\":\"debug\",\"GOOSE_AVATARS\":{}}"
788}
789},
bitcoinMinerAppmain.tsx2 matches
2324useEffect(() => {
25const initializeDatabase = async () => {
26const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
27const KEY = "bitcoinMinerApp";
4647const miningInterval = setInterval(mine, 60000); // Guaranteed 1 ETH per minute
48initializeDatabase();
4950return () => clearInterval(miningInterval);
AlwaysHeremain.tsx1 match
447448// Here you could implement additional logic like:
449// - Saving conversation to a database
450// - Sending conversation via email
451// - Generating a summary
InstantQueryApp1 match
25const query = JSON.parse(results!);
2627// In a real application, you would use the query to fetch data from the database
28// For this example, we'll just return the query itself
29return new Response(JSON.stringify({ query, results: "Sample results would go here" }), {
InstantQuerygetSystemPrompt4 matches
1function getSystemPrompt(schema: string) {
2return `You have access to an instantdb database. When people ask for info you will provide it for
3them by creating an instantdb query for the server to query the database. Return the query param json string only -- the json object that query is assigned to.
4--------------------------------------------------------------------------
5Here is an example instantdb query (the examples use an unrelated database):
6
7Fetch namespace
555------------------------------------------------
556
557Here is the schema of the instantdb database:
558
559${schema}
554"🌹 Your love needs more passion! Whisper 'I love you' to the screen and try again. 😘",
555"😱 API fell in love with your request and froze! Try again soon. 💘",
556"✨ Oops! The romance overload broke our database. Give it a sec. ⏳",
557];
558
1import { blob } from "https://esm.town/v/std/blob";
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3import { DATABASE_TABLENAME } from "./constants";
45// export async function getImages(type: string, count: number): Promise<string[]> {
8// `
9// SELECT path
10// FROM ${DATABASE_TABLENAME}
11// WHERE type = ?
12// ORDER BY RANDOM()
3233for (const [type, count] of Object.entries(typeCountMap)) {
34const query = `SELECT '${type}' as type, path FROM ${DATABASE_TABLENAME} WHERE type = ? ORDER BY RANDOM() LIMIT ?`;
35const result = await sqlite.execute(query, [type, count]);
36results.push(...result.rows);