From cec76b42f0525000cd1cb4cda389a4dfbf330fe2 Mon Sep 17 00:00:00 2001
From: MrBounty
Date: Sat, 3 Aug 2024 16:46:50 +0200
Subject: [PATCH] Readded the subscription
---
Chat.go | 4 ++--
Stripe.go | 3 ---
views/partials/popover-models.html | 2 +-
views/partials/popover-settings.html | 2 --
views/partials/welcome-chat.html | 2 +-
5 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/Chat.go b/Chat.go
index c437ec5..68ef307 100644
--- a/Chat.go
+++ b/Chat.go
@@ -870,7 +870,7 @@ func GenerateModelPopoverHTML(refresh bool, c *fiber.Ctx) string {
panic(err)
}
- isPremium, isBasic := IsCurrentUserSubscribed(c)
+ isPremium, _ := IsCurrentUserSubscribed(c)
out, err := modelPopoverTmpl.Execute(pongo2.Context{
"IsLogin": checkIfLogin(c),
@@ -886,7 +886,7 @@ func GenerateModelPopoverHTML(refresh bool, c *fiber.Ctx) string {
"LLMs": llms,
"ModelInfos": modelInfos,
"DeleteUpdate": refresh,
- "IsSub": isPremium || isBasic,
+ "IsPremium": isPremium,
})
if err != nil {
fmt.Println("Error generating model popover")
diff --git a/Stripe.go b/Stripe.go
index 4d151d1..1c3ff2c 100644
--- a/Stripe.go
+++ b/Stripe.go
@@ -84,9 +84,6 @@ func CreateNewStripeCustomer(name string, email string) string {
}
func IsCurrentUserSubscribed(c *fiber.Ctx) (bool, bool) {
- // Everybody is premium for now
- return true, false
-
var user User
err := edgeGlobalClient.WithGlobals(map[string]interface{}{"ext::auth::client_token": c.Cookies("jade-edgedb-auth-token")}).QuerySingle(edgeCtx, "SELECT global currentUser { stripe_id } LIMIT 1;", &user)
if err != nil {
diff --git a/views/partials/popover-models.html b/views/partials/popover-models.html
index f66c23e..8798883 100644
--- a/views/partials/popover-models.html
+++ b/views/partials/popover-models.html
@@ -50,7 +50,7 @@
{% for modelInfo in ModelInfos %}
{% endfor %}
-
+
diff --git a/views/partials/popover-settings.html b/views/partials/popover-settings.html
index 126060c..8e3a493 100644
--- a/views/partials/popover-settings.html
+++ b/views/partials/popover-settings.html
@@ -119,7 +119,6 @@
-
diff --git a/views/partials/welcome-chat.html b/views/partials/welcome-chat.html
index 30cd141..06e5580 100644
--- a/views/partials/welcome-chat.html
+++ b/views/partials/welcome-chat.html
@@ -130,7 +130,7 @@
for users who may not need to use the chatbot extensively. Once the free
credit use, you pay based on the length of you message and the response
generated in tokens (a token is around 3 characters). Groq and Google also
- offer free tiers that are enough for conversation.
+ offer free tiers that are enough for conversation.<
The app itself is free until 200 messages per month then 0.95$ per month.