Update app.py
Browse files
app.py
CHANGED
|
@@ -3,11 +3,14 @@ import gradio as gr
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
# Set your OpenAI API key
|
| 6 |
-
client = OpenAI(api_key=os.
|
| 7 |
|
| 8 |
greetings = ["hello", "hi", "hey", "greetings", "good morning", "good afternoon", "good evening"]
|
| 9 |
|
| 10 |
-
def chatbot(input, conversation_history=
|
|
|
|
|
|
|
|
|
|
| 11 |
if input:
|
| 12 |
# Check if the input starts with a common greeting, case-insensitive
|
| 13 |
if any(input.lower().startswith(greet) for greet in greetings):
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
# Set your OpenAI API key
|
| 6 |
+
client = OpenAI(api_key=os.getenv["APITOKEN"])
|
| 7 |
|
| 8 |
greetings = ["hello", "hi", "hey", "greetings", "good morning", "good afternoon", "good evening"]
|
| 9 |
|
| 10 |
+
def chatbot(input, conversation_history=None):
|
| 11 |
+
if conversation_history is None: # ✅ never use [] as a default
|
| 12 |
+
conversation_history = []
|
| 13 |
+
|
| 14 |
if input:
|
| 15 |
# Check if the input starts with a common greeting, case-insensitive
|
| 16 |
if any(input.lower().startswith(greet) for greet in greetings):
|