mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-27 21:01:03 +08:00
Fix review comments: use performance.now() for cache TTL, pass mcpToolName to getTools()
Co-Authored-By: mantra <mantra@stack-auth.com>
This commit is contained in:
parent
554dd9007c
commit
e0dc388c64
@ -63,7 +63,11 @@ export const POST = createSmartRouteHandler({
|
||||
systemPrompt += await getVerifiedQaContext();
|
||||
}
|
||||
systemPrompt += await getMcpSkillContextPrompt(body.mcpCallMetadata?.toolName);
|
||||
const tools = await getTools(toolNames, { auth: fullReq.auth, targetProjectId: projectId });
|
||||
const tools = await getTools(toolNames, {
|
||||
auth: fullReq.auth,
|
||||
targetProjectId: projectId,
|
||||
mcpToolName: body.mcpCallMetadata?.toolName,
|
||||
});
|
||||
const toolsArg = Object.keys(tools).length > 0 ? tools : undefined;
|
||||
const isCreateDashboard = systemPromptId === "create-dashboard";
|
||||
const isBuildAnalyticsQuery = systemPromptId === "build-analytics-query";
|
||||
|
||||
@ -5,7 +5,7 @@ const CACHE_TTL_MS = 5 * 60 * 1_000; // 5 minutes
|
||||
let cachedDocs: { text: string, fetchedAt: number } | null = null;
|
||||
|
||||
async function fetchDocsText(): Promise<string> {
|
||||
const now = Date.now();
|
||||
const now = performance.now();
|
||||
if (cachedDocs && now - cachedDocs.fetchedAt < CACHE_TTL_MS) {
|
||||
return cachedDocs.text;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user