stevensDemosendDailyBrief.ts8 matches
9798export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
99// Get API keys from environment
100const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
101const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
102106}
107108if (!apiKey) {
109console.error("Anthropic API key is not configured.");
110return;
111}
122123// Initialize Anthropic client
124const anthropic = new Anthropic({ apiKey });
125126// Initialize Telegram bot
162163// disabled title for now, it seemes unnecessary...
164// await bot.api.sendMessage(chatId, `*${title}*`, { parse_mode: "Markdown" });
165166// Then send the main content
169170if (content.length <= MAX_LENGTH) {
171await bot.api.sendMessage(chatId, content, { parse_mode: "Markdown" });
172// Store the briefing in chat history
173await storeChatMessage(
198// Send each chunk as a separate message and store in chat history
199for (const chunk of chunks) {
200await bot.api.sendMessage(chatId, chunk, { parse_mode: "Markdown" });
201// Store each chunk in chat history
202await storeChatMessage(
survivor-trackerApp.tsx1 match
15const checkSetup = async () => {
16try {
17const response = await fetch("/api/setup/status");
18const data = await response.json();
19setIsSetup(data.isSetup);
survivor-trackerapi.ts18 matches
75});
7677// API endpoints
78// --- Setup ---
79app.get("/api/setup/status", async (c) => {
80const status = await getPersonalStatus();
81return c.json({ isSetup: !!status });
82});
8384app.post("/api/setup", async (c) => {
85try {
86const body = await c.req.json();
9495// --- Tracks ---
96app.get("/api/tracks", async (c) => {
97try {
98const tracks = await getAllTrackStatuses();
104});
105106app.get("/api/tracks/:id", async (c) => {
107try {
108const trackId = parseInt(c.req.param("id"));
118});
119120app.post("/api/tracks/:id", async (c) => {
121try {
122const trackId = parseInt(c.req.param("id"));
134135// --- Tasks ---
136app.get("/api/tasks/today", async (c) => {
137try {
138const today = getCurrentDay();
145});
146147app.get("/api/tasks/week/:week", async (c) => {
148try {
149const week = parseInt(c.req.param("week"));
156});
157158app.get("/api/tasks/track/:trackId", async (c) => {
159try {
160const trackId = parseInt(c.req.param("trackId"));
167});
168169app.post("/api/tasks/:id/status", async (c) => {
170try {
171const taskId = c.req.param("id");
185186// --- Daily Logs ---
187app.post("/api/daily-logs", async (c) => {
188try {
189const body = await c.req.json();
222});
223224app.get("/api/daily-logs/today", async (c) => {
225try {
226const today = formatDate(new Date());
233});
234235app.get("/api/daily-logs/track/:trackId", async (c) => {
236try {
237const trackId = parseInt(c.req.param("trackId"));
245246// --- Weekly Reviews ---
247app.get("/api/weekly-reviews/current", async (c) => {
248try {
249const currentWeek = getCurrentWeek();
256});
257258app.post("/api/weekly-reviews/generate", async (c) => {
259try {
260// Get all tracks
309310// --- Guidance ---
311app.get("/api/guidance/track/:trackId", async (c) => {
312try {
313const trackId = parseInt(c.req.param("trackId"));
338});
339340app.post("/api/guidance/quick", async (c) => {
341try {
342const body = await c.req.json();
362363// --- Resources ---
364app.get("/api/resources/survival-plan", async (c) => {
365try {
366const survivalPlan = await readFile("/backend/resources/survivalPlan.md", import.meta.url);
survivor-trackerDashboard.tsx3 matches
41// Fetch tracks and today's tasks in parallel
42const [tracksRes, tasksRes] = await Promise.all([
43fetch("/api/tracks"),
44fetch("/api/tasks/today")
45]);
46
71const handleTaskStatusChange = async (taskId: string, newStatus: Task['status']) => {
72try {
73const response = await fetch(`/api/tasks/${taskId}/status`, {
74method: "POST",
75headers: {
35
36try {
37const response = await fetch("/api/setup", {
38method: "POST",
39headers: {
survivor-trackerREADME.md1 match
49β β βββ survivalPlan.md # 21-day survival plan content
50β β βββ trackPrompts.md # Track-specific prompts
51β βββ api.ts # API endpoints
52β βββ index.ts # Main entry point
53βββ frontend/
vt-bloglive-reload.ts1 match
82// if we wanted to create a /lastUpdatedAt route,
83// which would let us pass a val town bearer token, we could do that here
84// gives us 10k API requests per minute instead of 1k
85// and would work with private projects
86
vt-blogget-old-posts.ts25 matches
19export const oldPosts: BlogPost[] = [
20{
21"title": "Solving the internal / external API riddle",
22"slug": "api-conundrum",
23"link": "/blog/api-conundrum",
24"description": "Figuring out how to provide an API that's usable by everyone and fast for us to iterate on",
25"pubDate": "Thu, 27 Mar 2025 00:00:00 GMT",
26"author": "Tom MacWright",
27},
28{
29"title": "API Tokens Scopes",
30"slug": "api-token-scopes",
31"link": "/blog/api-token-scopes",
32"description": "Improving security with granular control over permissions",
33"pubDate": "Fri, 01 Nov 2024 00:00:00 GMT",
59},
60{
61"title": "Expanding the Vals API - RFC",
62"slug": "expanding-the-vals-api-rfc",
63"link": "/blog/expanding-the-vals-api-rfc",
64"description": "Our REST API lets you do a lot - and soon it will enable more",
65"pubDate": "Fri, 30 Jun 2023 00:00:00 GMT",
66"author": "AndrΓ© Terron",
133},
134{
135"title": "The perks of a good OpenAPI spec",
136"slug": "openapi",
137"link": "/blog/openapi",
138"description": "Taking advantage of our typed REST API to build a platform around\nVal Town.",
139"pubDate": "Thu, 25 Jul 2024 00:00:00 GMT",
140"author": "Tom MacWright",
262},
263{
264"title": "The API we forgot to name",
265"slug": "the-api-we-forgot-to-name",
266"link": "/blog/the-api-we-forgot-to-name",
267"description": "An API that takes a Request and returns a Response - what was that, again?",
268"pubDate": "Thu, 19 Oct 2023 00:00:00 GMT",
269"author": "Steve Krouse",
286},
287{
288"title": "Deprecating the Run API",
289"slug": "deprecating-the-run-api",
290"link": "/blog/deprecating-the-run-api",
291"description": "Not every function should be an API",
292"pubDate": "Wed, 07 Feb 2024 00:00:00 GMT",
293"author": "AndrΓ© Terron",
321"slug": "val-town-newsletter-1",
322"link": "/blog/val-town-newsletter-1",
323"description": "Programmatic notifications, Hacker News API, and more.",
324"pubDate": "Wed, 04 Jan 2023 00:00:00 GMT",
325"author": "Steve Krouse",
450"slug": "val-town-newsletter-22",
451"link": "/blog/val-town-newsletter-22",
452"description": "Townie upgrades, Scoped API permissions, Fal partnership",
453"pubDate": "Mon, 02 Dec 2024 00:00:00 GMT",
454"author": "Steve Krouse",
83We didn't. We left them where they are, and proxy to them.
8485Writing a proxy in Val Town (or any functions platform with the ['fetch handler' interface](https://blog.val.town/blog/the-api-we-forgot-to-name/)) is a delight:
8687```ts
FarcasterGalleryimage.tsx3 matches
8485const loadEmoji = (code) => {
86// const api = `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${code.toLowerCase()}.svg`
87const api = `https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${code.toLowerCase()}_color.svg`;
88return fetch(api).then((r) => r.text());
89};
90