fix
This commit is contained in:
parent
f2bb7e77df
commit
88e11dcc7e
13
main.py
13
main.py
|
@ -99,6 +99,7 @@ def predict():
|
||||||
#rg = users[token]['args']['rg']
|
#rg = users[token]['args']['rg']
|
||||||
#vre = users[token]['args']['vre']
|
#vre = users[token]['args']['vre']
|
||||||
message = {}
|
message = {}
|
||||||
|
try:
|
||||||
if text == "<HELP_ON_START>":
|
if text == "<HELP_ON_START>":
|
||||||
state = {'help': True, 'inactive': False, 'modified_query':"", 'intent':""}
|
state = {'help': True, 'inactive': False, 'modified_query':"", 'intent':""}
|
||||||
dm.update(state)
|
dm.update(state)
|
||||||
|
@ -145,6 +146,11 @@ def predict():
|
||||||
#users[token]['args']['vre'] = vre
|
#users[token]['args']['vre'] = vre
|
||||||
#users[token]['args']['rg'] = rg
|
#users[token]['args']['rg'] = rg
|
||||||
return reply
|
return reply
|
||||||
|
except Exception as e:
|
||||||
|
message = {"answer": str(e), "query": "", "cand": "candidate", "history": "", "modQuery": ""}
|
||||||
|
return jsonify(message)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/feedback', methods = ['POST'])
|
@app.route('/api/feedback', methods = ['POST'])
|
||||||
def feedback():
|
def feedback():
|
||||||
|
@ -152,7 +158,6 @@ def feedback():
|
||||||
print(data)
|
print(data)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
"""
|
|
||||||
conn = psycopg2.connect(host="janet-pg", database=os.getenv("POSTGRES_DB"), user=os.getenv("POSTGRES_USER"), password=os.getenv("POSTGRES_PASSWORD"))
|
conn = psycopg2.connect(host="janet-pg", database=os.getenv("POSTGRES_DB"), user=os.getenv("POSTGRES_USER"), password=os.getenv("POSTGRES_PASSWORD"))
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
cur.execute('INSERT INTO feedback_experimental (query, history, janet_modified_query, is_modified_query_correct, user_modified_query, evidence_useful, response, preferred_response, response_length_feedback, response_fluency_feedback, response_truth_feedback, response_useful_feedback, response_time_feedback, response_intent) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
|
cur.execute('INSERT INTO feedback_experimental (query, history, janet_modified_query, is_modified_query_correct, user_modified_query, evidence_useful, response, preferred_response, response_length_feedback, response_fluency_feedback, response_truth_feedback, response_useful_feedback, response_time_feedback, response_intent) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
|
||||||
|
@ -162,7 +167,7 @@ def feedback():
|
||||||
data['speed'], data['intent']))
|
data['speed'], data['intent']))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
cur.close()
|
cur.close()
|
||||||
"""
|
|
||||||
reply = jsonify({"status": "done"})
|
reply = jsonify({"status": "done"})
|
||||||
return reply
|
return reply
|
||||||
|
|
||||||
|
@ -202,7 +207,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
threading.Thread(target=vre_fetch, name='updatevre').start()
|
threading.Thread(target=vre_fetch, name='updatevre').start()
|
||||||
threading.Thread(target=clear_inactive, name='clear').start()
|
threading.Thread(target=clear_inactive, name='clear').start()
|
||||||
"""
|
|
||||||
conn = psycopg2.connect(host="janet-pg", database=os.getenv("POSTGRES_DB"), user=os.getenv("POSTGRES_USER"), password=os.getenv("POSTGRES_PASSWORD"))
|
conn = psycopg2.connect(host="janet-pg", database=os.getenv("POSTGRES_DB"), user=os.getenv("POSTGRES_USER"), password=os.getenv("POSTGRES_PASSWORD"))
|
||||||
|
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
|
@ -224,5 +229,5 @@ if __name__ == "__main__":
|
||||||
)
|
)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
cur.close()
|
cur.close()
|
||||||
"""
|
|
||||||
app.run(host='0.0.0.0')
|
app.run(host='0.0.0.0')
|
||||||
|
|
Loading…
Reference in New Issue