Update app.py
Browse files
app.py
CHANGED
@@ -162,19 +162,18 @@ def comment_generate(prompt, history,post_check,full_conv,persona2, agent_name=a
|
|
162 |
output += response.token.text
|
163 |
history.append((output,None))
|
164 |
|
165 |
-
comment_cnt=post_check['comment']
|
166 |
-
print(type(comment_cnt))
|
167 |
-
post_check['comment']=comment_cnt+1
|
168 |
|
169 |
|
170 |
|
171 |
reply_json= {'user':'','datetime':'','reply':''}
|
172 |
|
173 |
-
#comment_json= {'user':'','datetime':'','comment':'','reply_list':[reply_json]}
|
174 |
|
175 |
-
comment_json= {'user':persona[persona2]['name'],'datetime':current_time,'comment':output,'reply_list':[
|
176 |
|
177 |
-
out_json = {'user':post_check['user'],'datetime':post_check['datetime'],'file_name':post_check['
|
178 |
'title':post_check['title'],'blog':1,'comment':post_check['comment']+1,'reply':post_check['reply'],
|
179 |
"prompt":post_check['prompt'],"output":post_check['output'],'comment_list':post_check['comment_list'].append(comment_json)}
|
180 |
|
@@ -259,14 +258,17 @@ def reply_generate(prompt, history,post_check,full_conv,persona1, agent_name=age
|
|
259 |
output += response.token.text
|
260 |
history.append((output,None))
|
261 |
|
262 |
-
reply_cnt=post_check['reply']
|
263 |
-
post_check['reply']=reply_cnt+1
|
264 |
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
|
|
|
|
|
|
270 |
|
271 |
hist_out.append(out_json)
|
272 |
#try:
|
@@ -349,10 +351,13 @@ def load_html(inp,conv):
|
|
349 |
#print(f'prom:: {prom}')
|
350 |
ht+=f"""<div class="div_box">"""
|
351 |
ht+=f"""<pre class="bpost"><div class="bhead"><h2>{conv['title']}</h2><br><h5>{conv['user']}</h5></div>{conv['output']}</pre>"""
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
|
|
|
|
|
|
356 |
ht+=f"""</div>"""
|
357 |
'''
|
358 |
if inp:
|
@@ -492,7 +497,7 @@ def generate(prompt, history, post_check,full_conv,persona1, agent_name=agents[0
|
|
492 |
|
493 |
out_json = {'user':persona[persona1]['name'],'datetime':current_time,'file_name':filename,
|
494 |
'title':title,'blog':1,'comment':0,'reply':0,
|
495 |
-
"prompt":prompt,"output":output,'comment_list':[
|
496 |
|
497 |
#hist_out.append(out_json)
|
498 |
#try:
|
|
|
162 |
output += response.token.text
|
163 |
history.append((output,None))
|
164 |
|
165 |
+
#comment_cnt=post_check['comment']
|
166 |
+
#print(type(comment_cnt))
|
167 |
+
#post_check['comment']=comment_cnt+1
|
168 |
|
169 |
|
170 |
|
171 |
reply_json= {'user':'','datetime':'','reply':''}
|
172 |
|
|
|
173 |
|
174 |
+
comment_json= {'user':persona[persona2]['name'],'datetime':current_time,'comment':output,'reply_list':[]}
|
175 |
|
176 |
+
out_json = {'user':post_check['user'],'datetime':post_check['datetime'],'file_name':post_check['file_name'],
|
177 |
'title':post_check['title'],'blog':1,'comment':post_check['comment']+1,'reply':post_check['reply'],
|
178 |
"prompt":post_check['prompt'],"output":post_check['output'],'comment_list':post_check['comment_list'].append(comment_json)}
|
179 |
|
|
|
258 |
output += response.token.text
|
259 |
history.append((output,None))
|
260 |
|
261 |
+
#reply_cnt=post_check['reply']
|
262 |
+
#post_check['reply']=reply_cnt+1
|
263 |
|
264 |
+
reply_json= {'user':persona[persona1]['name'],'datetime':current_time,'reply':output}
|
265 |
+
|
266 |
+
|
267 |
+
#comment_json= {'user':persona[persona2]['name'],'datetime':current_time,'comment':output,'reply_list':[reply_json]}
|
268 |
+
|
269 |
+
out_json = {'user':post_check['user'],'datetime':post_check['datetime'],'file_name':post_check['file_name'],
|
270 |
+
'title':post_check['title'],'blog':1,'comment':post_check['comment'],'reply':post_check['reply']+1,
|
271 |
+
"prompt":post_check['prompt'],"output":post_check['output'],'comment_list':post_check['comment_list']['reply_list'].append(reply_json)}
|
272 |
|
273 |
hist_out.append(out_json)
|
274 |
#try:
|
|
|
351 |
#print(f'prom:: {prom}')
|
352 |
ht+=f"""<div class="div_box">"""
|
353 |
ht+=f"""<pre class="bpost"><div class="bhead"><h2>{conv['title']}</h2><br><h5>{conv['user']}</h5></div>{conv['output']}</pre>"""
|
354 |
+
if conv['comment_list']:
|
355 |
+
for com in conv['comment_list']:
|
356 |
+
ht+=f"""<pre class="resp1"><div class="bhead"></div>{com}</pre>"""
|
357 |
+
for ea in conv['comment_list']:
|
358 |
+
if conv['comment_list'][ea]['reply_list']:
|
359 |
+
for repl in conv['comment_list'][ea]['reply_list']:
|
360 |
+
ht+=f"""<pre class="resp2"><div class="bhead"></div>{repl}</pre>"""
|
361 |
ht+=f"""</div>"""
|
362 |
'''
|
363 |
if inp:
|
|
|
497 |
|
498 |
out_json = {'user':persona[persona1]['name'],'datetime':current_time,'file_name':filename,
|
499 |
'title':title,'blog':1,'comment':0,'reply':0,
|
500 |
+
"prompt":prompt,"output":output,'comment_list':[]}
|
501 |
|
502 |
#hist_out.append(out_json)
|
503 |
#try:
|