Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -147,6 +147,8 @@ async def reply_whatsapp(request: Request):
|
|
| 147 |
if not find the answer from provided data then say 'please contact our helpdesk'
|
| 148 |
|
| 149 |
user question : {user_query}""")
|
|
|
|
|
|
|
| 150 |
|
| 151 |
print(str(gpt_response).lower())
|
| 152 |
if "please contact our helpdesk" in str(gpt_response).lower() or "please contact" in str(gpt_response).lower():
|
|
@@ -154,8 +156,6 @@ async def reply_whatsapp(request: Request):
|
|
| 154 |
|
| 155 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 156 |
|
| 157 |
-
default = """\n\nDear\n\nIf you have a specific question or need assistance, please feel free to submit a ticket,
|
| 158 |
-
and our support team will be happy to help you \n\nSubmit a Ticket: \n\tEmail: support@storemate.lk\n\tHotline: 0114 226 999\nThank You """
|
| 159 |
messages = [
|
| 160 |
{"role": "system", "content": "you are parallax technologies chatbot design for answer the user question like a real human"},
|
| 161 |
{"role": "user", "content": user_query+". always give small and realistic response"}
|
|
@@ -171,13 +171,15 @@ async def reply_whatsapp(request: Request):
|
|
| 171 |
|
| 172 |
)
|
| 173 |
|
| 174 |
-
|
|
|
|
| 175 |
return PlainTextResponse(str(response), media_type="application/xml")
|
| 176 |
|
| 177 |
#result = ""
|
| 178 |
#for lines in str(gpt_response).split("\n"):
|
| 179 |
#result = result +"<p>"+lines+"</p><br>"
|
| 180 |
-
|
|
|
|
| 181 |
return PlainTextResponse(str(response), media_type="application/xml")
|
| 182 |
|
| 183 |
|
|
|
|
| 147 |
if not find the answer from provided data then say 'please contact our helpdesk'
|
| 148 |
|
| 149 |
user question : {user_query}""")
|
| 150 |
+
|
| 151 |
+
default = """Dear\n\nIf you have a specific question or need assistance, please feel free to submit a ticket, and our support team will be happy to help you \n\nSubmit a Ticket: \n\tEmail: support@storemate.lk\n\tHotline: 0114 226 999\nThank You """
|
| 152 |
|
| 153 |
print(str(gpt_response).lower())
|
| 154 |
if "please contact our helpdesk" in str(gpt_response).lower() or "please contact" in str(gpt_response).lower():
|
|
|
|
| 156 |
|
| 157 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 158 |
|
|
|
|
|
|
|
| 159 |
messages = [
|
| 160 |
{"role": "system", "content": "you are parallax technologies chatbot design for answer the user question like a real human"},
|
| 161 |
{"role": "user", "content": user_query+". always give small and realistic response"}
|
|
|
|
| 171 |
|
| 172 |
)
|
| 173 |
|
| 174 |
+
response.message(str(gpt_response.choices[0].message.content))
|
| 175 |
+
response.message(str(default))
|
| 176 |
return PlainTextResponse(str(response), media_type="application/xml")
|
| 177 |
|
| 178 |
#result = ""
|
| 179 |
#for lines in str(gpt_response).split("\n"):
|
| 180 |
#result = result +"<p>"+lines+"</p><br>"
|
| 181 |
+
response.message(str(gpt_response))
|
| 182 |
+
#response.message("https://storemate.lk")
|
| 183 |
return PlainTextResponse(str(response), media_type="application/xml")
|
| 184 |
|
| 185 |
|