jianghuyihei commited on
Commit
179fcee
1 Parent(s): 867ffb5
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -421,8 +421,19 @@ def form_post(topic: str = Form(...), user_id: str = Form(...), state: str = For
421
  error_message = "There are currently {} requests being processed. If you want to queue, please write your original topic and click the Continue button and you will enter the queue.".format(queue_len)
422
  new_state = "continue"
423
  new_button_text = "Continue"
424
- script = script_template.format(user_id=user_id, state=new_state)
 
 
 
 
 
 
 
 
 
 
425
  print(f"current1 user_id={user_id}, state={new_state}")
 
426
  return Template(html_template).render(idea="", error=error_message, reply_count=reply_count, button_text=new_button_text,loading_text=f"Generating content, Usually takes {(queue_len+1)*3}-{(queue_len+1)*4} minutes, please wait...",script=script)
427
 
428
  queue.put([user_id,topic])
 
421
  error_message = "There are currently {} requests being processed. If you want to queue, please write your original topic and click the Continue button and you will enter the queue.".format(queue_len)
422
  new_state = "continue"
423
  new_button_text = "Continue"
424
+ script = f"""
425
+ function setstate() {{
426
+ document.getElementById("user_id").value = "{user_id}";
427
+ document.getElementById("state").value = "{state}";
428
+ let userId = document.getElementById("user_id").value;
429
+ let state = document.getElementById("state").value;
430
+ console.log(`1 User ID: ${{userId}}, State: ${{state}}`);
431
+ document.getElementById("topic").value = "{topic}";
432
+ }}
433
+ window.onload = setstate;
434
+ """
435
  print(f"current1 user_id={user_id}, state={new_state}")
436
+
437
  return Template(html_template).render(idea="", error=error_message, reply_count=reply_count, button_text=new_button_text,loading_text=f"Generating content, Usually takes {(queue_len+1)*3}-{(queue_len+1)*4} minutes, please wait...",script=script)
438
 
439
  queue.put([user_id,topic])