Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tts support (WIP) #456

Merged
merged 5 commits into from
Nov 18, 2023
Merged

tts support (WIP) #456

merged 5 commits into from
Nov 18, 2023

Conversation

gilcu3
Copy link
Contributor

@gilcu3 gilcu3 commented Nov 8, 2023

This PR depends on #453. It adds support for the current tts models from openai. Feel free to try and let me know if anything breaks.

@rokipet
Copy link

rokipet commented Nov 9, 2023

Hello im in window i get this error how to fix it ? 2023-11-09 11:21:27,978 - root - ERROR - ⚠️ An error has occurred. ⚠️
[Errno 13] Permission denied: 'C:\Users\ADMINI1\AppData\Local\Temp\2\tmprutw7r3l'
Traceback (most recent call last):
File "C:\Users\Administrator\Downloads\Bot Updated\chatgpt-telegram-bot-
086f844\bot\openai_helper.py", line 366, in generate_speech
response.stream_to_file(temp_file.name)
File "C:\Program Files\Python311\Lib\site-packages\openai_base_client.py", line 1731, in stream_to_file
with open(file, mode="wb") as f:
^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\Users\ADMINI
1\AppData\Local\Temp\2\tmprutw7r3l'

Failed to generate speech: ⚠️ An error has occurred. ⚠️
Errno 13 Permission denied: 'C:\Users\ADMINI~1\AppData\Local\Temp\2\tmprutw7r3l'

@gilcu3
Copy link
Contributor Author

gilcu3 commented Nov 9, 2023

Hello im in window i get this error how to fix it ? 2023-11-09 11:21:27,978 - root - ERROR - ⚠️ An error has occurred. ⚠️ [Errno 13] Permission denied: 'C:\Users\ADMINI1\AppData\Local\Temp\2\tmprutw7r3l' Traceback (most recent call last): File "C:\Users\Administrator\Downloads\Bot Updated\chatgpt-telegram-bot- 086f844\bot\openai_helper.py", line 366, in generate_speech response.stream_to_file(temp_file.name) File "C:\Program Files\Python311\Lib\site-packages\openai_base_client.py", line 1731, in stream_to_file with open(file, mode="wb") as f: ^^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied: 'C:\Users\ADMINI1\AppData\Local\Temp\2\tmprutw7r3l'

Failed to generate speech: ⚠️ An error has occurred. ⚠️ Errno 13 Permission denied: 'C:\Users\ADMINI~1\AppData\Local\Temp\2\tmprutw7r3l'

Ups, I did not know Windows would have issues with temporal files... I will change that to use files in memory, it will be more portable. Wait for my next commit on this branch.

@gilcu3
Copy link
Contributor Author

gilcu3 commented Nov 9, 2023

@rokipet You can test now

@rokipet
Copy link

rokipet commented Nov 10, 2023

thanks that worked

@Gigabytedru
Copy link

Gigabytedru commented Nov 14, 2023

I can't figure out how to use tts! is there an instruction? please

@gilcu3
Copy link
Contributor Author

gilcu3 commented Nov 14, 2023

I can't figure out how to use tts! is there an instruction? please

If you cloned this branch, you can use it with /tts "any text to read"

@Gigabytedru
Copy link

I have a question, can I receive responses from the GPT chat in the format of MP3 in my Telegram bot?

@gilcu3
Copy link
Contributor Author

gilcu3 commented Nov 14, 2023

I have a question, can I receive responses from the GPT chat in the format of MP3 in my Telegram bot?

It is technically possible, but not implemented yet. What's your use-case?

@kithawk
Copy link

kithawk commented Nov 17, 2023

I have a question, can I receive responses from the GPT chat in the format of MP3 in my Telegram bot?

It is technically possible, but not implemented yet. What's your use-case?

I can imagine a workflow when bot answers a query not with text but TTS voice message directly (so, even sending back and forth voice messages between the user and bot). Something like REPLY_WITH_TTS=true

@gilcu3
Copy link
Contributor Author

gilcu3 commented Nov 17, 2023

I can imagine a workflow when bot answers a query not with text but TTS voice message directly (so, even sending back and forth voice messages between the user and bot). Something like REPLY_WITH_TTS=true

I see the point now, I thought it was about the format of the message, which is currently a voice message, but could also be just an mp3 file. Regarding adding support for REPLY_WITH_TTS=true I think it could be a good idea, if you can open an issue pointing that out so that it can get implemented later once this is merge and the code stabilizes.

@n3d1117
Copy link
Owner

n3d1117 commented Nov 18, 2023

Thanks @gilcu3! Tested this and seems to work great, made a couple of fixes and aligned all translations. Merging now! Feel free to open a separate PR for further improvements

@n3d1117 n3d1117 merged commit 8fd24a9 into n3d1117:main Nov 18, 2023
@gilcu3 gilcu3 deleted the tts-support branch November 18, 2023 16:16
@Jipok
Copy link

Jipok commented Nov 24, 2023

I can imagine a workflow when bot answers a query not with text but TTS voice message directly...

Like this #468 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants