Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -101,6 +101,18 @@ def response_evaluation_for_case_tx(thread_id, query, question_text, input, outp
|
|
| 101 |
|
| 102 |
|
| 103 |
def run_chat_in_all_cases(message, history, question_text,input, output, examples, code_written, thread_id=thread.id):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
if not message and not code_written:
|
| 106 |
ai_message = opening_statement(thread_id, question_text, input, output, examples)
|
|
|
|
| 101 |
|
| 102 |
|
| 103 |
def run_chat_in_all_cases(message, history, question_text,input, output, examples, code_written, thread_id=thread.id):
|
| 104 |
+
thread_id_file = "thread_id.txt"
|
| 105 |
+
try:
|
| 106 |
+
with open(thread_id_file, 'r') as file:
|
| 107 |
+
existing_thread_id = file.read().strip()
|
| 108 |
+
except FileNotFoundError:
|
| 109 |
+
existing_thread_id = None
|
| 110 |
+
if existing_thread_id:
|
| 111 |
+
thread_id_to_store = existing_thread_id
|
| 112 |
+
else:
|
| 113 |
+
thread_id_to_store = thread_id
|
| 114 |
+
with open(thread_id_file, 'w') as file:
|
| 115 |
+
file.write(thread_id_to_store)
|
| 116 |
|
| 117 |
if not message and not code_written:
|
| 118 |
ai_message = opening_statement(thread_id, question_text, input, output, examples)
|