8
9const stripe = new Stripe(Deno.env.get("stripe_sk_customer_readonly") as string, {
10 apiVersion: "2020-08-27",
11});
12
832 <head>
833 <title>🌽 Kernel CRM</title>
834 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
835 <style>${css}</style>
836 <meta name="viewport" content="width=device-width, initial-scale=1" />
32// "*",
33// unkey({
34// apiId: "rlns_2AMjVgwwMksmssLVb56LVmkpB56C",
35// }),
36// );
8
91. Sign up for [Cerebras](https://cloud.cerebras.ai/)
102. Get a Cerebras API Key
113. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
264 } catch (error) {
265 Toastify({
266 text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
267 position: "center",
268 duration: 3000,
1044 };
1045 } else {
1046 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1047 const completion = await client.chat.completions.create({
1048 messages: [
1169 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1170 <title>CerebrasCoder</title>
1171 <link rel="preconnect" href="https://fonts.googleapis.com" />
1172 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1173 <link
1174 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"
1175 rel="stylesheet"
1176 />
1185 <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."">
1186 <meta property="og:type" content="website">
1187 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1188
1189
1import process from "node:process";
2import { AppBskyFeedPost, AtpAgent } from "npm:@atproto/api";
3
4const agent = new AtpAgent({
499 <title>Task Board</title>
500 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
501 <link rel="preconnect" href="https://fonts.googleapis.com">
502 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
503 <link href="https://fonts.googleapis.com/css2?family=DM+Serif+Text:ital@0;1&family=Dancing+Script:wght@400..700&family=Jersey+10&family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Playwrite+AU+SA:wght@100..400&family=Playwrite+IE+Guides&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Rubik+Vinyl&display=swap" rel="stylesheet">
504 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" />
505 <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet" />
4// import sgMail from "npm:@sendgrid/mail";
5
6// sgMail.setApiKey(Deno.env.get("sendgrid"));
7
8const KNOWN_IRRELEVANT_DOMAINS = [
42
43 try {
44 const response = await fetch(`https://www.shovel.report/api/domains/${domain}`);
45 if (!response.ok) {
46 throw new Error(`HTTP error! status: ${response.status}`);
5// main controller function
6export async function emailValHandler(receivedEmail) {
7 const openaiUrl = "https://api.openai.com/v1/chat/completions";
8 const apiKey = Deno.env.get("OPENAI_API_KEY"); // replace this entire line with your OpenAI API key as a string, e.g., "sk-123..." or use environment variable: https://docs.val.town/reference/environment-variables/
9 const model = "gpt-4o-mini";
10
11 if (!apiKey) {
12 throw new Error(
13 "OPENAI_KEY environment variable is not set. Please set it or replace this line with your API key.",
14 );
15 }
36
37 // step 4: send prompt to openai
38 const openaiResponse = await sendRequestToOpenAI(prompt, openaiUrl, apiKey, model);
39
40 // log the openai response
122
123// helper function to send a request to openai
124async function sendRequestToOpenAI(prompt, openaiUrl, apiKey, model) {
125 try {
126 // prepare the openai messages payload
148 headers: {
149 "Content-Type": "application/json",
150 Authorization: `Bearer ${apiKey}`,
151 },
152 });
141. Copy this Val and save it as an Email Val (choose Val type in top-right corner of editor)
15
162. Add your OpenAI API key to line 8 (or use an environment variable: https://docs.val.town/reference/environment-variables/)
17
183. Copy the email address of the Val (click 3 dots in top-right > Copy > Copy email address)