saveSomeAPIcalls

This commit is contained in:
SpudGunMan
2024-09-04 00:50:57 -07:00
parent 1ce394c7a1
commit ec078666ae
2 changed files with 11 additions and 4 deletions
+10 -4
View File
@@ -106,11 +106,17 @@ def handle_wiki(message):
return "Please add a search term example:wiki: travelling gnome"
def handle_llm(message_from_id, channel_number, deviceID, message, publicChannel):
global llmRunCounter, llmTotalRuntime
location = get_node_location(message_from_id, deviceID)
global llmRunCounter, llmTotalRuntime, llmLocationTable
if location_enabled:
location_name = where_am_i(str(location[0]), str(location[1]), short = True)
location = get_node_location(message_from_id, deviceID)
# if message_from_id is is the llmLocationTable use the location from the table to save on API calls
if message_from_id in llmLocationTable:
location = llmLocationTable[message_from_id]
else:
location_name = where_am_i(str(location[0]), str(location[1]), short = True)
llmLocationTable.append({message_from_id: location_name})
if NO_DATA_NOGPS in location_name:
location_name = "no location provided "
else:
+1
View File
@@ -28,6 +28,7 @@ scheduler_enabled = False # enable the scheduler currently config via code only
wiki_return_limit = 3 # limit the number of sentences returned off the first paragraph first hit
llmRunCounter = 0
llmTotalRuntime = []
llmLocationTable = []
# Read the config file, if it does not exist, create basic config file
config = configparser.ConfigParser()