This commit is contained in:
Adrien Bouvais 2024-05-11 15:42:08 +02:00
parent b30bc71da4
commit f08123a2ba
4 changed files with 24 additions and 12 deletions

View File

@ -241,7 +241,7 @@ func generateWelcomeChatHTML() string {
}
NextMessages = append(NextMessages, nextMsg)
botOut, err := botTmpl.Execute(pongo2.Context{"Messages": NextMessages, "ConversationAreaId": 0, "NotClickable": !true})
botOut, err := botTmpl.Execute(pongo2.Context{"Messages": NextMessages, "ConversationAreaId": 0, "NotClickable": true})
if err != nil {
panic(err)
}
@ -268,7 +268,7 @@ func generateEnterKeyChatHTML() string {
}
NextMessages = append(NextMessages, nextMsg)
botOut, err := botTmpl.Execute(pongo2.Context{"Messages": NextMessages, "ConversationAreaId": 0, "NotClickable": !true})
botOut, err := botTmpl.Execute(pongo2.Context{"Messages": NextMessages, "ConversationAreaId": 0, "NotClickable": true})
if err != nil {
panic(err)
}

View File

@ -1,12 +1,14 @@
package main
import (
"context"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"github.com/edgedb/edgedb-go"
@ -158,6 +160,17 @@ func handleCallback(c *fiber.Ctx) error {
func handleSignOut(c *fiber.Ctx) error {
c.ClearCookie("jade-edgedb-auth-token")
edgeClient = edgeClient.WithGlobals(map[string]interface{}{"ext::auth::client_token": ""})
edgeClient.Close()
var ctx = context.Background()
client, err := edgedb.CreateClient(ctx, edgedb.Options{})
if err != nil {
fmt.Println("Error in edgedb.CreateClient: in init")
log.Fatal(err)
}
edgeCtx = ctx
edgeClient = client
return c.Redirect("/", fiber.StatusTemporaryRedirect)
}

View File

@ -81,7 +81,8 @@ func getExistingKeys() (bool, bool, bool) {
);
`, &openaiExists)
if err != nil {
fmt.Println("Error in edgedb.QuerySingle: in addOpenaiKey: ", err)
fmt.Println("Error in edgedb.QuerySingle checking for openai: ", err)
openaiExists = false
}
err = edgeClient.QuerySingle(edgeCtx, `
@ -91,7 +92,8 @@ func getExistingKeys() (bool, bool, bool) {
);
`, &anthropicExists)
if err != nil {
fmt.Println("Error in edgedb.QuerySingle: in addOpenaiKey: ", err)
fmt.Println("Error in edgedb.QuerySingle checking for anthropic: ", err)
anthropicExists = false
}
err = edgeClient.QuerySingle(edgeCtx, `
@ -101,7 +103,8 @@ func getExistingKeys() (bool, bool, bool) {
);
`, &mistralExists)
if err != nil {
fmt.Println("Error in edgedb.QuerySingle: in addOpenaiKey: ", err)
fmt.Println("Error in edgedb.QuerySingle checking for mistral: ", err)
mistralExists = false
}
return openaiExists, anthropicExists, mistralExists

View File

@ -30,17 +30,13 @@
</div>
</div>
<div class="is-flex is-justify-content mt-2">
<button class="button is-small is-primary message-button is-outlined mr-1">
<span class="icon">
<i class="fa-solid fa-copy"></i>
</span>
</button>
{% if not NotClickable %}
<button class="button is-small is-primary message-button is-outlined mr-5">
<span class="icon">
<i class="fa-solid fa-copy"></i>
</span>
</button>
{% if not NotClickable %}
{% for message in Messages %}
<button class="button is-small is-primary message-button is-outlined mr-1"
hx-get="/messageContent?id={{ message.Id }}" hx-target="#content-{{ ConversationAreaId }}"