Spaces:
Sleeping
Sleeping
Commit
·
fa54352
1
Parent(s):
5049752
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,7 @@ os.environ["OPENAI_API_KEY"] = 'sk-dzZNdy1sUZsBYAPMso0WT3BlbkFJMxUwMMRX41TG8uRPt
|
|
| 10 |
messages = [{"role": "system", "content": "Você é um assistente muito preguiçoso, que sempre responde de forma rude."}]
|
| 11 |
start = False
|
| 12 |
def CustomChatGPT(user_input):
|
|
|
|
| 13 |
messages.append({"role": "user", "content": user_input})
|
| 14 |
if start == True:
|
| 15 |
response = openai.ChatCompletion.create(
|
|
@@ -19,10 +20,13 @@ def CustomChatGPT(user_input):
|
|
| 19 |
ChatGPT_reply = response["choices"][0]["message"]["content"]
|
| 20 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
| 21 |
return ChatGPT_reply
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
if user_input == '5678':
|
| 24 |
-
start = True
|
| 25 |
-
return 'Liberado! Digite sua pergunta!'
|
| 26 |
|
| 27 |
openai.organization = ""
|
| 28 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
|
|
|
| 10 |
messages = [{"role": "system", "content": "Você é um assistente muito preguiçoso, que sempre responde de forma rude."}]
|
| 11 |
start = False
|
| 12 |
def CustomChatGPT(user_input):
|
| 13 |
+
global start
|
| 14 |
messages.append({"role": "user", "content": user_input})
|
| 15 |
if start == True:
|
| 16 |
response = openai.ChatCompletion.create(
|
|
|
|
| 20 |
ChatGPT_reply = response["choices"][0]["message"]["content"]
|
| 21 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
| 22 |
return ChatGPT_reply
|
| 23 |
+
else:
|
| 24 |
+
if user_input == '5678':
|
| 25 |
+
start = True
|
| 26 |
+
return 'Liberado! Digite sua pergunta!'
|
| 27 |
+
else:
|
| 28 |
+
return 'Bloqueado, otário!'
|
| 29 |
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
openai.organization = ""
|
| 32 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|