fix
This commit is contained in:
parent
7c150c7f78
commit
53ac52493a
9
main.py
9
main.py
|
@ -38,8 +38,6 @@ conn = psycopg2.connect(
|
||||||
user=os.getenv("POSTGRES_USER"),
|
user=os.getenv("POSTGRES_USER"),
|
||||||
password=os.getenv("POSTGRES_PASSWORD"))
|
password=os.getenv("POSTGRES_PASSWORD"))
|
||||||
|
|
||||||
cur = conn.cursor()
|
|
||||||
|
|
||||||
users = {}
|
users = {}
|
||||||
|
|
||||||
def vre_fetch():
|
def vre_fetch():
|
||||||
|
@ -157,7 +155,7 @@ def predict():
|
||||||
def feedback():
|
def feedback():
|
||||||
data = request.get_json().get("feedback")
|
data = request.get_json().get("feedback")
|
||||||
print(data)
|
print(data)
|
||||||
|
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)',
|
||||||
(data['query'], data['history'], data['modQuery'],
|
(data['query'], data['history'], data['modQuery'],
|
||||||
data['queryModCorrect'], data['correctQuery'], data['evidence'], data['janetResponse'], data['preferredResponse'], data['length'],
|
data['queryModCorrect'], data['correctQuery'], data['evidence'], data['janetResponse'], data['preferredResponse'], data['length'],
|
||||||
|
@ -165,7 +163,7 @@ def feedback():
|
||||||
data['speed'], data['intent'])
|
data['speed'], data['intent'])
|
||||||
)
|
)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
cur.close()
|
||||||
reply = jsonify({"status": "done"})
|
reply = jsonify({"status": "done"})
|
||||||
return reply
|
return reply
|
||||||
|
|
||||||
|
@ -203,6 +201,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()
|
||||||
|
|
||||||
|
cur = conn.cursor()
|
||||||
|
|
||||||
cur.execute('CREATE TABLE IF NOT EXISTS feedback_experimental (id serial PRIMARY KEY,'
|
cur.execute('CREATE TABLE IF NOT EXISTS feedback_experimental (id serial PRIMARY KEY,'
|
||||||
'query text NOT NULL,'
|
'query text NOT NULL,'
|
||||||
|
@ -220,5 +219,5 @@ if __name__ == "__main__":
|
||||||
'response_intent text NOT NULL);'
|
'response_intent text NOT NULL);'
|
||||||
)
|
)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
cur.close()
|
||||||
app.run(host='0.0.0.0')
|
app.run(host='0.0.0.0')
|
||||||
|
|
Loading…
Reference in New Issue