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: [
3
4import { default as leadGeneratorUI } from 'https://esm.town/v/run/leadGeneratorUI?v=0';
5import { default as leadGeneratorAPI } from 'https://esm.town/v/run/leadGeneratorAPI?v=0';
6
7export default async function handler(req) {
13 if (path === '/' || path === '/index.html') {
14 return leadGeneratorUI(req);
15 } else if (path === '/api/leadGenerator') {
16 return leadGeneratorAPI(req);
17 } else {
18 // Página não encontrada
3
4import { leadGeneratorUI } from '@run/leadGeneratorUI';
5import { leadGeneratorAPI } from '@run/leadGeneratorAPI';
6
7export default async function handler(req) {
13 if (path === '/' || path === '/index.html') {
14 return leadGeneratorUI(req);
15 } else if (path === '/api/leadGenerator') {
16 return leadGeneratorAPI(req);
17 } else {
18 // Página não encontrada
1// Val Town API para geração de leads
2// Esta função recebe requisições POST com localização e tipo de negócio
3// e retorna leads coletados usando o serviço browserless
6
7// Configuração do Browserless
8const BROWSERLESS_API_KEY = 'aff260206d902da71e0d415431f7365b';
9const BROWSERLESS_URL = 'https://bootstrap-browserless.w6vrv8.easypanel.host/';
10
251 // Conectar ao serviço browserless
252 return await puppeteer.connect({
253 browserWSEndpoint: `${BROWSERLESS_URL}?token=${BROWSERLESS_API_KEY}`
254 });
255}
187
188 try {
189 // Chamar a API de geração de leads
190 const response = await fetch('/api/leadGenerator', {
191 method: 'POST',
192 headers: {
373. **posting step:**
38 - grab any queue rows with `scheduled_at ≤ now + 15 min`.
39 - `postTweet()` signs the request with oauth1 and fires to x api v2.
40 - on success, move row to `posted_tweets`.
41
48 - `NEXT_PUBLIC_SUPABASE_URL`
49 - `SUPABASE_SERVICE_ROLE`
50 - `X_API_KEY`, `X_API_SECRET` (consumer key/secret)
51 - `X_ACCESS_TOKEN`, `X_ACCESS_TOKEN_SECRET` (user token/secret)
52 - optional `X_USERNAME` (bot’s handle for nicer logs)
97
98export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
99 // Get API keys from environment
100 const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
101 const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
102
106 }
107
108 if (!apiKey) {
109 console.error("Anthropic API key is not configured.");
110 return;
111 }
122
123 // Initialize Anthropic client
124 const anthropic = new Anthropic({ apiKey });
125
126 // Initialize Telegram bot
162
163 // disabled title for now, it seemes unnecessary...
164 // await bot.api.sendMessage(chatId, `*${title}*`, { parse_mode: "Markdown" });
165
166 // Then send the main content
169
170 if (content.length <= MAX_LENGTH) {
171 await bot.api.sendMessage(chatId, content, { parse_mode: "Markdown" });
172 // Store the briefing in chat history
173 await storeChatMessage(
198 // Send each chunk as a separate message and store in chat history
199 for (const chunk of chunks) {
200 await bot.api.sendMessage(chatId, chunk, { parse_mode: "Markdown" });
201 // Store each chunk in chat history
202 await storeChatMessage(