This commit is contained in:
Adrien Bouvais 2024-05-20 16:28:05 +02:00
parent ac94ae08f9
commit 4505d50a11
5 changed files with 9 additions and 23 deletions

View File

@ -120,8 +120,6 @@ func RequestAnthropic(model string, messages []Message, maxTokens int, temperatu
return AnthropicChatCompletionResponse{}, fmt.Errorf("error getting Anthropic API key: %w", err)
}
fmt.Println("apiKey:", apiKey)
url := "https://api.anthropic.com/v1/messages"
requestBody := AnthropicChatCompletionRequest{

View File

@ -1,14 +1,12 @@
package main
import (
"context"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"github.com/edgedb/edgedb-go"
@ -161,17 +159,7 @@ func handleCallback(c *fiber.Ctx) error {
func handleSignOut(c *fiber.Ctx) error {
c.ClearCookie("jade-edgedb-auth-token")
edgeClient.Close()
edgeClient = edgeClient.WithoutGlobals("ext::auth::client_token")
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.StatusPermanentRedirect)
return c.Redirect("/", fiber.StatusTemporaryRedirect)
}

View File

@ -126,7 +126,7 @@ func main() {
c.Context().SetBodyStreamWriter(func(w *bufio.Writer) {
for event := range events {
if _, err := fmt.Fprintf(w, "event: %s\ndata: %s\n\n", event.Event, event.Data); err != nil {
return
panic(err)
}
w.Flush()
}
@ -136,7 +136,7 @@ func main() {
})
// Start server
log.Fatal(app.Listen(":3000"))
log.Fatal(app.Listen(":8080"))
}
func addKeys(c *fiber.Ctx) error {

View File

@ -10,10 +10,10 @@
<table class="table is-hoverable is-fullwidth is-narrow is-small">
<thead>
<tr>
<th class="is-size-7" style="width: 30%;">Name</th>
<th class="is-size-7" style="width: 30%;">Model</th>
<th class="is-size-7" style="width: 10%;"></th>
<th class="is-size-7" style="width: 10%;"></th>
<th class="is-size-7">Name</th>
<th class="is-size-7">Model</th>
<th class="is-size-7"></th>
<th class="is-size-7"></th>
</tr>
</thead>
<tbody>

View File

@ -11,7 +11,7 @@
Compare models
</a>
<a class="button is-small is-primary mb-1" href="/signout">
Log out
Logout
</a>
</div>
</div>