Update app.py
Browse files
app.py
CHANGED
@@ -176,6 +176,8 @@ def generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0
|
|
176 |
#print(datetime.datetime.now())
|
177 |
uid=uuid.uuid4()
|
178 |
current_time = str(datetime.datetime.now())
|
|
|
|
|
179 |
|
180 |
current_time=current_time.replace(":","-")
|
181 |
current_time=current_time.replace(".","-")
|
@@ -191,7 +193,6 @@ def generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0
|
|
191 |
json_hist={}
|
192 |
json_obj={}
|
193 |
full_conv=[]
|
194 |
-
filename=create_valid_filename(f'{prompt}---{current_time}')
|
195 |
post_cnt=1
|
196 |
while True:
|
197 |
seed = random.randint(1,1111111111111111)
|
@@ -208,6 +209,7 @@ def generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0
|
|
208 |
prompt=prompt.strip(' \"')
|
209 |
|
210 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
|
|
211 |
post_cnt+=1
|
212 |
else:
|
213 |
system_prompt=prompts.REPLY_TO_COMMENTER.format(focus=main_point[0])
|
@@ -236,6 +238,14 @@ def generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0
|
|
236 |
for response in stream:
|
237 |
output += response.token.text
|
238 |
yield '', [(prompt,output)],summary[0],json_obj, json_hist,html_out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
out_json = {"prompt":prompt,"output":output}
|
240 |
|
241 |
prompt = question_generate(output, history)
|
|
|
176 |
#print(datetime.datetime.now())
|
177 |
uid=uuid.uuid4()
|
178 |
current_time = str(datetime.datetime.now())
|
179 |
+
title=""
|
180 |
+
filename=create_valid_filename(f'{current_time}---{title}')
|
181 |
|
182 |
current_time=current_time.replace(":","-")
|
183 |
current_time=current_time.replace(".","-")
|
|
|
193 |
json_hist={}
|
194 |
json_obj={}
|
195 |
full_conv=[]
|
|
|
196 |
post_cnt=1
|
197 |
while True:
|
198 |
seed = random.randint(1,1111111111111111)
|
|
|
209 |
prompt=prompt.strip(' \"')
|
210 |
|
211 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
212 |
+
|
213 |
post_cnt+=1
|
214 |
else:
|
215 |
system_prompt=prompts.REPLY_TO_COMMENTER.format(focus=main_point[0])
|
|
|
238 |
for response in stream:
|
239 |
output += response.token.text
|
240 |
yield '', [(prompt,output)],summary[0],json_obj, json_hist,html_out
|
241 |
+
|
242 |
+
if not title:
|
243 |
+
for line in output:
|
244 |
+
if "title" in line.lower() and ":" in line.lower():
|
245 |
+
title = line.split(":")[1]
|
246 |
+
print(f'title:: {title}')
|
247 |
+
filename=create_valid_filename(f'{current_time}---{title}')
|
248 |
+
|
249 |
out_json = {"prompt":prompt,"output":output}
|
250 |
|
251 |
prompt = question_generate(output, history)
|