chore: first commit

This commit is contained in:
Han Xiao 2025-02-04 23:02:17 +08:00
parent f8bb0b4c1a
commit a83bff0feb
2 changed files with 3 additions and 2 deletions

View File

@ -13,7 +13,7 @@ import {
SEARCH_PROVIDER,
STEP_SLEEP,
modelConfigs,
DEFAULT_BUDGET_SPLIT_RATIO
DEFAULT_BUDGET_SPLIT_RATIO, MAX_RECURSION_DEPTH
} from "./config";
import {TokenTracker} from "./utils/token-tracker";
import {ActionTracker} from "./utils/action-tracker";
@ -291,6 +291,7 @@ export async function getResponse(question: string, tokenBudget: number = 1_000_
console.log(`| Recursion ${recursionLevel} | Step ${totalStep} | Token Budget ${tokenBudget} | Budget Used: ${budgetPercentage}% | Q: ${currentQuestion} |`);
// update all urls with buildURLMap
allowReflect = allowReflect && (recursionLevel < MAX_RECURSION_DEPTH);
allowRead = allowRead && (Object.keys(allURLs).length > 0);
allowSearch = allowSearch && (Object.keys(allURLs).length < 20); // disable search when too many urls already

View File

@ -68,7 +68,7 @@ export const modelConfigs: ToolConfigs = {
export const STEP_SLEEP = 1000;
export const DEFAULT_BUDGET_SPLIT_RATIO = 0.3; // Each sub-question gets 30% of parent's budget
export const MAX_RECURSION_DEPTH = 3;
if (!GEMINI_API_KEY) throw new Error("GEMINI_API_KEY not found");
if (!JINA_API_KEY) throw new Error("JINA_API_KEY not found");