Fix
This commit is contained in:
parent
ac94ae08f9
commit
4505d50a11
@ -120,8 +120,6 @@ func RequestAnthropic(model string, messages []Message, maxTokens int, temperatu
|
|||||||
return AnthropicChatCompletionResponse{}, fmt.Errorf("error getting Anthropic API key: %w", err)
|
return AnthropicChatCompletionResponse{}, fmt.Errorf("error getting Anthropic API key: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("apiKey:", apiKey)
|
|
||||||
|
|
||||||
url := "https://api.anthropic.com/v1/messages"
|
url := "https://api.anthropic.com/v1/messages"
|
||||||
|
|
||||||
requestBody := AnthropicChatCompletionRequest{
|
requestBody := AnthropicChatCompletionRequest{
|
||||||
|
16
login.go
16
login.go
@ -1,14 +1,12 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/edgedb/edgedb-go"
|
"github.com/edgedb/edgedb-go"
|
||||||
@ -161,17 +159,7 @@ func handleCallback(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
func handleSignOut(c *fiber.Ctx) error {
|
func handleSignOut(c *fiber.Ctx) error {
|
||||||
c.ClearCookie("jade-edgedb-auth-token")
|
c.ClearCookie("jade-edgedb-auth-token")
|
||||||
edgeClient.Close()
|
edgeClient = edgeClient.WithoutGlobals("ext::auth::client_token")
|
||||||
|
|
||||||
var ctx = context.Background()
|
return c.Redirect("/", fiber.StatusTemporaryRedirect)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
4
main.go
4
main.go
@ -126,7 +126,7 @@ func main() {
|
|||||||
c.Context().SetBodyStreamWriter(func(w *bufio.Writer) {
|
c.Context().SetBodyStreamWriter(func(w *bufio.Writer) {
|
||||||
for event := range events {
|
for event := range events {
|
||||||
if _, err := fmt.Fprintf(w, "event: %s\ndata: %s\n\n", event.Event, event.Data); err != nil {
|
if _, err := fmt.Fprintf(w, "event: %s\ndata: %s\n\n", event.Event, event.Data); err != nil {
|
||||||
return
|
panic(err)
|
||||||
}
|
}
|
||||||
w.Flush()
|
w.Flush()
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
log.Fatal(app.Listen(":3000"))
|
log.Fatal(app.Listen(":8080"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func addKeys(c *fiber.Ctx) error {
|
func addKeys(c *fiber.Ctx) error {
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
<table class="table is-hoverable is-fullwidth is-narrow is-small">
|
<table class="table is-hoverable is-fullwidth is-narrow is-small">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="is-size-7" style="width: 30%;">Name</th>
|
<th class="is-size-7">Name</th>
|
||||||
<th class="is-size-7" style="width: 30%;">Model</th>
|
<th class="is-size-7">Model</th>
|
||||||
<th class="is-size-7" style="width: 10%;"></th>
|
<th class="is-size-7"></th>
|
||||||
<th class="is-size-7" style="width: 10%;"></th>
|
<th class="is-size-7"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Compare models
|
Compare models
|
||||||
</a>
|
</a>
|
||||||
<a class="button is-small is-primary mb-1" href="/signout">
|
<a class="button is-small is-primary mb-1" href="/signout">
|
||||||
Log out
|
Logout
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user