minor fixes
This commit is contained in:
parent
abc91a72f9
commit
b8f30e98f3
@ -6,7 +6,7 @@ from streamlit_chat import message
|
|||||||
from src.utils.agi.bard import BardChat
|
from src.utils.agi.bard import BardChat
|
||||||
from src.utils.agi.chat_gpt import create_gpt_completion
|
from src.utils.agi.chat_gpt import create_gpt_completion
|
||||||
from src.utils.stt import show_voice_input
|
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:
|
def clear_chat() -> None:
|
||||||
@ -63,7 +63,7 @@ def show_gpt_conversation() -> None:
|
|||||||
if ai_content:
|
if ai_content:
|
||||||
show_chat(ai_content, st.session_state.user_text)
|
show_chat(ai_content, st.session_state.user_text)
|
||||||
st.divider()
|
st.divider()
|
||||||
show_player(ai_content)
|
show_audio_player(ai_content)
|
||||||
except InvalidRequestError as err:
|
except InvalidRequestError as err:
|
||||||
if err.code == "context_length_exceeded":
|
if err.code == "context_length_exceeded":
|
||||||
st.session_state.messages.pop(1)
|
st.session_state.messages.pop(1)
|
||||||
|
@ -4,7 +4,7 @@ import streamlit as st
|
|||||||
from gtts import gTTS, gTTSError
|
from gtts import gTTS, gTTSError
|
||||||
|
|
||||||
|
|
||||||
def show_player(ai_content: str) -> None:
|
def show_audio_player(ai_content: str) -> None:
|
||||||
sound_file = BytesIO()
|
sound_file = BytesIO()
|
||||||
try:
|
try:
|
||||||
tts = gTTS(text=ai_content, lang=st.session_state.locale.lang_code)
|
tts = gTTS(text=ai_content, lang=st.session_state.locale.lang_code)
|
||||||
|
Loading…
Reference in New Issue
Block a user