Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,22 @@ def generate_response(user_input):
|
|
| 16 |
else:
|
| 17 |
# Construct the prompt with the user input
|
| 18 |
prompt = f"You said: {user_input}"
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# Generate a response using the OpenAI API
|
| 22 |
response = openai.Completion.create(
|
|
|
|
| 16 |
else:
|
| 17 |
# Construct the prompt with the user input
|
| 18 |
prompt = f"You said: {user_input}"
|
| 19 |
+
|
| 20 |
+
# Check if user input contains the phrase "what is your purpose"
|
| 21 |
+
elif "what is your purpose" in user_input.lower():
|
| 22 |
+
# Generate a response explaining the chatbot's purpose
|
| 23 |
+
chat_response = "My purpose is to help you with your queries."
|
| 24 |
+
return chat_response
|
| 25 |
+
# Check if user input contains the phrase "how are you"
|
| 26 |
+
elif "how are you" in user_input.lower():
|
| 27 |
+
# Generate a response to the question "how are you"
|
| 28 |
+
chat_response = "I'm a chatbot, I don't have feelings, but thanks for asking!"
|
| 29 |
+
return chat_response
|
| 30 |
+
else:
|
| 31 |
+
# Construct the prompt with the user input
|
| 32 |
+
prompt = f"You said: {user_input}"
|
| 33 |
+
return prompt
|
| 34 |
+
|
| 35 |
|
| 36 |
# Generate a response using the OpenAI API
|
| 37 |
response = openai.Completion.create(
|