OpenTownieindex1 match
2627try {
28const response = await fetch("/", {
29method: "POST",
30headers: { "authorization": "Bearer " + bearerToken },
OpenTowniegenerateCode1 match
2627export async function generateCodeAnthropic(messages: Message[]): Promise<ValResponse | null> {
28const system = await (await fetch(`${import.meta.url.split("/").slice(0, -1).join("/")}/system_prompt.txt`)).text();
2930const openai = new OpenAI({
reactRouter7server.tsx1 match
5if (url.pathname == "/js/entry.client.js") {
6const moduleUrl = new URL("./entry.client.tsx", import.meta.url);
7return fetch(moduleUrl);
8}
9return handler(request);
OpenTowniesystem_prompt.txt2 matches
155* The main App component is rendered on the client.
156* No server-side-specific code should be included in the App.
157* Use fetch to communicate with the backend server portion.
158*/
159function App() {
178* Server-only code
179* Any code that is meant to run on the server should be included in the server function.
180* This can include endpoints that the client side component can send fetch requests to.
181*/
182export default async function server(request: Request): Promise<Response> {
13if (working) {
14return Response.json({
15error: "Sorry, another embedding is being fetched, wait a moment and try again",
16})
17}
emojiTodoListAppmain.tsx9 matches
910useEffect(() => {
11fetchTodos();
12}, []);
1314const fetchTodos = async () => {
15const response = await fetch("/todos");
16const data = await response.json();
17setTodos(data);
21e.preventDefault();
22if (!newTodo.trim()) return;
23await fetch("/todos", {
24method: "POST",
25headers: { "Content-Type": "application/json" },
27});
28setNewTodo("");
29fetchTodos();
30};
3132const toggleTodo = async (id) => {
33await fetch(`/todos/${id}`, { method: "PATCH" });
34fetchTodos();
35};
3637const deleteTodo = async (id) => {
38await fetch(`/todos/${id}`, { method: "DELETE" });
39fetchTodos();
40};
41
importProjectFilemain.tsx1 match
1export async function importProjectFile(moduleUrl: string, path: string) {
2const url = new URL(path, moduleUrl);
3const resp = await fetch(url, { method: "GET", headers: { "Authorization": `Bearer ${Deno.env.get("valtown")}` } });
4if (!resp.ok) return undefined;
5const text = await resp.text();
10e.preventDefault();
11try {
12const response = await fetch("/login", {
13method: "POST",
14headers: { "Content-Type": "application/json" },
58const [tagInput, setTagInput] = useState("");
5960// Fetch previous customer details when email changes
61useEffect(() => {
62const fetchCustomerDetails = async () => {
63if (!email) return;
6465try {
66const response = await fetch(`/get-customer-details?email=${encodeURIComponent(email)}`);
67if (response.ok) {
68const customerDetails = await response.json();
73}
74} catch (error) {
75console.error("Error fetching customer details:", error);
76}
77};
7879fetchCustomerDetails();
80}, [email]);
81138e.preventDefault();
139try {
140const response = await fetch("/add-interaction", {
141method: "POST",
142headers: { "Content-Type": "application/json" },
250const [uniqueCustomerCount, setUniqueCustomerCount] = useState(0);
251252const fetchUniqueCustomerCount = async () => {
253try {
254const response = await fetch("/get-unique-customer-count");
255const data = await response.json();
256setUniqueCustomerCount(data.count);
257} catch (error) {
258console.error("Error fetching unique customer count:", error);
259}
260};
261262useEffect(() => {
263fetchInteractions();
264fetchUniqueCustomerCount();
265}, [currentPage, selectedTags]);
266281const handleDeleteInteraction = async (id) => {
282try {
283const response = await fetch("/delete-interaction", {
284method: "DELETE",
285headers: { "Content-Type": "application/json" },
288289if (response.ok) {
290fetchInteractions();
291}
292} catch (error) {
303};
304305const fetchInteractions = async () => {
306try {
307const response = await fetch(`/get-interactions?page=${currentPage}`);
308const data = await response.json();
309336if (selectedTags.length > 0) {
337// Need to get total count of filtered interactions from server
338const filteredCountResponse = await fetch(`/get-filtered-count?tags=${selectedTags.join(",")}`);
339const filteredCountData = await filteredCountResponse.json();
340setTotalInteractions(filteredCountData.count);
343}
344} catch (error) {
345console.error("Error fetching interactions:", error);
346}
347};
348349useEffect(() => {
350fetchInteractions();
351}, [currentPage, selectedTags]);
352481const checkAuth = async () => {
482try {
483const response = await fetch("/check-auth");
484const data = await response.json();
485setIsAuthenticated(data.authenticated);
1console.log("hi");
2await fetch("https://shouser--83d37324cc6c11efb88ce6cdfca9ef9f.web.val.run?normalscriptval=true")
3.then(response => console.log(response.json()))
4.then(data => console.log(data))
bedtimeStoryMakermain.tsx1 match
521)
522523export default app.fetch