34 `Analyze this text and output EXACTLY 10 unique keyphrases (2+ words each) as JSON array. Text: "${text}"`;
35
36 const response = await fetch("https://api.openai.com/v1/chat/completions", {
37 method: "POST",
38 headers: {
10
11async function loader({ bearerToken }: { bearerToken: string }) {
12 const data = await (await fetch("/api/projects-loader", {
13 headers: {
14 "Authorization": "Bearer " + bearerToken,
32
33 try {
34 const response = await fetch("/api/create-project", {
35 method: "POST",
36 headers: {
8
9 useEffect(() => {
10 fetchShortUrls();
11 }, []);
12
13 const fetchShortUrls = async () => {
14 const response = await fetch("/recent");
15 const data = await response.json();
16 setShortUrls(data);
19 const handleSubmit = async (e) => {
20 e.preventDefault();
21 const response = await fetch("/shorten", {
22 method: "POST",
23 headers: { "Content-Type": "application/json" },
298
299 try {
300 const response = await fetch("/api/revert-file", {
301 method: "POST",
302 headers: {
117
118// Export the Hono app for Val Town
119export default app.fetch;
28 try {
29 // Example AI generation call - replace with your actual API call
30 const response = await fetch("https://your-ai-endpoint.com/generate", {
31 method: "POST",
32 headers: {
76 const [error, setError] = useState("");
77
78 const fetchLinks = async () => {
79 try {
80 setIsLoading(true);
81 const response = await fetch("/api/links");
82
83 if (!response.ok) {
84 throw new Error("Failed to fetch links");
85 }
86
96
97 useEffect(() => {
98 fetchLinks();
99 }, []);
100
138 }
139
140 const response = await fetch(`/api/links/${shortId}`);
141
142 if (!response.ok) {
26
27 try {
28 const response = await fetch("/api/links", {
29 method: "POST",
30 headers: {
114
115// Export the app for Val Town
116export default app.fetch;