36}
3738export interface ApiResponse<T = any> {
39success: boolean;
40data?: T;
eink-frameapod.ts3 matches
11};
1213const NASA_API_KEY = Deno.env.get("NASA_API_KEY");
1415export default async function GetAPOD(req: Request): Promise<Response> {
16const url = `https://api.nasa.gov/planetary/apod?api_key=${NASA_API_KEY}&thumbs=true`;
17const cacheKey = "nasa_apod";
18const cacheMinutes = 60;
2122if (!data) {
23return new Response("No data from Nasa API", { status: 404 });
24}
25
eink-framegithub.tsx1 match
2import React from "https://esm.sh/react";
3import { renderToString } from "https://esm.sh/react-dom/server";
4import GetGitHubData, { type GitHubContributionsResponse } from "../api/github.ts";
5import { BodyWrapper, Content, Footer, Header, Headline } from "../components.tsx";
6
eink-framehemolog.tsx1 match
2import React from "https://esm.sh/react";
3import { renderToString } from "https://esm.sh/react-dom/server";
4import GetLogs, { type HEMOLOG_TREATMENT } from "../api/hemolog.ts";
5import { BodyWrapper, Content, Footer, Header, Headline } from "../components.tsx";
6
ChatStreamingChat.tsx15 matches
47}));
4849const apiMessages = history
50.filter((m) => m.role !== "system")
51.map((m) => ({ role: m.role, content: m.content }))
56max_tokens: 8_000,
57stream: true,
58messages: apiMessages,
59...(enabledMCP.length && { mcp_servers: enabledMCP }),
60};
6263/** Build headers */
64function buildHeaders(apiKey: string, usingMCP: boolean): Record<string, string> {
65const headers: Record<string, string> = {
66"x-api-key": apiKey,
67"anthropic-version": "2023-06-01",
68"content-type": "application/json",
118const send = useCallback(
119async (history: Message[], userText: string): Promise<AssistantMsg> => {
120if (!config.anthropicApiKey) throw new Error("API key missing");
121if (status !== "idle") throw new Error("Stream already in progress");
122125const body = buildBody(config, history, userText);
126const headers = buildHeaders(
127config.anthropicApiKey,
128(body as any).mcp_servers?.length,
129);
132abortRef.current = ctrl;
133134const resp = await fetch("https://api.anthropic.com/v1/messages", {
135method: "POST",
136body: JSON.stringify(body),
143throw new Error(
144err.error?.message
145?? `Anthropic API error: ${resp.status} ${resp.statusText}`,
146);
147}
273/** Dispatch user input */
274const fireSend = async () => {
275if (!input.trim() || status !== "idle" || !config.anthropicApiKey) return;
276277const userText = input.trim();
323};
324325const canSend = input.trim() && status === "idle" && config.anthropicApiKey;
326327/* ββ UI βββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
329<>
330<div className="chat-messages">
331{!config.anthropicApiKey && (
332<div className="message system">
333Please configure your Anthropic API key in settings to start chatting
334</div>
335)}
369onChange={(e) => setInput(e.target.value)}
370onKeyPress={handleKeyPress}
371placeholder={config.anthropicApiKey
372? streaming
373? "Press Enter to stop streamingβ¦"
374: "Type your messageβ¦"
375: "Configure API key in settings first"}
376className="chat-input"
377disabled={!config.anthropicApiKey || thinking}
378rows={1}
379/>
discord-random-botREADME.md1 match
75- Voice channel has fewer than 2 people
76- Bot lacks necessary permissions
77- Network or Discord API issues
7879## Technical Details
todo-appindex.html1 match
7<script src="https://cdn.twind.style" crossorigin></script>
8<script src="https://esm.town/v/std/catch"></script>
9<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
10<style>
11* {
eink-framecomponents.tsx6 matches
9<meta charSet="UTF-8" />
10<title>{title}</title>
11<link rel="preconnect" href="https://fonts.googleapis.com" />
12{/* Getting a type error here */}
13{/* <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> */}
14<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet" />
15<link href="https://fonts.googleapis.com/css2?family=Doto:wght@100..900&display=swap" rel="stylesheet" />
16<link href="https://fonts.googleapis.com/css2?family=Rancho&display=swap" rel="stylesheet" />
17<link href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" rel="stylesheet" />
18<link
19href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap"
20rel="stylesheet"
21/>
reactHonoStarterApp.tsx1 match
31useEffect(() => {
32const getMyIp = async () => {
33const response = await fetch("https://api.ipify.org?format=json");
34const data = await response.json();
35setMyIp(data.ip);