Make lastSelectedModels var per user
This commit is contained in:
parent
f76ebd7491
commit
1e0d345fa4
@ -17,7 +17,7 @@ type RequestMessage struct {
|
|||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastSelectedLLMs []LLM
|
var lastSelectedLLMs = make(map[string][]LLM)
|
||||||
|
|
||||||
func GeneratePlaceholderHandler(c *fiber.Ctx) error {
|
func GeneratePlaceholderHandler(c *fiber.Ctx) error {
|
||||||
// Step 1 I create a User message and send it as output with a placeholder
|
// Step 1 I create a User message and send it as output with a placeholder
|
||||||
@ -68,7 +68,7 @@ func GeneratePlaceholderHTML(c *fiber.Ctx, message string, selectedLLMIds []stri
|
|||||||
}
|
}
|
||||||
selectedLLMs = append(selectedLLMs, selectedLLM)
|
selectedLLMs = append(selectedLLMs, selectedLLM)
|
||||||
}
|
}
|
||||||
lastSelectedLLMs = selectedLLMs
|
lastSelectedLLMs[c.Cookies("jade-edgedb-auth-token")] = selectedLLMs
|
||||||
|
|
||||||
_, position := insertArea(c)
|
_, position := insertArea(c)
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ func GenerateMultipleMessagesHandler(c *fiber.Ctx) error {
|
|||||||
// Step 2 generate multiple messages
|
// Step 2 generate multiple messages
|
||||||
// And send them one by one using events
|
// And send them one by one using events
|
||||||
insertArea(c)
|
insertArea(c)
|
||||||
selectedLLMs := lastSelectedLLMs
|
selectedLLMs, _ := lastSelectedLLMs[c.Cookies("jade-edgedb-auth-token")]
|
||||||
|
|
||||||
var user User
|
var user User
|
||||||
err := edgeGlobalClient.WithGlobals(map[string]interface{}{"ext::auth::client_token": c.Cookies("jade-edgedb-auth-token")}).QuerySingle(context.Background(), `
|
err := edgeGlobalClient.WithGlobals(map[string]interface{}{"ext::auth::client_token": c.Cookies("jade-edgedb-auth-token")}).QuerySingle(context.Background(), `
|
||||||
@ -238,6 +238,8 @@ func GenerateMultipleMessagesHandler(c *fiber.Ctx) error {
|
|||||||
// Wait for all goroutines to finish
|
// Wait for all goroutines to finish
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
|
delete(lastSelectedLLMs, c.Cookies("jade-edgedb-auth-token"))
|
||||||
|
|
||||||
return c.SendString("")
|
return c.SendString("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user