Added stripe payment (pricing table)
This commit is contained in:
parent
3dcf557e49
commit
0cb115e560
38
Chat.go
38
Chat.go
@ -214,6 +214,44 @@ func generateWelcomeChatHTML() string {
|
||||
return htmlString
|
||||
}
|
||||
|
||||
func generatePricingTableChatHTML() string {
|
||||
stripeTable := `
|
||||
<stripe-pricing-table pricing-table-id="prctbl_1PJAxDP2nW0okNQyY0Q3mbg4"
|
||||
publishable-key="pk_live_51OxXuWP2nW0okNQyme1qdwbL535jbMmM1uIUi6U5zcvEUUwKraktmpCzudXNdPSTxlHpw2FbCtxpwbyFFcasQ7aj000tJJGpWW">
|
||||
</stripe-pricing-table>`
|
||||
|
||||
closeBtn := `
|
||||
<div class="is-flex is-justify-content-flex-end">
|
||||
<a class="button is-primary is-small" hx-get="/loadChat" hx-target="#chat-container" hx-swap="outerHTML"
|
||||
hx-trigger="click">
|
||||
Close
|
||||
</a>
|
||||
</div>`
|
||||
|
||||
htmlString := "<div class='columns is-centered' id='chat-container'><div class='column is-12-mobile is-8-tablet is-6-desktop' id='chat-messages'>"
|
||||
|
||||
NextMessages := []TemplateMessage{}
|
||||
nextMsg := TemplateMessage{
|
||||
Icon: "icons/bouvai2.png", // Assuming Icon is a field you want to include from Message
|
||||
Content: "<br>" + stripeTable + closeBtn,
|
||||
Hidden: false, // Assuming Hidden is a field you want to include from Message
|
||||
Id: "0",
|
||||
Name: "JADE",
|
||||
}
|
||||
NextMessages = append(NextMessages, nextMsg)
|
||||
|
||||
botOut, err := botTmpl.Execute(pongo2.Context{"Messages": NextMessages, "ConversationAreaId": 0, "NotClickable": true, "notFlex": true})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
htmlString += botOut
|
||||
htmlString += "<div style='height: 10px;'></div>"
|
||||
htmlString += "</div></div>"
|
||||
|
||||
// Render the HTML template with the messages
|
||||
return htmlString
|
||||
}
|
||||
|
||||
func generateEnterKeyChatHTML() string {
|
||||
welcomeMessage := `To start using JADE, please enter at least one key in the settings.`
|
||||
|
||||
|
7
Stripe.go
Normal file
7
Stripe.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "github.com/gofiber/fiber/v2"
|
||||
|
||||
func PricingTableHandler(c *fiber.Ctx) error {
|
||||
return c.SendString(generatePricingTableChatHTML())
|
||||
}
|
1
main.go
1
main.go
@ -64,6 +64,7 @@ func main() {
|
||||
// Main routes
|
||||
app.Get("/", ChatPageHandler)
|
||||
app.Get("/loadChat", LoadChatHandler)
|
||||
app.Get("/pricingTable", PricingTableHandler)
|
||||
|
||||
// Chat routes
|
||||
app.Post("/deleteMessage", DeleteMessageHandler)
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
<script src="https://unpkg.com/htmx.org@1.9.11"></script>
|
||||
<script src="https://unpkg.com/htmx.org@1.9.12/dist/ext/sse.js"></script>
|
||||
|
||||
<script async src="https://js.stripe.com/v3/pricing-table.js"></script>
|
||||
</head>
|
||||
|
||||
<body hx-ext="sse" sse-connect="/sse">
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
<div class="column" id="content-column">
|
||||
{% if not IsPlaceholder %}
|
||||
<div class="is-flex is-align-items-start">
|
||||
<div class="{% if not notFlex%} is-flex {% endif %} is-align-items-start">
|
||||
<div class="message-content" id="content-{{ ConversationAreaId }}">
|
||||
{% for message in Messages %}
|
||||
{% if not message.Hidden %}
|
||||
|
@ -17,12 +17,23 @@
|
||||
<span>{{ LLM.Name }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="is-flex is-justify-content-flex-end">
|
||||
<button class="button is-small is-primary is-outlined mr-2">
|
||||
<span class="icon">
|
||||
<i class="fa-solid fa-pen"></i>
|
||||
</span>
|
||||
</button>
|
||||
<button class="button is-small is-success is-outlined">
|
||||
<span class="icon">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script>
|
||||
let lastSelectedIndex = null;
|
||||
|
||||
document.addEventListener('keydown', function (event) {
|
||||
@ -99,9 +110,9 @@
|
||||
}
|
||||
return selectedModelsIDs.length > 0 ? JSON.stringify(selectedModelsIDs) : '[]';
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style>
|
||||
.selected {
|
||||
border: 2px solid #126d0f;
|
||||
border-radius: 4px;
|
||||
@ -124,4 +135,4 @@
|
||||
.shift-pressed *::selection {
|
||||
background: transparent;
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -82,6 +82,13 @@
|
||||
</form>
|
||||
<p id="api-keys-status"></p>
|
||||
</div>
|
||||
<a class="button is-small mt-1" hx-get="/pricingTable" hx-target="#chat-container" hx-swap="outerHTML"
|
||||
hx-trigger="click">
|
||||
<span class="icon is-small">
|
||||
<i class="fa-solid fa-heart"></i>
|
||||
</span>
|
||||
<span>Subscribe to JADE</span>
|
||||
</a>
|
||||
<a class="button is-small mt-1" href="/signout">
|
||||
<span class="icon is-small">
|
||||
<i class="fa-solid fa-right-from-bracket"></i>
|
||||
|
Loading…
x
Reference in New Issue
Block a user