From 4c93d96ae92604c25f241904985639fade3eba21 Mon Sep 17 00:00:00 2001 From: Eri Date: Thu, 14 Aug 2025 19:52:57 +0200 Subject: [PATCH] configurable timeout --- index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 4edb71f..c82e3c7 100644 --- a/index.js +++ b/index.js @@ -76,7 +76,12 @@ async function buildMessageHistory(message, maxDepth = 10) { return history; } -async function generateResponse(prompt, username, messageHistory = []) { +async function generateResponse( + prompt, + username, + messageHistory = [], + timeout, +) { try { const systemPrompt = config.assistant.system_prompt .replace("${name}", config.assistant.name) @@ -106,7 +111,7 @@ async function generateResponse(prompt, username, messageHistory = []) { }, }, { - timeout: 60000, + timeout: config.advanced.timeout, }, ); @@ -203,7 +208,12 @@ client.on(Events.MessageCreate, async (message) => { ); } - const response = await generateResponse(prompt, username, messageHistory); + const response = await generateResponse( + prompt, + username, + messageHistory, + config.advanced.timeout, + ); if (response.length > 2000) { const chunks = [];