Public
Back
Version 57
6/13/2024
/** @jsx jsx */
import { jsx } from "https://deno.land/x/hono@v3.11.7/middleware.ts";
import { Hono } from "https://deno.land/x/hono@v3.11.7/mod.ts";
import { ai } from "https://esm.town/v/yawnxyz/ai";
const app = new Hono();
export const getContentFromUrl = async (url: string) => {
try {
if (url.includes("youtube")) {
url = `https://val.markdown.download/?url=${url}`;
}
url = "https://r.jina.ai/" + url
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const data = await response.text();
return data;
} catch (error) {
console.error('Error fetching the URL:', error);
return 'Error fetching the content.';
}
};
export const getBlurbFromUrl = async (url: string, {
getSummary=true, getSummaryPrompt, getTags=true, getTagsPrompt, getEmbeddings} = {}) => {
const content = await getContentFromUrl(url);
if(!getSummary || !getTags) {
return content;
}
let summary, tags
if(getSummary) {
summary = await getSummaryFn(getSummaryPrompt, content);
yawnxyz-getcontentfromurl.web.val.run
Updated: August 24, 2024