Spaces:
Runtime error
Runtime error
abhilashnl2006
commited on
Commit
•
7847af5
1
Parent(s):
4f4ee10
Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,8 @@ def get_python_help(history):
|
|
12 |
messages.append({"role": "user", "content": h[0]})
|
13 |
messages.append({"role": "assistant", "content": h[1]})
|
14 |
|
|
|
|
|
15 |
# Generate a response using gpt-3.5-turbo
|
16 |
response = openai.ChatCompletion.create(
|
17 |
model="gpt-3.5-turbo",
|
@@ -28,7 +30,7 @@ def get_python_help(history):
|
|
28 |
for chunk in response:
|
29 |
reply += chunk['choices'][0]['delta'].get('content', '')
|
30 |
|
31 |
-
history
|
32 |
return history
|
33 |
except Exception as e:
|
34 |
return history + [("Error", str(e))]
|
|
|
12 |
messages.append({"role": "user", "content": h[0]})
|
13 |
messages.append({"role": "assistant", "content": h[1]})
|
14 |
|
15 |
+
messages.append({"role": "user", "content": history[-1][0]})
|
16 |
+
|
17 |
# Generate a response using gpt-3.5-turbo
|
18 |
response = openai.ChatCompletion.create(
|
19 |
model="gpt-3.5-turbo",
|
|
|
30 |
for chunk in response:
|
31 |
reply += chunk['choices'][0]['delta'].get('content', '')
|
32 |
|
33 |
+
history[-1] = (history[-1][0], reply)
|
34 |
return history
|
35 |
except Exception as e:
|
36 |
return history + [("Error", str(e))]
|