Skip to content

Commit

Permalink
Fix voice assistant memory access failing
Browse files Browse the repository at this point in the history
  • Loading branch information
sghpjuikit committed Dec 7, 2024
1 parent c97936e commit 1370253
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/speech-recognition-whisper/util_com.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ def storeMemory(topic: str, memory: str) -> None:
self.save_memory()
def accessMemory(query: str):
# self.mem.update(self.__llmPromptDoc)

mem = {} if self.mem is None else self.mem.copy()
self.write(self.mem)
self.write(self.mem.copy())
self.write(mem)
memKeys = '* ' + "\n* ".join(mem.keys())
memKeyAll = 'all'
memKeyNone = 'none'
Expand All @@ -308,12 +312,13 @@ def accessMemory(query: str):
if canceled is not True:
memKey = memKeyNone
for k in mem.keys():
self.write(f'{key.strip().lower()} =={k.strip().lower()}')
if key.strip().lower()==k.strip().lower():
memKey = k

self.write(f'Accessing memory \'{key}\'')
self.chatAppend({"role": "user", "content": '*waiting*'})
self.generatePythonAndExecuteInternal(f'You accesed your memory and can now reply to the query using the data:\n {mem[k]}')
self.generatePythonAndExecuteInternal(f'You accesed your memory and can now reply to the query using the data:\n {mem[key]}')
except Exception as e:
speak(f'I\'m sorry, I failed to respond: {e}')
raise e
Expand Down

0 comments on commit 1370253

Please sign in to comment.