Roxyzhang commited on
Commit
c0ab5d3
·
verified ·
1 Parent(s): 18ef2c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
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.environ["APITOKEN"])
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):