8
9const stripe = new Stripe(Deno.env.get("stripe_sk_customer_readonly") as string, {
10 apiVersion: "2020-08-27",
11});
12
8
9const stripe = new Stripe(Deno.env.get("stripe_sk_customer_readonly") as string, {
10 apiVersion: "2020-08-27",
11});
12
4import sgMail from "npm:@sendgrid/mail";
5
6sgMail.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}`);
61 const fetchDocument = async (id) => {
62 try {
63 const response = await fetch(`/api/document/${id}`);
64 if (!response.ok) {
65 throw new Error(`HTTP error! status: ${response.status}`);
78 e.preventDefault();
79 try {
80 const response = await fetch("/api/document", {
81 method: "POST",
82 headers: { "Content-Type": "application/json" },
149 const path = url.pathname;
150
151 if (path === "/api/document" && request.method === "POST") {
152 const { content, forkId } = await request.json();
153 const id = uuidv4();
161 }
162
163 if (path.startsWith("/api/document/") && request.method === "GET") {
164 const id = path.split("/")[3];
165 if (!id || id === "undefined") {
99
100async function saveToWallabag(url: string, token: string, config: any) {
101 const response = await fetch(`${config.WALLABAG_URL}/api/entries.json`, {
102 method: "POST",
103 headers: {
12 },
13 {
14 prompt: "weather dashboard for nyc using open-meteo API for NYC with icons",
15 title: "Weather App",
16 code:
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
212 } catch (error) {
213 Toastify({
214 text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
215 position: "center",
216 duration: 3000,
1024 };
1025 } else {
1026 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1027 const completion = await client.chat.completions.create({
1028 messages: [
1148 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1149 <title>CerebrasCoder</title>
1150 <link rel="preconnect" href="https://fonts.googleapis.com" />
1151 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1152 <link
1153 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"
1154 rel="stylesheet"
1155 />
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