fixs
This commit is contained in:
parent
a4a528b6ca
commit
459746144e
@ -163,6 +163,7 @@ func GenerateMultipleMessagesHandler(c *fiber.Ctx) error {
|
|||||||
FILTER .id = <uuid>$0;
|
FILTER .id = <uuid>$0;
|
||||||
`, &message, messageID)
|
`, &message, messageID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("Panic here but why ?")
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
database.go
22
database.go
@ -5,7 +5,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/edgedb/edgedb-go"
|
"github.com/edgedb/edgedb-go"
|
||||||
@ -140,14 +139,13 @@ func insertArea() (edgedb.UUID, int64) {
|
|||||||
var inserted struct{ id edgedb.UUID }
|
var inserted struct{ id edgedb.UUID }
|
||||||
err := edgeClient.QuerySingle(edgeCtx, `
|
err := edgeClient.QuerySingle(edgeCtx, `
|
||||||
WITH
|
WITH
|
||||||
positionVar := count((SELECT Area FILTER .conversation = global currentConversation AND .conversation.user = global currentUser)) + 1
|
positionVar := count((SELECT Area FILTER .conversation = global currentConversation)) + 1
|
||||||
INSERT Area {
|
INSERT Area {
|
||||||
position := positionVar,
|
position := positionVar,
|
||||||
conversation := global currentConversation
|
conversation := global currentConversation
|
||||||
}
|
}
|
||||||
`, &inserted)
|
`, &inserted)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Couldn't insert area")
|
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +154,7 @@ func insertArea() (edgedb.UUID, int64) {
|
|||||||
SELECT Area {
|
SELECT Area {
|
||||||
position,
|
position,
|
||||||
}
|
}
|
||||||
FILTER .conversation = global currentConversation AND .conversation.user = global currentUser
|
FILTER .conversation = global currentConversation
|
||||||
ORDER BY .position desc
|
ORDER BY .position desc
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
`, &positionSet)
|
`, &positionSet)
|
||||||
@ -169,15 +167,15 @@ func insertArea() (edgedb.UUID, int64) {
|
|||||||
|
|
||||||
func insertUserMessage(content string) edgedb.UUID {
|
func insertUserMessage(content string) edgedb.UUID {
|
||||||
// Insert a new user.
|
// Insert a new user.
|
||||||
var lastAreaID edgedb.UUID
|
var lastArea Area
|
||||||
err := edgeClient.QuerySingle(edgeCtx, `
|
err := edgeClient.QuerySingle(edgeCtx, `
|
||||||
SELECT Area {
|
SELECT Area {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
FILTER .conversation = global currentConversation AND .conversation.user = global currentUser
|
FILTER .conversation = global currentConversation
|
||||||
ORDER BY .position desc
|
ORDER BY .position DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
`, &lastAreaID)
|
`, &lastArea)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -197,7 +195,7 @@ func insertUserMessage(content string) edgedb.UUID {
|
|||||||
SELECT LLM FILTER .id = <uuid>"a32c43ec-12fc-11ef-9dc9-b38e0de8bff0"
|
SELECT LLM FILTER .id = <uuid>"a32c43ec-12fc-11ef-9dc9-b38e0de8bff0"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
`, &inserted, "user", content, lastAreaID)
|
`, &inserted, "user", content, lastArea.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -205,7 +203,7 @@ func insertUserMessage(content string) edgedb.UUID {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func insertBotMessage(content string, selected bool, llmUUID edgedb.UUID) edgedb.UUID {
|
func insertBotMessage(content string, selected bool, llmUUID edgedb.UUID) edgedb.UUID {
|
||||||
var lastAreaID edgedb.UUID
|
var lastArea Area
|
||||||
err := edgeClient.QuerySingle(edgeCtx, `
|
err := edgeClient.QuerySingle(edgeCtx, `
|
||||||
SELECT Area {
|
SELECT Area {
|
||||||
id
|
id
|
||||||
@ -213,7 +211,7 @@ func insertBotMessage(content string, selected bool, llmUUID edgedb.UUID) edgedb
|
|||||||
FILTER .conversation = global currentConversation AND .conversation.user = global currentUser
|
FILTER .conversation = global currentConversation AND .conversation.user = global currentUser
|
||||||
ORDER BY .position desc
|
ORDER BY .position desc
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
`, &lastAreaID)
|
`, &lastArea)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -240,7 +238,7 @@ func insertBotMessage(content string, selected bool, llmUUID edgedb.UUID) edgedb
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
`, &inserted, "bot", llmUUID, content, selected, lastAreaID)
|
`, &inserted, "bot", llmUUID, content, selected, lastArea.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@
|
|||||||
|
|
||||||
function getSelectedModelsIDs() {
|
function getSelectedModelsIDs() {
|
||||||
var selectedModelsIDs = [];
|
var selectedModelsIDs = [];
|
||||||
var selectedModels = document.getElementsByClassName('selected');
|
var selectedModels = document.getElementsByClassName('selected icon-llm');
|
||||||
for (var i = 0; i < selectedModels.length; i++) {
|
for (var i = 0; i < selectedModels.length; i++) {
|
||||||
selectedModelsIDs.push(selectedModels[i].getAttribute('data-id'));
|
selectedModelsIDs.push(selectedModels[i].getAttribute('data-id'));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user