Spaces:
Sleeping
Sleeping
imseldrith
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ from flask import Flask, request, jsonify
|
|
2 |
import requests
|
3 |
from dotenv import load_dotenv
|
4 |
import os
|
|
|
5 |
|
6 |
# Load environment variables from .env file
|
7 |
load_dotenv()
|
@@ -55,13 +56,12 @@ def webhook():
|
|
55 |
# Set typing on
|
56 |
set_typing_on(sender_id)
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
# Set typing off after responding
|
66 |
set_typing_off(sender_id)
|
67 |
|
|
|
2 |
import requests
|
3 |
from dotenv import load_dotenv
|
4 |
import os
|
5 |
+
from helper.openai_api import chat_completion
|
6 |
|
7 |
# Load environment variables from .env file
|
8 |
load_dotenv()
|
|
|
56 |
# Set typing on
|
57 |
set_typing_on(sender_id)
|
58 |
|
59 |
+
result = chat_completion(message_text)
|
60 |
+
response_text = result.get('response', '')
|
61 |
+
#response_text = 'hello'
|
62 |
+
print(f"Sending response to {sender_id}: {response_text}")
|
63 |
+
send_message(sender_id, response_text)
|
64 |
+
|
|
|
65 |
# Set typing off after responding
|
66 |
set_typing_off(sender_id)
|
67 |
|