Skip to content

Commit

Permalink
Implement Voice Assistant speak declaring emotion
Browse files Browse the repository at this point in the history
Speaking does not take this into consideration, this is for text ui only
  • Loading branch information
sghpjuikit committed Jan 11, 2025
1 parent 7adf744 commit d0d6dda
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/speech-recognition-whisper/util_com.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,10 @@ def generate(c: str):
def print(t: object):
# alias for speak, because LLM likes to use print instead of speak too much
speak(t)
def speak(t: object):
def speak(t: object, emotion: str | None = None):
if t is None: return;
assertSkip()
if emotion is not None: self.write(f"*{emotion}*")
self.api.ttsSkippable(f'{t}'.removeprefix('"').removesuffix('"'), location).result()
def body(t: str):
assertSkip()
Expand All @@ -346,10 +347,10 @@ def speakCurrentDate(): command('what date is it')
def speakCurrentSong(): command('what song is active')
def speakDefinition(t: str): command('describe ' + t)
def thinkPassive(*thoughts: str):
t = ''.join(map(lambda t: '\n*' + str(t) + "*", thoughts))
t = thoughts[0] if len(thoughts)==1 else ''.join(map(lambda t: '\n*' + str(t) + "*", thoughts))
self.write(f'~{t}~')
def think(*thoughts: str):
t = ''.join(map(lambda t: '\n*' + str(t), thoughts))
t = thoughts[0] if len(thoughts)==1 else ''.join(map(lambda t: '\n*' + str(t), thoughts))

# self.generatePythonAndExecute('System', 'My thoughts are:' + ''.join(map(lambda t: '\n* ' + str(t), thoughts)))

Expand Down Expand Up @@ -618,8 +619,8 @@ def promptFuns(self) -> str:
```
def body(action: str) -> None:
'controls your physical body to do any single physical action except speaking i.e. body("look up"), body("move closer")'
def speak(your_speech_to_user: str) -> None:
'speak speech-like text out loud (use phonetic words, ideally single sentence per line, specify terms/signs/values as words). Speak single sentence. Use multiple calls for multiple sentences
def speak(your_speech_to_user: str, emotion: str | None = None) -> None:
'speak speech-like text out loud (use phonetic words, ideally single sentence per line, specify terms/signs/values as words). Speak single sentence. Use multiple calls for multiple sentences. Specify emotion when speaking other than normal.
def doNothing(reason: str = '') -> None:
'does nothing, useful to stop engaging with user, optionally pass reason'
def accessMemory(query: str) -> None:
Expand Down

0 comments on commit d0d6dda

Please sign in to comment.