2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3
4export default async function(req: Request): Promise<Response> {
5 if (req.method !== "GET") {
6 return new Response("Method not allowed", {
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [query, setQuery] = useState("");
7 const [searchLoading, setSearchLoading] = useState(false);
109}
110
111function client() {
112 createRoot(document.getElementById("root")).render(<App />);
113}
117}
118
119export default async function server(req: Request): Promise<Response> {
120 if (req.method === "POST") {
121 const url = new URL(req.url);
109const ErrorMessage = memo(({ message }: { message: string }) => <div className="error">Error: {message}</div>);
110
111function App() {
112 const [data, setData] = useState<{
113 prs: ActivityItem[] | null;
167}
168
169function client() {
170 createRoot(document.getElementById("root")).render(<App />);
171}
178 new Response(JSON.stringify({ message }), { status, headers: JSON_HEADERS });
179
180export default async function server(req: Request): Promise<Response> {
181 const url = new URL(req.url);
182
9}
10
11function App() {
12 const [password, setPassword] = useState("");
13 const [level, setLevel] = useState(1);
34 try {
35 // eslint-disable-next-line no-new-func
36 const isValid = new Function("password", `return ${requirement.validator}`)(password);
37 if (!isValid) {
38 failed.push(JSON.stringify(requirement));
139}
140
141function client() {
142 createRoot(document.getElementById("root")!).render(<App />);
143}
147}
148
149export default async function server(req: Request): Promise<Response> {
150 if (req.method === "POST") {
151 const client = new Cerebras();
173 model: "llama3.1-70b",
174 tools: [{
175 type: "function",
176 function: {
177 name: "generateRequirement",
178 description: `Generate a creative password requirement with two fields:
224 });
225
226 const functionCall = completion.choices?.at(0)?.message?.tool_calls?.at(0)?.function;
227 if (functionCall?.name === "generateRequirement") {
228 return new Response(functionCall.arguments, {
229 headers: { "Content-Type": "application/json" },
230 });
231 } else {
232 console.log(completion);
233 throw new Error("Unexpected function call");
234 }
235 }
9}
10
11function App() {
12 const [password, setPassword] = useState("");
13 const [level, setLevel] = useState(1);
34 try {
35 // eslint-disable-next-line no-new-func
36 const isValid = new Function("password", `return ${requirement.validator}`)(password);
37 if (!isValid) {
38 failed.push(JSON.stringify(requirement));
139}
140
141function client() {
142 createRoot(document.getElementById("root")!).render(<App />);
143}
147}
148
149export default async function server(req: Request): Promise<Response> {
150 if (req.method === "POST") {
151 const client = new Cerebras();
173 model: "llama3.1-70b",
174 tools: [{
175 type: "function",
176 function: {
177 name: "generateRequirement",
178 description: `Generate a creative password requirement with two fields:
224 });
225
226 const functionCall = completion.choices?.at(0)?.message?.tool_calls?.at(0)?.function;
227 if (functionCall?.name === "generateRequirement") {
228 return new Response(functionCall.arguments, {
229 headers: { "Content-Type": "application/json" },
230 });
231 } else {
232 console.log(completion);
233 throw new Error("Unexpected function call");
234 }
235 }
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function App() {
7 const [messages, setMessages] = useState([]);
8 const [apiKey, setApiKey] = useState("");
28 };
29
30 async function handleSubmit(e) {
31 e.preventDefault();
32 const newMessage = e.target.message.value;
160}
161
162function client() {
163 createRoot(document.getElementById("root")).render(<App />);
164}
166if (typeof document !== "undefined") { client(); }
167
168export default async function server(request: Request): Promise<Response> {
169 return new Response(
170 `<!DOCTYPE html>
1export default async function(req: Request): Promise<Response> {
2 return new Response(
3 `
57 const connectionStatus = document.querySelector("#connection-status");
58
59 function parseResponse(text) {
60 const parts = [];
61 let currentText = "";
104 });
105
106 document.getElementById("input").addEventListener("submit", async function(event) {
107 event.preventDefault();
108 const userMessage = event.target.message.value;
207
208 document.querySelectorAll(".suggestion-button").forEach((button)=>{
209 button.addEventListener("click", function() {
210 const input = document.querySelector("input[name=\\"message\\"]");
211 input.value = this.textContent;
19}
20
21export async function getNewsList(): Promise<Headline[] | undefined> {
22 const targetUrl = "https://www.bing.com/news/search?q=%22slams%22&qft=sortbydate%3d%221%22&form=YFNR" // url.searchParams.get("url");
23 const targetClass = "news-card" // url.searchParams.get("class");
43}
44
45export async function feedToChatGPT(newsItems: Headline[]): Promise<Slam[] | undefined > {
46 const completion = await openai.chat.completions.create({
47 messages: [
59}
60
61export default async function run() {
62 let results = await getNewsList();
63 if (results == undefined) {
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {
2const php = new PhpWeb();
3
4export default async function(req: Request): Promise<Response> {
5 let logs: any[] = [];
6 php.addEventListener("output", (event: any) => logs.push(...event.detail));