Update app.py
Browse files
app.py
CHANGED
|
@@ -256,62 +256,37 @@ def check_freelancer_earnings(freelancer_email):
|
|
| 256 |
return False, f"❌ Error checking earnings: {str(e)}"
|
| 257 |
|
| 258 |
def get_chatbot_greeting(email=OWNER_EMAIL):
|
| 259 |
-
"""Generate greeting message by fetching data from GAS endpoint"""
|
| 260 |
try:
|
| 261 |
-
gas_url = "https://script.google.com/macros/s/
|
| 262 |
-
params = {
|
| 263 |
-
'sponsor': SPONSOR,
|
| 264 |
-
'email': email
|
| 265 |
-
}
|
| 266 |
|
| 267 |
response = requests.get(gas_url, params=params)
|
| 268 |
if response.status_code == 200:
|
| 269 |
data = response.json()
|
| 270 |
if data.get('status') == 'success':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 271 |
return format_greeting_html(
|
| 272 |
-
name=
|
| 273 |
-
icon=
|
| 274 |
-
label=
|
| 275 |
)
|
| 276 |
|
| 277 |
except Exception as e:
|
| 278 |
print(f"Error fetching greeting data: {str(e)}")
|
| 279 |
|
| 280 |
-
#
|
| 281 |
return format_greeting_html(
|
| 282 |
-
name=
|
| 283 |
icon="https://i.imgur.com/5chIGdn.gif",
|
| 284 |
label="Powered by DeepChat"
|
| 285 |
)
|
| 286 |
|
| 287 |
-
|
| 288 |
-
"""Format the greeting HTML with the provided data"""
|
| 289 |
-
return f"""
|
| 290 |
-
<div style="
|
| 291 |
-
display: flex;
|
| 292 |
-
flex-direction: column;
|
| 293 |
-
align-items: center;
|
| 294 |
-
justify-content: center;
|
| 295 |
-
text-align: center;
|
| 296 |
-
width: 100%;
|
| 297 |
-
margin: 0 auto;
|
| 298 |
-
padding: 16px;
|
| 299 |
-
">
|
| 300 |
-
<img src="{icon}"
|
| 301 |
-
width="120"
|
| 302 |
-
style="border-radius: 8px; margin-bottom: 12px;">
|
| 303 |
-
<div style="
|
| 304 |
-
font-weight: bold;
|
| 305 |
-
font-size: 1.1em;
|
| 306 |
-
margin-bottom: 8px;
|
| 307 |
-
">
|
| 308 |
-
Hi, I'm {name}, {label}!
|
| 309 |
-
</div>
|
| 310 |
-
<div style="color: #666;">
|
| 311 |
-
How can I help you today?
|
| 312 |
-
</div>
|
| 313 |
-
</div>
|
| 314 |
-
"""
|
| 315 |
|
| 316 |
|
| 317 |
|
|
@@ -1313,33 +1288,44 @@ def create_battery_html(battery_percent):
|
|
| 1313 |
# Static social links for GossApp
|
| 1314 |
social_links_html = """
|
| 1315 |
<div style="display: flex; justify-content: center; gap: 10px; margin-top: 10px;">
|
| 1316 |
-
|
| 1317 |
-
|
| 1318 |
-
|
| 1319 |
-
|
| 1320 |
-
|
| 1321 |
-
|
| 1322 |
-
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
|
| 1327 |
-
|
| 1328 |
-
|
| 1329 |
-
|
| 1330 |
-
|
| 1331 |
-
|
| 1332 |
-
|
| 1333 |
-
|
| 1334 |
-
|
| 1335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1336 |
</a>
|
| 1337 |
</div>
|
|
|
|
| 1338 |
<div style="text-align: center; margin-top: 8px;">
|
| 1339 |
-
|
| 1340 |
-
|
| 1341 |
-
|
| 1342 |
-
|
| 1343 |
</div>
|
| 1344 |
"""
|
| 1345 |
|
|
@@ -1716,7 +1702,7 @@ def verify_flutterwave_transaction(email=OWNER_EMAIL):
|
|
| 1716 |
}
|
| 1717 |
|
| 1718 |
end_date = datetime.now()
|
| 1719 |
-
start_date = end_date - timedelta(days=
|
| 1720 |
|
| 1721 |
params = {
|
| 1722 |
"from": start_date.strftime("%Y-%m-%d"),
|
|
@@ -1784,7 +1770,7 @@ def verify_paystack_transaction(email=OWNER_EMAIL):
|
|
| 1784 |
|
| 1785 |
# Date range (last 5 days)
|
| 1786 |
end_date = datetime.now()
|
| 1787 |
-
start_date = end_date - timedelta(days=
|
| 1788 |
|
| 1789 |
for txn in transactions:
|
| 1790 |
customer = txn.get("customer", {})
|
|
@@ -1833,7 +1819,7 @@ def verify_paypal_transaction(email=OWNER_EMAIL):
|
|
| 1833 |
|
| 1834 |
# Date range (last 5 days)
|
| 1835 |
end_date = datetime.utcnow()
|
| 1836 |
-
start_date = end_date - timedelta(days=
|
| 1837 |
|
| 1838 |
headers = {
|
| 1839 |
"Authorization": f"Bearer {access_token}",
|
|
@@ -2266,7 +2252,7 @@ button:active {
|
|
| 2266 |
margin: 0 auto;
|
| 2267 |
}
|
| 2268 |
.certificate-background {
|
| 2269 |
-
background-image: url('https://i.imgur.com/
|
| 2270 |
background-size: cover;
|
| 2271 |
background-position: center;
|
| 2272 |
width: 100%;
|
|
@@ -2874,14 +2860,14 @@ button:active {
|
|
| 2874 |
display: none !important;
|
| 2875 |
}
|
| 2876 |
/* Microphone icon styling */
|
| 2877 |
-
|
| 2878 |
-
width:
|
| 2879 |
-
height:
|
| 2880 |
transition: all 0.3s ease;
|
| 2881 |
opacity: 0.7;
|
| 2882 |
}
|
| 2883 |
|
| 2884 |
-
|
| 2885 |
transform: scale(1.1);
|
| 2886 |
opacity: 1;
|
| 2887 |
}
|
|
@@ -3243,7 +3229,7 @@ with gr.Blocks(
|
|
| 3243 |
try {{
|
| 3244 |
const email = "{OWNER_EMAIL}";
|
| 3245 |
const placeholder = document.querySelector('.loading-placeholder');
|
| 3246 |
-
const response = await fetch(`https://script.google.com/macros/s/
|
| 3247 |
|
| 3248 |
if (!response.ok) throw new Error('Network response was not ok');
|
| 3249 |
|
|
@@ -3301,16 +3287,22 @@ with gr.Blocks(
|
|
| 3301 |
autofocus=True,
|
| 3302 |
scale=6
|
| 3303 |
)
|
| 3304 |
-
submit = gr.Button("", elem_classes="send-btn")
|
| 3305 |
|
| 3306 |
-
|
| 3307 |
-
|
| 3308 |
-
|
| 3309 |
-
|
| 3310 |
-
|
|
|
|
| 3311 |
</div>
|
| 3312 |
-
|
| 3313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3314 |
|
| 3315 |
# Keep the actual clear button but hide it
|
| 3316 |
|
|
|
|
| 256 |
return False, f"❌ Error checking earnings: {str(e)}"
|
| 257 |
|
| 258 |
def get_chatbot_greeting(email=OWNER_EMAIL):
|
| 259 |
+
"""Generate greeting message by fetching data from the main GAS endpoint"""
|
| 260 |
try:
|
| 261 |
+
gas_url = "https://script.google.com/macros/s/AKfycbyd7_adt6ewugv6KmtLNEBdSZVfQYO0ZwLl1QoOPP-B1f7JlAkp-BK65pnWl1t-irF8/exec"
|
| 262 |
+
params = {'email': email}
|
|
|
|
|
|
|
|
|
|
| 263 |
|
| 264 |
response = requests.get(gas_url, params=params)
|
| 265 |
if response.status_code == 200:
|
| 266 |
data = response.json()
|
| 267 |
if data.get('status') == 'success':
|
| 268 |
+
# Use the pre-formatted HTML if available
|
| 269 |
+
if 'greetingHTML' in data:
|
| 270 |
+
return data['greetingHTML']
|
| 271 |
+
# Fallback to old format if needed
|
| 272 |
+
greeting_data = data.get('greeting', {})
|
| 273 |
return format_greeting_html(
|
| 274 |
+
name=greeting_data.get('name', 'GossApp'),
|
| 275 |
+
icon=greeting_data.get('icon'),
|
| 276 |
+
label=greeting_data.get('label')
|
| 277 |
)
|
| 278 |
|
| 279 |
except Exception as e:
|
| 280 |
print(f"Error fetching greeting data: {str(e)}")
|
| 281 |
|
| 282 |
+
# Final fallback
|
| 283 |
return format_greeting_html(
|
| 284 |
+
name="GossApp",
|
| 285 |
icon="https://i.imgur.com/5chIGdn.gif",
|
| 286 |
label="Powered by DeepChat"
|
| 287 |
)
|
| 288 |
|
| 289 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
|
| 291 |
|
| 292 |
|
|
|
|
| 1288 |
# Static social links for GossApp
|
| 1289 |
social_links_html = """
|
| 1290 |
<div style="display: flex; justify-content: center; gap: 10px; margin-top: 10px;">
|
| 1291 |
+
<a href="https://www.tiktok.com/@gossapp" target="_blank" title="TikTok">
|
| 1292 |
+
<img src="https://cdn-icons-png.flaticon.com/512/3046/3046121.png" width="20" style="border-radius: 50%;">
|
| 1293 |
+
</a>
|
| 1294 |
+
<a href="https://www.youtube.com/channel/UCmLc_hjNMgIhSyd4cbQqUpQ" target="_blank" title="YouTube">
|
| 1295 |
+
<img src="https://cdn-icons-png.flaticon.com/512/1384/1384060.png" width="20" style="border-radius: 50%;">
|
| 1296 |
+
</a>
|
| 1297 |
+
<a href="https://web.facebook.com/profile.php?id=61575949904505" target="_blank" title="Facebook">
|
| 1298 |
+
<img src="https://cdn-icons-png.flaticon.com/512/124/124010.png" width="20" style="border-radius: 50%;">
|
| 1299 |
+
</a>
|
| 1300 |
+
<a href="https://www.linkedin.com/company/gossappdeepchat/about/" target="_blank" title="LinkedIn">
|
| 1301 |
+
<img src="https://cdn-icons-png.flaticon.com/512/3536/3536505.png" width="20" style="border-radius: 50%;">
|
| 1302 |
+
</a>
|
| 1303 |
+
<a href="https://x.com/GossApp01" target="_blank" title="X (Twitter)">
|
| 1304 |
+
<img src="https://i.imgur.com/oDAREUD.jpeg" width="20" style="border-radius: 50%;">
|
| 1305 |
+
</a>
|
| 1306 |
+
<a href="https://wa.link/a57t63" target="_blank" title="WhatsApp">
|
| 1307 |
+
<img src="https://cdn-icons-png.flaticon.com/512/220/220236.png" width="20" style="border-radius: 50%;">
|
| 1308 |
+
</a>
|
| 1309 |
+
<a href="https://sites.google.com/view/goss-app" target="_blank" title="Site">
|
| 1310 |
+
<img src="https://i.imgur.com/3LcZoNb.png" width="20" style="border-radius: 50%;">
|
| 1311 |
+
</a>
|
| 1312 |
+
</div>
|
| 1313 |
+
|
| 1314 |
+
<div style="display: flex; justify-content: center; gap: 10px; margin-top: 10px;">
|
| 1315 |
+
<a href="https://sites.google.com/view/goss-app/botbook" target="_blank" style="text-decoration:none;">
|
| 1316 |
+
<img src="https://i.imgur.com/HploeRA.png"
|
| 1317 |
+
alt="BotBook Link"
|
| 1318 |
+
style="height:30px; transition:transform 0.3s ease;"
|
| 1319 |
+
onmouseover="this.style.transform='scale(1.05)'"
|
| 1320 |
+
onmouseout="this.style.transform='scale(1)'">
|
| 1321 |
</a>
|
| 1322 |
</div>
|
| 1323 |
+
|
| 1324 |
<div style="text-align: center; margin-top: 8px;">
|
| 1325 |
+
<a href="https://sites.google.com/view/goss-app/free-ai-time" target="_blank"
|
| 1326 |
+
style="color: black !important; font-size: 15px; font-weight: bold; text-decoration: none;">
|
| 1327 |
+
More Free AI-time/Chatbot Uptime
|
| 1328 |
+
</a>
|
| 1329 |
</div>
|
| 1330 |
"""
|
| 1331 |
|
|
|
|
| 1702 |
}
|
| 1703 |
|
| 1704 |
end_date = datetime.now()
|
| 1705 |
+
start_date = end_date - timedelta(days=1)
|
| 1706 |
|
| 1707 |
params = {
|
| 1708 |
"from": start_date.strftime("%Y-%m-%d"),
|
|
|
|
| 1770 |
|
| 1771 |
# Date range (last 5 days)
|
| 1772 |
end_date = datetime.now()
|
| 1773 |
+
start_date = end_date - timedelta(days=1)
|
| 1774 |
|
| 1775 |
for txn in transactions:
|
| 1776 |
customer = txn.get("customer", {})
|
|
|
|
| 1819 |
|
| 1820 |
# Date range (last 5 days)
|
| 1821 |
end_date = datetime.utcnow()
|
| 1822 |
+
start_date = end_date - timedelta(days=1)
|
| 1823 |
|
| 1824 |
headers = {
|
| 1825 |
"Authorization": f"Bearer {access_token}",
|
|
|
|
| 2252 |
margin: 0 auto;
|
| 2253 |
}
|
| 2254 |
.certificate-background {
|
| 2255 |
+
background-image: url('https://i.imgur.com/4j8rIwf.png');
|
| 2256 |
background-size: cover;
|
| 2257 |
background-position: center;
|
| 2258 |
width: 100%;
|
|
|
|
| 2860 |
display: none !important;
|
| 2861 |
}
|
| 2862 |
/* Microphone icon styling */
|
| 2863 |
+
.mic-icon {
|
| 2864 |
+
width: 30px !important;
|
| 2865 |
+
height: 30px !important;
|
| 2866 |
transition: all 0.3s ease;
|
| 2867 |
opacity: 0.7;
|
| 2868 |
}
|
| 2869 |
|
| 2870 |
+
.mic-icon:hover {
|
| 2871 |
transform: scale(1.1);
|
| 2872 |
opacity: 1;
|
| 2873 |
}
|
|
|
|
| 3229 |
try {{
|
| 3230 |
const email = "{OWNER_EMAIL}";
|
| 3231 |
const placeholder = document.querySelector('.loading-placeholder');
|
| 3232 |
+
const response = await fetch(`https://script.google.com/macros/s/AKfycbyOoI34sHLwYAE1m-LSKicyGqtYF9W6HQ-hK9k7NpvrxGyAoFt4TOucv5GMxMSYXY1c/exec?email=${{encodeURIComponent(email)}}&t=${{Date.now()}}`);
|
| 3233 |
|
| 3234 |
if (!response.ok) throw new Error('Network response was not ok');
|
| 3235 |
|
|
|
|
| 3287 |
autofocus=True,
|
| 3288 |
scale=6
|
| 3289 |
)
|
| 3290 |
+
submit = gr.Button("", elem_classes="send-btn")
|
| 3291 |
|
| 3292 |
+
with gr.Row():
|
| 3293 |
+
mic_icon = gr.HTML("""
|
| 3294 |
+
<div style="display: flex; align-items: center; margin-left: 3px;">
|
| 3295 |
+
<div style="position: relative; display: inline-block;">
|
| 3296 |
+
<img id="mic-icon" src="https://i.imgur.com/7XnQmvP.gif" width="30" height="30" style="cursor: pointer; border-radius: 8px;">
|
| 3297 |
+
</div>
|
| 3298 |
</div>
|
| 3299 |
+
""")
|
| 3300 |
+
|
| 3301 |
+
|
| 3302 |
+
|
| 3303 |
+
# Add microphone icon with hover tooltip
|
| 3304 |
+
|
| 3305 |
+
|
| 3306 |
|
| 3307 |
# Keep the actual clear button but hide it
|
| 3308 |
|