2 Commits

Author SHA1 Message Date
Grail Finder
fa846225ee Enha: remove updatequeue, since it waits for another main action 2026-02-17 10:29:28 +03:00
Grail Finder
7b2fa04391 Fix (img prompt): botname: after <__media__> for /completion 2026-02-17 08:23:08 +03:00
2 changed files with 20 additions and 22 deletions

16
llm.go
View File

@@ -190,14 +190,6 @@ func (lcp LCPCompletion) FormMsg(msg, role string, resume bool) (io.Reader, erro
messages[i] = m.ToPrompt()
}
prompt := strings.Join(messages, "\n")
// strings builder?
if !resume {
botMsgStart := "\n" + botPersona + ":\n"
prompt += botMsgStart
}
if cfg.ThinkUse && !cfg.ToolUse {
prompt += "<think>"
}
// Add multimodal media markers to the prompt text when multimodal data is present
// This is required by llama.cpp multimodal models so they know where to insert media
if len(multimodalData) > 0 {
@@ -209,6 +201,14 @@ func (lcp LCPCompletion) FormMsg(msg, role string, resume bool) (io.Reader, erro
}
prompt = sb.String()
}
// needs to be after <__media__> if there are images
if !resume {
botMsgStart := "\n" + botPersona + ":\n"
prompt += botMsgStart
}
if cfg.ThinkUse && !cfg.ToolUse {
prompt += "<think>"
}
logger.Debug("checking prompt for /completion", "tool_use", cfg.ToolUse,
"msg", msg, "resume", resume, "prompt", prompt, "multimodal_data_count", len(multimodalData))
payload := models.NewLCPReq(prompt, chatBody.Model, multimodalData,

View File

@@ -938,20 +938,18 @@ func makeFilePicker() *tview.Flex {
return
}
filePath := path.Join(currentDisplayDir, actualItemName)
go func() {
file, err := os.Open(filePath)
if err != nil {
app.QueueUpdate(func() { imgPreview.SetImage(nil) })
imgPreview.SetImage(nil)
return
}
defer file.Close()
img, _, err := image.Decode(file)
if err != nil {
app.QueueUpdate(func() { imgPreview.SetImage(nil) })
imgPreview.SetImage(nil)
return
}
app.QueueUpdate(func() { imgPreview.SetImage(img) })
}()
imgPreview.SetImage(img)
})
}
// Set up keyboard navigation