1import { OpenAI } from "https://deno.land/x/openai@v4.54.0/mod.ts";
2
3const apiKey = Deno.env.get("OPENAI_API_KEY");
4const openai = new OpenAI({ apiKey });
5
6export async function askAI(msg: string) {
10 ActionPostRequest,
11} from "@solana/actions";
12import { clusterApiUrl } from "@solana/web3.js";
13import { createTree } from "@metaplex-foundation/mpl-bubblegum";
14import { toWeb3JsTransaction } from "@metaplex-foundation/umi-web3js-adapters";
36 {
37 label: "Create Tree",
38 href: "/api/actions/create-tree?depth={depth}&buffer={buffer}&canopy={canopy}",
39 parameters: [
40 {
112 }
113
114 const umi = createUmi(clusterApiUrl("devnet"));
115 // .use(
116 // signerPayer(createNoopSigner(account)),
14
15 // Fetch search results
16 const search = await fetch("https://api.anicrush.to/shared/v2/movie/list?keyword=One Piece&limit=10&page=1", {
17 headers,
18 });
22
23 // Fetch server data
24 const serverData = await fetch(`https://api.anicrush.to/shared/v2/episode/servers?_movieId=${id}&ep=1`, {
25 headers,
26 });
30 // Fetch server link
31 const serverLink = await fetch(
32 `https://api.anicrush.to/shared/v2/episode/sources?_movieId=${id}&ep=1&sv=${serverId}&sc=sub`,
33 { headers },
34 );
1import { api } from "https://esm.town/v/pomdtr/api";
2
3export async function verifyUserEmail(email: string) {
4 const me = await api<{ email: string }>("/v1/me", {
5 authenticated: true,
6 });
1// This val creates a movie guessing game using the TMDB API.
2// We'll fetch random movies from different years, present them to the user, and check their guesses.
3// Tradeoffs: We're using a free API with authentication for better data variety.
4
5import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo"
6import { blob } from "https://esm.town/v/std/blob"
7
8const TMDB_API_BASE = "https://api.themoviedb.org/3"
9const TMDB_IMAGE_BASE = "https://image.tmdb.org/t/p/w200"
10
11const headers = {
12 Authorization: `Bearer ${Deno.env.get("TMDB_API_KEY")}`,
13}
14
24 chosen.add(year)
25 const response = await fetch(
26 `${TMDB_API_BASE}/discover/movie?language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&page=1&primary_release_year=${year}`,
27 { headers },
28 )
80 <p><a href="/all-guesses">View All Guesses</a></p>
81 <div class="footer">
82 This product uses the TMDB API but is not endorsed or certified by TMDB.
83 <br>
84 <a href="https://www.themoviedb.org/" target="_blank">
141 <a href="/">Play Again</a> | <a href="/all-guesses">View All Guesses</a>
142 <div class="footer">
143 This product uses the TMDB API but is not endorsed or certified by TMDB.
144 <br>
145 <a href="https://www.themoviedb.org/" target="_blank">
187 <p><a href="/">Back to Quiz</a></p>
188 <div class="footer">
189 This product uses the TMDB API but is not endorsed or certified by TMDB.
190 <br>
191 <a href="https://www.themoviedb.org/" target="_blank">
4import { zodToJsonSchema } from "npm:zod-to-json-schema";
5
6// NOTE: We've disabled the Exa API key in this demo due to high volume – you'll need to fork and provide your own to run it.
7const exa = new Exa(Deno.env.get("EXA_API_KEY"));
8const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
9
10const query = `"exa.ai" OR "@ExaAILabs"`;
1NOTE: We've disabled the Exa API key in this demo due to high volume – you'll need to fork and provide your own to use it.
2
3Search on Twitter (powered by [Exa](https://exa.ai)) and return a streaming markdown summary (powered by [Substrate](https://substrate.run)).
4
5To fork, [sign up for Substrate](https://substrate.run/) to get your own API key and $51 free credits.
6
7You'll also need Exa, which comes with generous free credits and can be a much cheaper alternative to the Twitter API.
1Generate a story and summarize it using [Substrate](https://substrate.run/).
2
3🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits.
1import { ComputeText, sb, Substrate } from "npm:substrate";
2
3const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
4
5const story = new ComputeText({ prompt: "tell me a story, be concise", max_tokens: 800 });
1// This implementation uses SQLite to store blob data instead of the Val Town API.
2// It creates a 'blobs' table to store key-value pairs, where the key is the blob key
3// and the value is the blob data stored as TEXT. This approach allows for persistence