Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -137,8 +137,10 @@ with gr.Blocks() as demo:
|
|
| 137 |
def bot(history, max_new_tokens, temperature, top_p, system_prompt):
|
| 138 |
messages = [{"role": "system", "content": system_prompt}]
|
| 139 |
for user, bot in history:
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
| 142 |
|
| 143 |
history[-1][1] = ""
|
| 144 |
response = openai.ChatCompletion.create(
|
|
|
|
| 137 |
def bot(history, max_new_tokens, temperature, top_p, system_prompt):
|
| 138 |
messages = [{"role": "system", "content": system_prompt}]
|
| 139 |
for user, bot in history:
|
| 140 |
+
if user is not None:
|
| 141 |
+
messages.append({"role": "user", "content": user})
|
| 142 |
+
if bot is not None:
|
| 143 |
+
messages.append({"role": "assistant", "content": bot})
|
| 144 |
|
| 145 |
history[-1][1] = ""
|
| 146 |
response = openai.ChatCompletion.create(
|