Update app.py
Browse files
app.py
CHANGED
|
@@ -26,19 +26,16 @@ def generate_speech(name, raw_input_text):
|
|
| 26 |
user_hist_file = "jcTSS-" + user_id + ".txt"
|
| 27 |
|
| 28 |
# Check if user history file exists
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
input_text1 = f"I'm {name}. " + input_text
|
| 41 |
-
history_openai_format.append({"role": "user", "content": input_text1})
|
| 42 |
|
| 43 |
# Rest of function
|
| 44 |
|
|
|
|
| 26 |
user_hist_file = "jcTSS-" + user_id + ".txt"
|
| 27 |
|
| 28 |
# Check if user history file exists
|
| 29 |
+
if os.path.exists(user_hist_file):
|
| 30 |
+
with open(user_hist_file, "r", encoding="UTF-8") as file:
|
| 31 |
+
user_hist = file.read().strip()
|
| 32 |
+
else:
|
| 33 |
+
with open(user_hist_file, "w", encoding="UTF-8") as file:
|
| 34 |
+
file.write("User ID: " + user_id)
|
| 35 |
+
|
| 36 |
+
# Next lines no longer indented too far left
|
| 37 |
+
input_text1 = f"I'm {name}. " + input_text
|
| 38 |
+
history_openai_format.append({"role": "user", "content": input_text1})
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
# Rest of function
|
| 41 |
|