cerebras_coderindex.html1 match
19<meta property="og:site_name" content="Cerebras Coder">
20<meta property="og:url" content="https://cerebrascoder.com"/>
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">
cerebras_codergenerate-code.ts2 matches
2import STARTER_PROMPTS from "../public/starter-prompts.js";
34function extractCodeFromFence(text: string): string {
5const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
6return htmlMatch ? htmlMatch[1].trim() : text;
7}
89export async function generateCode(prompt: string, currentCode: string) {
10const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
11if (starterPrompt) {
simple-scrabble-apiapi.tsx10 matches
120};
121122export async function handler(req: Request): Promise<Response> {
123if (req.method === "OPTIONS") {
124return new Response(null, {
179}
180181function paginate<T>(items: T[], options: PaginationOptions): PaginationResult<T> {
182const { page, size, totalItems, basePath } = options;
183220}
221222function handleRootRoute(req: Request): Response {
223const url = new URL(req.url);
224const baseUrl = `${url.protocol}//${url.host}`;
237}
238239async function handleDictionaryRoute(req: Request): Promise<Response> {
240const currentTime = Date.now();
241if (!dictionaryCache.length || (currentTime - dictionaryCacheTimestamp > CACHE_TTL)) {
292}
293294async function handleBoardsRoute(req: Request): Promise<Response> {
295const currentTime = Date.now();
296if (!boardsCache.length || (currentTime - boardsCacheTimestamp > CACHE_TTL)) {
320}
321322function generatePermutations(str: string): string[] {
323const result: string[] = [];
324325function permute(arr: string[], m: string[] = []) {
326if (arr.length === 0) {
327result.push(m.join(""));
339}
340341function handleRearrangeRoute(req: Request): Response {
342const url = new URL(req.url);
343const path = url.pathname;
413}
414415function calculateScrabbleScore(word: string): number {
416return word
417.toLowerCase()
422}
423424function handleScoreRoute(req: Request): Response {
425const url = new URL(req.url);
426const path = url.pathname;
2import { useState } from "https://esm.sh/react@18.2.0";
34export function App() {
5const [clicked, setClicked] = useState(0);
6return (
1// signup-alerts-service.ts - Service for handling role toggle functionality
2import { withErrorHandling } from "https://esm.town/v/ktodaz/Discord_Bot_Services/error-handling.tsx";
3import { blob } from "https://esm.town/v/std/blob";
1415// Toggle role for a user (for the command processor)
16export async function toggleSignupsAlert(
17guildId: string,
18userId: string,
111112// Create response messages based on toggle result
113export function createToggleSignupsAlertResponseMessage(
114result: { success: boolean; action: string; roleName?: string; error?: string },
115): string {
126127// Get toggleable roles in a guild - used for autocomplete
128export async function getSignupAlertsRoles(
129guildId: string,
130): Promise<{ success: boolean; roles?: Array<{ id: string; name: string }>; error?: string }> {
207208// Handle role autocomplete interaction
209export async function handleRoleAutocomplete(interaction: any): Promise<Response> {
210try {
211const guildId = interaction.guild_id;
1// toggle-server-helper-pings-service.ts - Service for handling server helper ping toggle functionality
2import { fetch } from "https://esm.town/v/std/fetch";
31011// Toggle server helper pings role for a user
12export async function toggleServerHelperPings(
13guildId: string,
14userId: string,
101102// Create response messages based on toggle result
103export function createToggleServerHelperPingsResponseMessage(
104result: { success: boolean; action: string; roleName?: string; error?: string },
105): string {
1// toggle-role-service.ts - Service for handling role toggle functionality
2import { withErrorHandling } from "https://esm.town/v/ktodaz/Discord_Bot_Services/error-handling.tsx";
3import { fetch } from "https://esm.town/v/std/fetch";
1213// Check if user has permission to toggle roles
14async function hasPermission(guildId: string, userId: string): Promise<{
15hasPermission: boolean;
16isAdmin: boolean;
9394// Toggle role for a user (for the command processor)
95export async function toggleRole(
96guildId: string,
97userId: string,
178179// Create response messages based on toggle result
180export function createToggleRoleResponseMessage(
181result: { success: boolean; action: string; roleName?: string; error?: string },
182): string {
192}
193194// Then modify your getToggleableRoles function to use the error handling wrapper
195export async function getToggleableRoles(guildId: string): Promise<{
196success: boolean;
197roles?: Array<{ id: string; name: string }>;
249250// Handle role autocomplete interaction
251export async function handleRoleAutocomplete(interaction: any): Promise<Response> {
252try {
253const guildId = interaction.guild_id;
213214// -------------------------------
215// Custom Functions
216// https://api.slack.com/automation/functions/custom
217// -------------------------------
218219app.function("fetch_user_details", async ({ payload, context: { client, functionExecutionId } }) => {
220try {
221// Requires users:read scope
224});
225const user = userInfo.user!;
226await client.functions.completeSuccess({
227function_execution_id: functionExecutionId!,
228outputs: {
229full_name: user.real_name || user.profile?.real_name_normalized || user.profile?.real_name,
239} catch (e) {
240console.error(e);
241await client.functions.completeError({
242function_execution_id: functionExecutionId!,
243error: `Failed to respond to fetch_user_details function event (${e})`,
244});
245}
261(async () => await sm.start())();
262263export default async function handler(req: Request) {
264return Response.json(
265await app.client.conversations.replies({
67// Summarizer Agent (unchanged, but shown for completeness)
8export async function summarizerAgent(
9input: AgentInput<{ textToSummarize: string }>,
10context: AgentContext,
5253// Fetch Agent (Now fetches and parses RSS feeds for headlines)
54export async function fetchAgent(
55input: AgentInput<{ url_from_input?: string; maxHeadlines?: number }>, // Added maxHeadlines
56context: AgentContext,
206207// Combiner Agent (Adapted to handle new headline structure from FetchAgent)
208export async function combinerAgent(
209input: AgentInput<{
210summary?: string;