hugforziio commited on
Commit
11018e3
1 Parent(s): 4945d00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -164,6 +164,9 @@ def on_click_send_btn(
164
  def clear_history():
165
  return [], ""
166
 
 
 
 
167
 
168
  css = """
169
  .table-wrap .cell-wrap input {min-width:80%}
@@ -246,8 +249,16 @@ with gradio.Blocks(title="ChatGPT", css=css) as demo:
246
  with gradio.Row():
247
  with gradio.Column(scale=10):
248
  chat_log = gradio.State()
249
- with gradio.Box():
250
- chat_log_box = gradio.Markdown(label='chat history')
 
 
 
 
 
 
 
 
251
  chat_input_role = gradio.Dropdown(lines=1, label='role', choices=['user', 'system', 'assistant'], value='user')
252
  chat_input = gradio.Textbox(lines=4, label='input')
253
  with gradio.Row():
 
164
  def clear_history():
165
  return [], ""
166
 
167
+ def copy_history():
168
+ pass
169
+
170
 
171
  css = """
172
  .table-wrap .cell-wrap input {min-width:80%}
 
249
  with gradio.Row():
250
  with gradio.Column(scale=10):
251
  chat_log = gradio.State()
252
+ with gradio.Box(label='chat history'):
253
+ chat_log_box = gradio.Markdown(value="<center>(empty)</center>")
254
+ chat_copy_history_btn = gradio.Button("Copy all (as html currently)")
255
+ chat_copy_history_btn.click(
256
+ copy_history, inputs=[chat_log_box],
257
+ _js="""(txt)=>{
258
+ try {let promise = navigator?.clipboard?.writeText?.(txt);}
259
+ catch(error) {console?.log?.(error);};
260
+ }""",
261
+ )
262
  chat_input_role = gradio.Dropdown(lines=1, label='role', choices=['user', 'system', 'assistant'], value='user')
263
  chat_input = gradio.Textbox(lines=4, label='input')
264
  with gradio.Row():