1import Pipeline from "https://esm.town/v/iamseeley/pipeline";
23export async function questionAnsweringHandler(req) {
4if (req.method === "GET") {
5return new Response(`
exampleSummarizationmain.tsx1 match
1import Pipeline from "https://esm.town/v/iamseeley/pipeline";
23export async function summarizationHandler(req) {
4if (req.method === "GET") {
5return new Response(`
1import Pipeline from "https://esm.town/v/iamseeley/pipeline";
23export default async function handler(req) {
4if (req.method === "GET") {
5return new Response(`
1import Pipeline from "https://esm.town/v/iamseeley/pipeline";
23export default async function handler(req) {
4if (req.method === "GET") {
5return new Response(`
hfApiGatewaymain.tsx1 match
12};
1314export async function handler(req) {
15const url = new URL(req.url);
16const task = url.searchParams.get("task") || "feature-extraction";
email_authmain.tsx8 matches
15};
1617async function createSessionTable(sessionTableName: string) {
18await sqlite.execute(`CREATE TABLE ${sessionTableName} (
19id TEXT NOT NULL PRIMARY KEY,
24}
2526async function createCodeTable(tableName: string) {
27await sqlite.execute(`CREATE TABLE ${tableName} (
28id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
33}
3435async function generateEmailVerificationCode(tableName, email: string): Promise<string> {
36try {
37await sqlite.execute({ sql: `DELETE FROM ${tableName} WHERE email = ?`, args: [email] });
53}
5455async function createSession(tableName: string, valSlug: string, email: string): Promise<Session> {
56try {
57const expiresAt = new Date();
78}
7980async function getSession(tableName: string, sessionID: string, valSlug: string): Promise<Session> {
81try {
82const { rows, columns } = await sqlite.execute({
105};
106107async function getEmailVerificationCode(tableName: string, email: string) {
108try {
109const { rows, columns } = await sqlite.execute({
169</html>`;
170171export function redirect(location: string): Response {
172return new Response(null, {
173headers: {
188const cookieName = "auth_session";
189190export function emailAuth(
191next: Handler,
192options?: PasswordAuthOptions,
verifyTokenmain.tsx2 matches
1async function fetchUser(token: string): Promise<{ id: string }> {
2const resp = await fetch("https://api.val.town/v1/me", {
3headers: {
13}
1415export async function verifyToken(token: string) {
16try {
17const [currentUser, requestUser] = await Promise.all([fetchUser(Deno.env.get("valtown")), fetchUser(token)]);
vtApiTypesmain.tsx8 matches
501parameters: {
502query?: {
503/** @description The args query parameter can provide arguments to the given val. The parameter needs to be a JSON-encoded array, in which each item in the array is passed to the val as a function parameter. */
504args?: string;
505};
536};
537};
538/** @description Provide arguments to the given val function by including a post body with your request. */
539requestBody?: {
540content: {
566* @description Runs `@{username}.{val_name}` as an Express handler.
567*
568* `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
569*
570* Unlike the other two APIs, the Express API is specified via subdomain and runs at `https://{username}-{val_name}.express.val.run`.
580get: {
581responses: {
582/** @description Function executed successfully */
583200: {
584content: {
604* @description Runs `@{username}.{val_name}` as an Express handler.
605*
606* `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
607*
608* ### Unauthenticated
622};
623responses: {
624/** @description Function executed successfully */
625200: {
626content: {
817/**
818* @description The JavaScript or TypeScript expression to be evaluated.
819* This should be a single expression, like a single function
820* call, assignment operation, or calculation. If you need
821* to execute multiple expressions, wrap them in a function.
822*/
823expression: string;
58});
5960function getHabitifyAreaName(section_id) {
61if (!section_id) {
62return ["undefined", ""];
75}
7677function convertDateObject(due) {
78function convertToISOWithOffset(datetimeStr, timezoneStr) {
79const date = new Date(datetimeStr);
80const [, sign, hours, minutes] = timezoneStr.match(
105return date_as_string;
106}
107async function getCommentsForTask(taskId) {
108try {
109const comments = await todoistapi.getComments({ taskId });
115}
116117async function resizeAndConvertImage(imageBuffer) {
118try {
119const image = await Jimp.read(imageBuffer);
133}
134135async function downloadImage(url) {
136try {
137const response = await fetch(url, {
154}
155156async function createZodSchema(habitKeys, specialPrompt) {
157const transformDate = (date) => {
158if (!date.includes("T")) {
259return z.object({ habits: habitsListSchema });
260}
261function createPrompt(habitKeys_str, specialPrompt) {
262let prompt =
263"You are processing content into a list of habit objects. Based on the options of habits, infer appropriate values for the fields:\n";
287return prompt;
288}
289async function process_text(habits_list, text, specialPrompt) {
290// console.log(habits_list);
291const habitKeys = Object.keys(habits_list);
309}
310311async function addLog(habit_id, unit_type, value, target_date) {
312const url = `https://api.habitify.me/logs/${habit_id}`;
313const headers = {
337}
338}
339async function addTextNote(habit_id, created, content) {
340const url = `https://api.habitify.me/notes/${habit_id}`;
341const headers = {
365}
366367async function addImageNote(habit_id, created_at, imageBuffer) {
368const url = `https://api.habitify.me/notes/addImageNote/${habit_id}?created_at=${encodeURIComponent(created_at)}`;
369const headers = {
390}
391392async function get_habitify_database()
393{
394const habits_list = await blob.getJSON("habitify_database");
454}
455456export default async function(interval: Interval) {
457const habits_list = await get_habitify_database();
458var tasks = await todoistapi.getTasks({
dateme_sqlitemain.tsx3 matches
4import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL";
56export function createTable() {
7return sqlite.execute(`
8CREATE TABLE IF NOT EXISTS DateMeDocs (
33(:Id, :Name, :Profile, :Gender, :Age, :Contact, :LastUpdated, :InterestedIn, :Location, :Style, :LocationFlexibility, :Community, :Contact, :LastUpdated, :WorkEmail, :TrustFund, :SixFive, :BlueEyes)`;
3435export default async function() {
36let docs = await getDocs();
37return Response.json(docs);
38}
3940export async function setupDatabase() {
41await createTable();
42const docs = await fetchJSON(thisWebURL());