From 335b01287e4e69feb2dfa5c244a6f3b5fc278141 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Tue, 2 May 2023 14:15:45 +0200 Subject: [PATCH] Moving REFRESH_INTERVAL to .env --- default.env | 3 +++ llamabot.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/default.env b/default.env index 6723905..34673cc 100644 --- a/default.env +++ b/default.env @@ -7,6 +7,9 @@ CACHE = 1 N_THREADS = 4 MAX_TOKENS = 1024 +# Bot specific settings +REFRESH_INTERVAL=7 + # ROOT_IP is only used when running the bot without docker compose ROOT_IP = 192.168.0.15 diff --git a/llamabot.js b/llamabot.js index dbffa96..efc0128 100644 --- a/llamabot.js +++ b/llamabot.js @@ -241,8 +241,8 @@ async function generateResponse(conversation, message) { // call the function initially await showSystemLoad(); - // refresh the system load percentage and update the message every 7 seconds - const refreshInterval = setInterval(showSystemLoad, 7000); + // Grab the REFRESH_INTERVAL from ENV if not exist, lets use 7 (seconds) + const refreshInterval = setInterval(showSystemLoad, (process.env.REFRESH_INTERVAL || 7) * 1000); try { const response = await fetch(`http://${process.env.ROOT_IP}:${process.env.ROOT_PORT}/v1/chat/completions`, {