Public
Back
Version 37
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 getSummary = (prompt, content) => {
prompt = prompt || "Summarize this article in 30 words, focusing on the primary author. Do not respond with JSON or XML or stage instructions. Only reply in text. Text:"
let result = ai.gen({
provider: "openai",
model: "gpt-3.5-turbo",
prompt: prompt + content
})
}
export const getTags = (prompt, content) => {
yawnxyz-getcontentfromurl.web.val.run
Updated: August 24, 2024