configurable timeout

This commit is contained in:
Eri Ishihara 2025-08-14 19:52:57 +02:00
parent 2d4f3e91a6
commit 4c93d96ae9

View file

@ -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 = [];