fix
This commit is contained in:
parent
fbeb1bc7d9
commit
099329c0b2
18
Request.go
18
Request.go
@ -24,7 +24,7 @@ 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
|
||||||
// that will make a request to GenerateMultipleMessagesHandler when loading
|
// that will make a request to GenerateMultipleMessagesHandler when loading
|
||||||
message := c.FormValue("message", "")
|
message := c.FormValue("message", "")
|
||||||
selectedLLMIds := []string{"1e5a07c4-12fe-11ef-8da6-67d29b408c53"} // TODO Hanle in the UI
|
selectedLLMIds := []string{"1e5a07c4-12fe-11ef-8da6-67d29b408c53", "3cd15ca8-1433-11ef-9f22-93f2b78c78de"} // TODO Hanle in the UI
|
||||||
|
|
||||||
var selectedLLMs []LLM
|
var selectedLLMs []LLM
|
||||||
var selectedLLM LLM
|
var selectedLLM LLM
|
||||||
@ -140,7 +140,7 @@ func GenerateMultipleMessagesHandler(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
templateMessage := TemplateMessage{
|
templateMessage := TemplateMessage{
|
||||||
Icon: message.LLM.Model.Company.Icon,
|
Icon: message.LLM.Model.Company.Icon,
|
||||||
Content: markdownToHTML(message.Content),
|
Content: message.Content,
|
||||||
Hidden: false,
|
Hidden: false,
|
||||||
Id: message.ID.String(),
|
Id: message.ID.String(),
|
||||||
Name: message.LLM.Model.Name,
|
Name: message.LLM.Model.Name,
|
||||||
@ -157,16 +157,6 @@ func GenerateMultipleMessagesHandler(c *fiber.Ctx) error {
|
|||||||
select {
|
select {
|
||||||
case firstDone <- idx:
|
case firstDone <- idx:
|
||||||
// Generate the HTML content
|
// Generate the HTML content
|
||||||
outContent := "<div class='message-header'>"
|
|
||||||
outContent += "<p>"
|
|
||||||
outContent += templateMessage.Name
|
|
||||||
outContent += " </p>"
|
|
||||||
outContent += "</div>"
|
|
||||||
outContent += "<div class='message-body'>"
|
|
||||||
outContent += " <ct class='content'>"
|
|
||||||
outContent += templateMessage.Content
|
|
||||||
outContent += " </ct>"
|
|
||||||
outContent += "</div>"
|
|
||||||
|
|
||||||
outBtn, err := selectBtnTmpl.Execute(map[string]interface{}{
|
outBtn, err := selectBtnTmpl.Execute(map[string]interface{}{
|
||||||
"message": templateMessage,
|
"message": templateMessage,
|
||||||
@ -178,12 +168,12 @@ func GenerateMultipleMessagesHandler(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
outBtn = strings.ReplaceAll(outBtn, "\n", "")
|
outBtn = strings.ReplaceAll(outBtn, "\n", "")
|
||||||
|
|
||||||
outIcon := `<img src="` + selectedLLMs[idx].Model.Company.Icon + `" alt="User Image">`
|
outIcon := `<img src="` + selectedLLMs[idx].Model.Company.Icon + `" alt="User Image" id="selectedIcon-` + fmt.Sprintf("%d", message.Area.Position) + `">`
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
sendEvent(
|
sendEvent(
|
||||||
"swapContent-"+fmt.Sprintf("%d", message.Area.Position),
|
"swapContent-"+fmt.Sprintf("%d", message.Area.Position),
|
||||||
outContent,
|
`<hx hx-get="/messageContent?id=`+message.ID.String()+`" hx-trigger="load" hx-swap="outerHTML"></hx>`,
|
||||||
)
|
)
|
||||||
sendEvent(
|
sendEvent(
|
||||||
"swapSelectionBtn-"+selectedLLMs[idx].ID.String(),
|
"swapSelectionBtn-"+selectedLLMs[idx].ID.String(),
|
||||||
|
@ -4,17 +4,16 @@
|
|||||||
<!-- Left column with the icon -->
|
<!-- Left column with the icon -->
|
||||||
{% if IsPlaceholder %}
|
{% if IsPlaceholder %}
|
||||||
|
|
||||||
<figure class="image is-48x48" style="flex-shrink: 0;" id="selectedIcon-{{ ConversationAreaId }}"
|
<figure class="image is-48x48" style="flex-shrink: 0;" sse-swap="swapIcon-{{ ConversationAreaId }}">
|
||||||
sse-swap="swapIcon-{{ ConversationAreaId }}">
|
<img src="icons/bouvai2.png" alt="User Image" id="selectedIcon-{{ ConversationAreaId }}">
|
||||||
<img src="icons/bouvai2.png" alt="User Image">
|
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
{% for message in Messages %}
|
{% for message in Messages %}
|
||||||
{% if not message.Hidden %}
|
{% if not message.Hidden %}
|
||||||
<figure class="image is-48x48" style="flex-shrink: 0;" id="selectedIcon-{{ ConversationAreaId }}">
|
<figure class="image is-48x48" style="flex-shrink: 0;">
|
||||||
<img src="{{ message.Icon }}" alt="User Image">
|
<img src="{{ message.Icon }}" alt="User Image" id="selectedIcon-{{ ConversationAreaId }}">
|
||||||
</figure>
|
</figure>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user