update
Browse files
app.py
CHANGED
@@ -148,13 +148,19 @@ with gr.Blocks(title="LLM with TTS",head=head) as demo:
|
|
148 |
js = """
|
149 |
function(chatbot){
|
150 |
window.update_chatbot(chatbot)
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
//text = (chatbot[chatbot.length -1])["content"]
|
152 |
//tts_text = window.replaceSpecialChars(text)
|
153 |
//console.log(tts_text)
|
154 |
//window.MatchaTTSEn(tts_text,"/file=models/ljspeech_sim.onnx")
|
155 |
}
|
156 |
"""
|
157 |
-
chatbot = gr.Chatbot(type="messages")
|
158 |
chatbot.change(None,[chatbot],[],js=js)
|
159 |
msg = gr.Textbox()
|
160 |
with gr.Row():
|
|
|
148 |
js = """
|
149 |
function(chatbot){
|
150 |
window.update_chatbot(chatbot)
|
151 |
+
var chatElement = document.getElementById('gr-chatbot');
|
152 |
+
console.log(chatElement.scrollHeight)
|
153 |
+
chatElement.scrollTop = chatElement.scrollHeight;
|
154 |
+
var logElement = chatElement.querySelector('div[role="log"]');
|
155 |
+
logElement.scrollTop = chatElement.scrollHeight;
|
156 |
+
|
157 |
//text = (chatbot[chatbot.length -1])["content"]
|
158 |
//tts_text = window.replaceSpecialChars(text)
|
159 |
//console.log(tts_text)
|
160 |
//window.MatchaTTSEn(tts_text,"/file=models/ljspeech_sim.onnx")
|
161 |
}
|
162 |
"""
|
163 |
+
chatbot = gr.Chatbot(type="messages",elem_id="gr-chatbot")
|
164 |
chatbot.change(None,[chatbot],[],js=js)
|
165 |
msg = gr.Textbox()
|
166 |
with gr.Row():
|