yizhangliu commited on
Commit
4928dcd
1 Parent(s): 64f9c27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -77,7 +77,13 @@ start_work = """async() => {
77
  window['div_count'] = 0;
78
  window['chat_bot'] = window['gradioEl'].querySelectorAll('#chat_bot')[0];
79
  window['chat_bot1'] = window['gradioEl'].querySelectorAll('#chat_bot1')[0];
 
80
  window['chat_bot1'].children[1].textContent = '';
 
 
 
 
 
81
  window['checkChange'] = function checkChange() {
82
  try {
83
  if (window['chat_bot'].children[2].children[0].children.length > window['div_count']) {
@@ -112,7 +118,7 @@ with gr.Blocks(title='chat with chatgpt') as demo:
112
  start_button.click(fn=None, inputs=[], outputs=[], _js=start_work)
113
 
114
  with gr.Group(elem_id="page_2", visible=False) as page_2:
115
- with gr.Row(elem_id="prompt_row"):
116
  chatbot = gr.Chatbot(elem_id="chat_bot", visible=False).style(color_map=("green", "blue"))
117
  chatbot1 = gr.Chatbot(elem_id="chat_bot1").style(color_map=("green", "blue"))
118
  with gr.Row():
 
77
  window['div_count'] = 0;
78
  window['chat_bot'] = window['gradioEl'].querySelectorAll('#chat_bot')[0];
79
  window['chat_bot1'] = window['gradioEl'].querySelectorAll('#chat_bot1')[0];
80
+ chat_row = window['gradioEl'].querySelectorAll('#chat_row')[0];
81
  window['chat_bot1'].children[1].textContent = '';
82
+
83
+ clientHeight = getClientHeight();
84
+ chat_row.style.height = (clientHeight-200) + 'px';
85
+ window['chat_bot'].style.height = (clientHeight-200) + 'px';
86
+ window['chat_bot1'].style.height = (clientHeight-200) + 'px';
87
  window['checkChange'] = function checkChange() {
88
  try {
89
  if (window['chat_bot'].children[2].children[0].children.length > window['div_count']) {
 
118
  start_button.click(fn=None, inputs=[], outputs=[], _js=start_work)
119
 
120
  with gr.Group(elem_id="page_2", visible=False) as page_2:
121
+ with gr.Row(elem_id="chat_row"):
122
  chatbot = gr.Chatbot(elem_id="chat_bot", visible=False).style(color_map=("green", "blue"))
123
  chatbot1 = gr.Chatbot(elem_id="chat_bot1").style(color_map=("green", "blue"))
124
  with gr.Row():