Omnibus commited on
Commit
2a53bd8
·
verified ·
1 Parent(s): 2fd7c54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -185,12 +185,12 @@ def reply_generate(prompt, history,post_check,full_conv, agent_name=agents[0], s
185
  output += response.token.text
186
  history.append((output,None))
187
 
188
- comment_cnt=post_check['comment']
189
  print(type(comment_cnt))
190
- post_check['comment']=comment_cnt+1
191
  #out_json = {'user':"",'datetime':current_time,'title':title,'blog':1,'comment':0,'reply':0,"prompt":prompt,"output":output}
192
  #full_conv[-1]+=(output,)
193
- full_conv.append((None,output,None))
194
  html_out=load_html(full_conv,None)
195
 
196
  #history.append((output,history))
@@ -344,6 +344,7 @@ def generate(prompt, history, post_check,full_conv, agent_name=agents[0], sys_pr
344
  prompt=prompt.strip(' \"')
345
 
346
  formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
 
347
 
348
  if len(formatted_prompt) < (40000):
349
  print(len(formatted_prompt))
@@ -353,15 +354,20 @@ def generate(prompt, history, post_check,full_conv, agent_name=agents[0], sys_pr
353
  output = ""
354
  #if history:
355
  # yield history
356
-
 
 
 
357
  for response in stream:
358
  output += response.token.text
359
- yield '', [(prompt,output)],post_check,full_conv,summary[0],json_obj, json_hist,html_out
360
 
361
  if not title:
362
  for line in output.split("\n"):
363
  if "title" in line.lower() and ":" in line.lower():
364
  title = line.split(":")[1]
 
 
365
  print(f'title:: {title}')
366
  filename=create_valid_filename(f'{current_time}---{title}')
367
 
@@ -406,7 +412,7 @@ def generate(prompt, history, post_check,full_conv, agent_name=agents[0], sys_pr
406
 
407
 
408
  #prompt = question_generate(output, history)
409
- #main_point[0]=prompt
410
  full_conv.append((output,None,None))
411
 
412
 
 
185
  output += response.token.text
186
  history.append((output,None))
187
 
188
+ reply_cnt=post_check['reply']
189
  print(type(comment_cnt))
190
+ post_check['reply']=reply_cnt+1
191
  #out_json = {'user':"",'datetime':current_time,'title':title,'blog':1,'comment':0,'reply':0,"prompt":prompt,"output":output}
192
  #full_conv[-1]+=(output,)
193
+ full_conv.append((None,None,output))
194
  html_out=load_html(full_conv,None)
195
 
196
  #history.append((output,history))
 
344
  prompt=prompt.strip(' \"')
345
 
346
  formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
347
+
348
 
349
  if len(formatted_prompt) < (40000):
350
  print(len(formatted_prompt))
 
354
  output = ""
355
  #if history:
356
  # yield history
357
+ if not prompt:
358
+ prompt_out == None
359
+ else:
360
+ prompt_out=prompt
361
  for response in stream:
362
  output += response.token.text
363
+ yield "", [(prompt_out,output)],post_check,full_conv,summary[0],json_obj, json_hist,html_out
364
 
365
  if not title:
366
  for line in output.split("\n"):
367
  if "title" in line.lower() and ":" in line.lower():
368
  title = line.split(":")[1]
369
+ if title.startswith(' \"'):
370
+ title=title.strip(' \"')
371
  print(f'title:: {title}')
372
  filename=create_valid_filename(f'{current_time}---{title}')
373
 
 
412
 
413
 
414
  #prompt = question_generate(output, history)
415
+ #main_point[0]=output
416
  full_conv.append((output,None,None))
417
 
418