lugia19/Echo-XI

Syntax error for Windows 10

Closed this issue · 3 comments

It might just be my setup but the helper.py file errored out for my (Windows10) I had to change lines:

#27 defaultConfig: dict[str, str | int| list|float] = {
#167 def get_provider_config(provider: SpeechRecProvider | TTSProvider) -> dict[str, str|float|bool|int|list]:
#185 def update_provider_config(provider: SpeechRecProvider | TTSProvider, providerConfig:dict):

To
defaultConfig: Dict[str, Union[str, int, list, float]] = {
def get_provider_config(provider: Union[SpeechRecProvider, TTSProvider]) -> Dict[str, Union[str, float, bool, int, list]]:
def update_provider_config(provider: Union[SpeechRecProvider, TTSProvider], providerConfig: dict):

respectively and also
from typing import Dict, Union, Mapping

Something about in Python, the | is used for bitwise OR operations, not for defining the type of a value in a dictionary

Now it works like a charm! Great Job!

Ah, I see now. No, | is used for type hints as well, the problem is that it's a feature introduced with python 3.10, so if you're running an earlier version it won't work. I'll fix it.

Oh awesome! Btw, in the code you wrote:

If you want to do anything with the text (like sending it off to chatGPT and playing back the response instead) this is where you do it.

Could you give an example of how to send the 'recognizedText' to the new 3.5-turbo openai api and use that response in the code? Thanks!

You can look at openAI's documentation for an example. The only thing you need to do for the TTS to speak the response rather than what you spoke is to change the call to the TTSProvider's function to use the response.

I'll mark this as closed for now, I'll update the script to use unions instead soon.