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