fix
This commit is contained in:
parent
1aa1968747
commit
cae9dfa5fc
11
LLM.go
11
LLM.go
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
|
||||
"github.com/edgedb/edgedb-go"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
@ -53,14 +54,10 @@ func createLLM(c *fiber.Ctx) error {
|
||||
temperature := c.FormValue("temperature-slider")
|
||||
systemPrompt := c.FormValue("model-prompt-input")
|
||||
|
||||
// Transform the temperature to a float
|
||||
temperatureparsed, err := json.Marshal(temperature)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
temperatureFloat := float32(temperatureparsed[1])
|
||||
f, _ := strconv.ParseFloat(temperature, 32)
|
||||
temperatureFloat := float32(f)
|
||||
|
||||
err = edgeClient.Execute(edgeCtx, `
|
||||
err := edgeClient.Execute(edgeCtx, `
|
||||
INSERT LLM {
|
||||
name := <str>$0,
|
||||
context := <str>$1,
|
||||
|
@ -51,8 +51,8 @@ func addGoogleMessage(llm LLM, selected bool) edgedb.UUID {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
} else if len(chatCompletion.Choices) == 0 {
|
||||
fmt.Println("No response from OpenAI")
|
||||
id := insertBotMessage("No response from OpenAI", selected, llm.ID)
|
||||
fmt.Println("No response from Google")
|
||||
id := insertBotMessage("No response from Google", selected, llm.ID)
|
||||
return id
|
||||
} else {
|
||||
Content := chatCompletion.Choices[0].Message.Content
|
||||
|
@ -93,14 +93,14 @@
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Shift') {
|
||||
if (event.key === 'Shift' && document.activeElement.id !== 'chat-input-textarea' && document.getElementById('models-creation').classList.contains('is-hidden')) {
|
||||
document.body.classList.add('shift-pressed');
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keyup', function (event) {
|
||||
// If Shift is press and id="chat-input-textarea" not focused
|
||||
if (event.key === 'Shift' && document.activeElement.id !== 'chat-input-textarea') {
|
||||
if (event.key === 'Shift' && document.activeElement.id !== 'chat-input-textarea' && document.getElementById('models-creation').classList.contains('is-hidden')) {
|
||||
document.body.classList.remove('shift-pressed');
|
||||
lastSelectedIndex = null;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user