1025 };
1026 } else {
1027 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1028 const thinkingCompletion = await client.chat.completions.create({
1029 messages: [
1033 another AI to code websites. You DO NOT code yourself. You just explain the plan.
1034 You can include inline code if you want to explain how to do something.
1035 Be sure to use APIs that don't require keys and that you know well. Explain the structure of the API.
1036 `,
1037 },
1170 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1171 <title>CerebrasCoder</title>
1172 <link rel="preconnect" href="https://fonts.googleapis.com" />
1173 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1174 <link
1175 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"
1176 rel="stylesheet"
1177 />
6
71. Sign up for [Cerebras](https://cloud.cerebras.ai/)
82. Get a Cerebras API Key
93. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
10
11# Todos
1Migrated from folder: Enkaku/EnkakuAuthenticatedAPIAdmin
1Migrated from folder: Enkaku/EnkakuAuthenticatedAPIClient
1async function fetchUser(token: string): Promise<{ email: string }> {
2 const resp = await fetch("https://api.val.town/v1/me", {
3 headers: {
4 Authorization: `Bearer ${token}`,
337 console.log("Handling summary request");
338 try {
339 // Retrieve API key from Val Town environment
340 const GEMINI_API_KEY = Deno.env.get("GEMINI_API_KEY");
341
342 if (!GEMINI_API_KEY) {
343 console.error("Gemini API key not configured");
344 return new Response(
345 JSON.stringify({
346 error: "Gemini API key is not configured",
347 }),
348 {
353 }
354
355 const genAI = new GoogleGenerativeAI(GEMINI_API_KEY);
356 const requestBody = await request.json();
357 const { postId, postDetails } = requestBody;
358
359 // Fetch comments
360 const commentsResponse = await fetch(`https://hn.algolia.com/api/v1/items/${postId}`);
361 const commentsData = await commentsResponse.json();
362
1042 };
1043 } else {
1044 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1045 const completion = await client.chat.completions.create({
1046 messages: [
1163 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1164 <title>CerebrasCoder</title>
1165 <link rel="preconnect" href="https://fonts.googleapis.com" />
1166 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1167 <link
1168 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"
1169 rel="stylesheet"
1170 />
1043 };
1044 } else {
1045 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1046 const completion = await client.chat.completions.create({
1047 messages: [
1164 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1165 <title>CerebrasCoder</title>
1166 <link rel="preconnect" href="https://fonts.googleapis.com" />
1167 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1168 <link
1169 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"
1170 rel="stylesheet"
1171 />
4
51. Sign up for [Cerebras](https://cloud.cerebras.ai/)
62. Get a Cerebras API Key
73. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
8
9# Todos
4
51. Sign up for [Cerebras](https://cloud.cerebras.ai/)
62. Get a Cerebras API Key
73. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
8
9# Todos