34// Environment variables
5const GOOGLE_API_KEY = process.env.GOOGLE_API_KEY;
6const GROUPME_TOKEN = process.env.GROUPME_TOKEN;
7const GROUPME_GROUP_ID = process.env.GROUPME_GROUP_ID;
10// Initialize Google AI
11const ai = new GoogleGenAI({
12apiKey: GOOGLE_API_KEY,
13});
1415// GroupMe API configuration
16const baseUrl = "https://api.groupme.com/v3";
1718// System prompt for Gimpel
90// Generate AI response using Gemini with chat-based conversation
91const generateResponse = async (messages) => {
92if (!GOOGLE_API_KEY) {
93throw new Error("Missing Google API key");
94}
95
reactHonoStarterindex.ts2 matches
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
1314// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
1617// Unwrap and rethrow Hono errors as the original error
untitled-731main.tsx1 match
1// @title SportifyMA Core API β Multilingual Event Info
2// @desc Returns event details, transport info, ticket mock, and alerts in user-selected language
3
houseSearchSFscrapedHouses.tsx7 matches
1// This val creates a form to input a Zillow or Craigslist link, determines the link type,
2// calls the appropriate scraping API, and renders the results in a table.
3// It uses React for the UI, fetch for API calls, and basic string manipulation for link validation.
45/** @jsxImportSource https://esm.sh/react */
88if (request.method === "POST" && new URL(request.url).pathname === "/scrape") {
89const { link } = await request.json();
90let scrapingEndpoint;
9192if (link.includes("zillow.com")) {
93scrapingEndpoint = "https://shapedlines-scrapezillowapi.web.val.run?url=";
94} else if (link.includes("craigslist.org")) {
95scrapingEndpoint = "https://shapedlines-scrapecraigslistapi.web.val.run?url=";
96} else {
97return new Response(JSON.stringify({ error: "Invalid link. Please provide a Zillow or Craigslist link." }), {
102103try {
104const scrapeResponse = await fetch(`${scrapingEndpoint}${encodeURIComponent(link)}`);
105if (!scrapeResponse.ok) {
106throw new Error("Failed to scrape data");
110// Calculate transit time
111const transitResponse = await fetch(
112`https://shapedlines-calculatetransitapi.web.val.run?address=${encodeURIComponent(scrapeResult.address)}`,
113);
114if (!transitResponse.ok) {
untitled-3501main.tsx1 match
1// @title SportifyMA Core API β Multilingual Event Info
2// @desc Returns event details, transport info, ticket mock, and alerts in user-selected language
3
houseSearchSFscrapeCraigslistAPI.tsx0 matches
1import * as cheerio from "https://esm.sh/cheerio@1.0.0-rc.12";
23export default async function server(request: Request): Promise<Response> {
4const url = new URL(request.url).searchParams.get("url");
5
houseSearchSFcalculateTransitAPI.tsx22 matches
21}
2223const apiKey = Deno.env.get("GOOGLE_MAPS_API_KEY");
24if (!apiKey) {
25return new Response(JSON.stringify({ error: "API key is not configured" }), {
26status: 500,
27headers: { "Content-Type": "application/json" },
35const gyms = await blob.getJSON("SF_Gyms");
3637const nearestGrocery = await findNearest(origin, groceries, apiKey);
38const nearestGym = await findNearest(origin, gyms, apiKey);
3940const fidiDestination = "548 Market St, San Francisco, CA 94104";
41const fidiDrivingTime = await getDrivingTime(origin, fidiDestination, apiKey);
4243const robloxDestination = "910 Park Pl Ste 300, San Mateo, CA 94403";
44const robloxDrivingTime = await getDrivingTime(origin, robloxDestination, apiKey, "09:00:00", "Tuesday");
4546const samsaraDestination = "1 De Haro St, San Francisco, CA 94103";
47const samsaraTransitTime = await getTransitTime(origin, samsaraDestination, apiKey);
4849const zipCode = await getZipCode(origin, apiKey);
50const neighborhoodZipMap = await blob.getJSON("SF_Neighborhood_ZIP");
51const neighborhood = neighborhoodZipMap[zipCode] || "Unknown";
75}
7677async function findNearest(origin: string, locations: any[], apiKey: string): Promise<any> {
78const batchSize = 25;
79let nearestLocation = null;
83const batch = locations.slice(i, i + batchSize);
84const destinations = batch.map(location => `${location.gps.lat},${location.gps.lng}`).join("|");
85const distanceMatrixUrl = `https://maps.googleapis.com/maps/api/distancematrix/json?origins=${
86encodeURIComponent(origin)
87}&destinations=${encodeURIComponent(destinations)}&mode=driving&key=${apiKey}`;
8889const response = await fetch(distanceMatrixUrl);
9192if (data.status !== "OK") {
93throw new Error(`Distance Matrix API failed. Status: ${data.status}`);
94}
95116origin: string,
117destination: string,
118apiKey: string,
119arrivalTime?: string,
120arrivalDay?: string,
121): Promise<string> {
122let directionsUrl = `https://maps.googleapis.com/maps/api/directions/json?origin=${
123encodeURIComponent(origin)
124}&destination=${encodeURIComponent(destination)}&mode=driving&key=${apiKey}`;
125126if (arrivalTime && arrivalDay) {
142}
143144async function getTransitTime(origin: string, destination: string, apiKey: string): Promise<string> {
145const directionsUrl = `https://maps.googleapis.com/maps/api/directions/json?origin=${
146encodeURIComponent(origin)
147}&destination=${encodeURIComponent(destination)}&mode=transit&key=${apiKey}`;
148149const directionsResponse = await fetch(directionsUrl);
159}
160161async function getZipCode(address: string, apiKey: string): Promise<string> {
162const geocodeUrl = `https://maps.googleapis.com/maps/api/geocode/json?address=${
163encodeURIComponent(address)
164}&key=${apiKey}`;
165const response = await fetch(geocodeUrl);
166const data = await response.json();
houseSearchSFscrapeZillowAPI.tsx2 matches
64});
65} catch (error) {
66console.error("Error scraping Zillow:", error);
67return new Response(JSON.stringify({ error: "Error scraping Zillow listing" }), {
68status: 500,
69headers: { "Content-Type": "application/json" },
finalScrapermain.tsx7 matches
1// This val creates a form to input a Zillow or Craigslist link, determines the link type,
2// calls the appropriate scraping API, and renders the results in a table.
3// It uses React for the UI, fetch for API calls, and basic string manipulation for link validation.
45/** @jsxImportSource https://esm.sh/react */
88if (request.method === "POST" && new URL(request.url).pathname === "/scrape") {
89const { link } = await request.json();
90let scrapingEndpoint;
9192if (link.includes("zillow.com")) {
93scrapingEndpoint = "https://shapedlines-scrapezillowapi.web.val.run?url=";
94} else if (link.includes("craigslist.org")) {
95scrapingEndpoint = "https://shapedlines-scrapecraigslistapi.web.val.run?url=";
96} else {
97return new Response(JSON.stringify({ error: "Invalid link. Please provide a Zillow or Craigslist link." }), {
102103try {
104const scrapeResponse = await fetch(`${scrapingEndpoint}${encodeURIComponent(link)}`);
105if (!scrapeResponse.ok) {
106throw new Error("Failed to scrape data");
110// Calculate transit time
111const transitResponse = await fetch(
112`https://shapedlines-calculatetransitapi.web.val.run?address=${encodeURIComponent(scrapeResult.address)}`,
113);
114if (!transitResponse.ok) {
ChatStreamingChat.tsx8 matches
174/** Retry a user message */
175const retryMessage = async (messageId: string) => {
176if (status !== "idle" || !config.anthropicApiKey) return;
177178const userText = onRetryFromMessage(messageId);
200console.log("[Chat] fire send", { userText, input });
201const messageText = userText || input.trim();
202if (!messageText || status !== "idle" || !config.anthropicApiKey) return;
203204// Only clear input if we're using the current input (not NextSteps execution)
268};
269270const canSend = input?.trim() && status === "idle" && config.anthropicApiKey;
271272/* ββ UI βββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
274<>
275<div className="chat-messages">
276{!config.anthropicApiKey && (
277<div className="message system">
278Please configure your Anthropic API key in settings to start chatting
279</div>
280)}
384}}
385onKeyDown={handleKeyDown}
386placeholder={config.anthropicApiKey
387? streaming
388? "Press Enter to stop streamingβ¦"
390? "Waiting for your input aboveβ¦"
391: "Type your message or / for commandsβ¦"
392: "Configure API key in settings first"}
393className="chat-input"
394disabled={!config.anthropicApiKey || thinking || waitingForUser}
395rows={1}
396/>