Update app.py
Browse files
app.py
CHANGED
@@ -60,7 +60,7 @@ def transcribe(audio, text):
|
|
60 |
input_text = tokenizer.decode(input_tokens)
|
61 |
|
62 |
# Add the input text to the messages list
|
63 |
-
messages.append({"role": "user", "content": input_text})
|
64 |
|
65 |
|
66 |
# Check if the accumulated tokens have exceeded 2096
|
@@ -99,7 +99,13 @@ def transcribe(audio, text):
|
|
99 |
# Wait for the completion of the OpenAI API call
|
100 |
|
101 |
# Add the system message to the messages list
|
102 |
-
messages.append(system_message)
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
# Concatenate the chat history
|
105 |
chat_transcript = "\n\n".join([f"[ANSWER {answer_count}]{message['role']}: {message['content']}" for message in messages if message['role'] != 'system'])
|
|
|
60 |
input_text = tokenizer.decode(input_tokens)
|
61 |
|
62 |
# Add the input text to the messages list
|
63 |
+
# messages.append({"role": "user", "content": input_text})
|
64 |
|
65 |
|
66 |
# Check if the accumulated tokens have exceeded 2096
|
|
|
99 |
# Wait for the completion of the OpenAI API call
|
100 |
|
101 |
# Add the system message to the messages list
|
102 |
+
# messages.append(system_message)
|
103 |
+
|
104 |
+
# Add the system message to the beginning of the messages list
|
105 |
+
messages.insert(0, system_message)
|
106 |
+
# Add the input text to the messages list
|
107 |
+
messages.insert(0, {"role": "user", "content": input_text + transcript["text"]})
|
108 |
+
|
109 |
|
110 |
# Concatenate the chat history
|
111 |
chat_transcript = "\n\n".join([f"[ANSWER {answer_count}]{message['role']}: {message['content']}" for message in messages if message['role'] != 'system'])
|