IdkdeepResearchAgent.ts7 matches
15* 3. Compiling findings into a comprehensive report
16*/
17export default async function(req: Request): Promise<Response> {
18console.log("Received request:", req.method, req.url);
19
101}
102103// Only accept POST requests for API functionality
104if (req.method !== "POST") {
105return new Response(JSON.stringify({ error: "Method not allowed" }), {
169* Conducts comprehensive research on a topic
170*/
171async function conductResearch(topic: string, depth: "light" | "medium" | "deep" = "medium"): Promise<ResearchReport> {
172// Step 1: Break down the topic into subtopics
173const subtopics = await generateSubtopics(topic, depth);
194* Generates a list of subtopics for the main research topic
195*/
196async function generateSubtopics(topic: string, depth: string): Promise<string[]> {
197const depthMap = {
198"light": 3,
263* Generates default subtopics if the AI-generated ones fail
264*/
265function generateDefaultSubtopics(topic: string, count: number): string[] {
266const defaultSubtopics = [
267`Overview of ${topic}`,
283* Researches a specific subtopic in detail
284*/
285async function researchSubtopic(mainTopic: string, subtopic: string, depth: string): Promise<SubtopicResearch> {
286const depthMap = {
287"light": 300,
327* Generates an executive summary based on all the research
328*/
329async function generateExecutiveSummary(topic: string, subtopicResearch: SubtopicResearch[]): Promise<string> {
330try {
331// Create a condensed version of the research to fit within token limits
IdksimpleTest.ts1 match
2* Simple test to verify that HTTP endpoints are working
3*/
4export default function(req: Request): Response {
5const html = `<!DOCTYPE html>
6<html lang="en">
IdktestAgent.ts1 match
3* This will make a simple request to the agent and log the results
4*/
5export default async function(req: Request): Promise<Response> {
6try {
7// Get the URL of the current request to determine the agent URL
1016. **Check Response Format**: If you're calling the API directly, ensure your request format is correct.
1021037. **Run the Test Endpoint**: Use the test endpoint to verify basic functionality.
104105## Customization
107You can modify the agent to suit your specific research needs:
108109- Adjust the number of subtopics based on depth in the `generateSubtopics` function
110- Change the word count for each subtopic in the `researchSubtopic` function
111- Modify the system prompts to focus on specific aspects of research
112
IdkresearchInterface.ts2 matches
4* A simple web interface to interact with the Deep Research Agent
5*/
6export default function(req: Request): Response {
7// Get the current URL to determine the agent URL
8const url = new URL(req.url);
113<script>
114// Simple markdown parser
115function parseMarkdown(text) {
116if (!text) return '';
117
New-Tweet-Alertmain.tsx3 matches
70}
7172export default async function(req: Request): Promise<Response> {
73if (req.method !== "POST") {
74return new Response("This Val can only process POST requests from SocialData", {
104}
105106async function sendEventToTelegram(event: NewTweetEvent): Promise<void> {
107const tweet = event.data;
108const user = tweet.user;
169}
170171async function sendPhotoToTelegram(photoUrl: string): Promise<void> {
172const telegramApiUrl = `https://api.telegram.org/bot${telegramBotApiToken}/sendPhoto`;
173
TownieuseUser.tsx1 match
3const USER_ENDPOINT = "/api/user";
45export function useUser() {
6const [data, setData] = useState<any>(null);
7const [loading, setLoading] = useState(true);
TownieuseUsageStats.ts1 match
1import { useEffect } from "react";
23export function useUsageStats(messages: any[], usages: any[]) {
4useEffect(() => {
5if (!messages?.length) return;
TownieuseScrollToBottom.tsx3 matches
7*
8* @param {Array} dependencies - Array of dependencies that trigger scrolling when changed
9* @returns {Object} An object containing containerRef and scrollToBottom function
10*/
11export function useScrollToBottomContainer(dependencies = []) {
12const containerRef = useRef(null);
132829// body scroll version
30export function useScrollToBottom(dependencies = []) {
31const bottomRef = useRef(null);
32
Townieuser-summary.ts1 match
6* This includes a fallback to inference calls data when usage data is missing
7*/
8export async function getUserSummary() {
9// First, get the standard grouped data from the usage table
10const groupedUsageData = await sqlite.execute(`