minor fixes

This commit is contained in:
if 2023-04-15 23:03:29 +03:00
parent abc91a72f9
commit b8f30e98f3
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ from streamlit_chat import message
from src.utils.agi.bard import BardChat
from src.utils.agi.chat_gpt import create_gpt_completion
from src.utils.stt import show_voice_input
from src.utils.tts import show_player
from src.utils.tts import show_audio_player
def clear_chat() -> None:
@ -63,7 +63,7 @@ def show_gpt_conversation() -> None:
if ai_content:
show_chat(ai_content, st.session_state.user_text)
st.divider()
show_player(ai_content)
show_audio_player(ai_content)
except InvalidRequestError as err:
if err.code == "context_length_exceeded":
st.session_state.messages.pop(1)

View File

@ -4,7 +4,7 @@ import streamlit as st
from gtts import gTTS, gTTSError
def show_player(ai_content: str) -> None:
def show_audio_player(ai_content: str) -> None:
sound_file = BytesIO()
try:
tts = gTTS(text=ai_content, lang=st.session_state.locale.lang_code)