jianghuyihei commited on
Commit
5366e5c
1 Parent(s): 8b7eba7
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -372,6 +372,7 @@ def generate_user_id(ip: str) -> str:
372
  def reset_counter():
373
  global reply_count
374
  reply_count = 0
 
375
 
376
  # 设置定时任务每天0点重置计数器
377
  scheduler = BackgroundScheduler()
@@ -459,7 +460,6 @@ def form_post(request: Request,topic: str = Form(...), user_id: str = Form(...),
459
  script = script_template.format(user_id=user_id, state=state)
460
  return Template(html_template).render(idea="", error=error_message, reply_count=reply_count, button_text="Generate",loading_text="Generating content, Usually takes 3-4 minutes, please wait...",script=script)
461
 
462
- print(f"current0 user_id={user_id}, state={state}")
463
  loading_text = "Generating content, Usually takes 3-4 minutes, please wait..."
464
  if state == "generate":
465
  if not queue.empty():
@@ -491,7 +491,7 @@ def form_post(request: Request,topic: str = Form(...), user_id: str = Form(...),
491
  queue_len = queue.qsize()
492
 
493
  script = script_template.format(user_id=user_id, state=new_state)
494
- print(f"current2 user_id={user_id}, state={new_state}")
495
  # 判断当前是否轮到该用户,如果没轮到则一直等待到轮到为止
496
  print(queue.queue[0], [user_id,topic])
497
  while queue.queue[0] != user_id:
 
372
  def reset_counter():
373
  global reply_count
374
  reply_count = 0
375
+ queue.queue.clear()
376
 
377
  # 设置定时任务每天0点重置计数器
378
  scheduler = BackgroundScheduler()
 
460
  script = script_template.format(user_id=user_id, state=state)
461
  return Template(html_template).render(idea="", error=error_message, reply_count=reply_count, button_text="Generate",loading_text="Generating content, Usually takes 3-4 minutes, please wait...",script=script)
462
 
 
463
  loading_text = "Generating content, Usually takes 3-4 minutes, please wait..."
464
  if state == "generate":
465
  if not queue.empty():
 
491
  queue_len = queue.qsize()
492
 
493
  script = script_template.format(user_id=user_id, state=new_state)
494
+
495
  # 判断当前是否轮到该用户,如果没轮到则一直等待到轮到为止
496
  print(queue.queue[0], [user_id,topic])
497
  while queue.queue[0] != user_id: