10import { NotebookView } from "./NotebookView.tsx";
11
12const API_BASE = "/api/memories";
13const MEMORIES_PER_PAGE = 20; // Increased from 7 to 20 memories per page
14
90
91 // Fetch avatar image
92 fetch("/api/images/stevens.jpg")
93 .then((response) => {
94 if (response.ok) return response.blob();
104
105 // Fetch wood background
106 fetch("/api/images/wood.jpg")
107 .then((response) => {
108 if (response.ok) return response.blob();
133 setError(null);
134 try {
135 const response = await fetch(API_BASE);
136 if (!response.ok) {
137 throw new Error(`HTTP error! status: ${response.status}`);
176
177 try {
178 const response = await fetch(API_BASE, {
179 method: "POST",
180 headers: { "Content-Type": "application/json" },
199
200 try {
201 const response = await fetch(`${API_BASE}/${id}`, {
202 method: "DELETE",
203 });
231
232 try {
233 const response = await fetch(`${API_BASE}/${editingMemory.id}`, {
234 method: "PUT",
235 headers: { "Content-Type": "application/json" },
606 <div className="font-pixel text-[#f8f1e0]">
607 <style jsx>{`
608 @import url("https://fonts.googleapis.com/css2?family=Pixelify+Sans&display=swap");
609
610 @tailwind base;
7// Initialize Notion client
8const notion = new Client({
9 auth: Deno.env.get("NOTION_API_KEY"),
10});
11
7// Initialize Notion client
8const notion = new Client({
9 auth: Deno.env.get("NOTION_API_KEY"),
10});
11
125 */
126export async function sendPersonalizedDailyBriefings(today?: DateTime) {
127 // Get API keys from environment
128 const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
129 const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
130
131 if (!apiKey) {
132 console.error("Anthropic API key is not configured.");
133 return;
134 }
140
141 // Initialize Anthropic client
142 const anthropic = new Anthropic({ apiKey });
143
144 // Initialize Telegram bot
201
202 if (content.length <= MAX_LENGTH) {
203 await bot.api.sendMessage(chatId, content, { parse_mode: "Markdown" });
204 // Store the briefing in chat history
205 await storeChatMessage(
230 // Send each chunk as a separate message and store in chat history
231 for (const chunk of chunks) {
232 await bot.api.sendMessage(chatId, chunk, { parse_mode: "Markdown" });
233 // Store each chunk in chat history
234 await storeChatMessage(
250 */
251export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
252 // Get API keys from environment
253 const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
254 const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
255
274 }
275
276 if (!apiKey) {
277 console.error("Anthropic API key is not configured.");
278 return;
279 }
290
291 // Initialize Anthropic client
292 const anthropic = new Anthropic({ apiKey });
293
294 // Initialize Telegram bot
5const LOCAL_TIMEZONE = "Australia/Perth";
6
7// Define TypeScript interfaces for Google Calendar API responses
8interface CalendarEventDateTime {
9 dateTime?: string;
150
151 try {
152 const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
153 method: "POST",
154 headers: { "Content-Type": "application/x-www-form-urlencoded" },
182
183 // Fetch the list of available calendars
184 const calListUrl = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
185 const calListResponse = await fetch(calListUrl, {
186 headers: {
282 console.log(`Fetching events for calendar ${calendarId} from ${timeMin.toISOString()} to ${timeMax.toISOString()}`);
283
284 const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}/events?` +
285 new URLSearchParams({
286 timeMin: timeMin.toISOString(),
12 },
13 {
14 "prompt": "weather dashboard for nyc using open-meteo API for NYC with icons",
15 "title": "Weather App",
16 "code":
8
91. Sign up for [Cerebras](https://cloud.cerebras.ai/)
102. Get a Cerebras API Key
113. Save it in your project env variable called `CEREBRAS_API_KEY`
211 } catch (error) {
212 Toastify({
213 text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
214 position: "center",
215 duration: 3000,
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>CerebrasCoder</title>
7 <link rel="preconnect" href="https://fonts.googleapis.com" />
8 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9 <link
10 href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
11 rel="stylesheet"
12 />
21 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
22 <meta property="og:type" content="website">
23 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
24
25
16 };
17 } else {
18 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
19 const completion = await client.chat.completions.create({
20 messages: [