Compare commits
2 Commits
feat/filep
...
fa846225ee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa846225ee | ||
|
|
7b2fa04391 |
16
llm.go
16
llm.go
@@ -190,14 +190,6 @@ func (lcp LCPCompletion) FormMsg(msg, role string, resume bool) (io.Reader, erro
|
|||||||
messages[i] = m.ToPrompt()
|
messages[i] = m.ToPrompt()
|
||||||
}
|
}
|
||||||
prompt := strings.Join(messages, "\n")
|
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
|
// 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
|
// This is required by llama.cpp multimodal models so they know where to insert media
|
||||||
if len(multimodalData) > 0 {
|
if len(multimodalData) > 0 {
|
||||||
@@ -209,6 +201,14 @@ func (lcp LCPCompletion) FormMsg(msg, role string, resume bool) (io.Reader, erro
|
|||||||
}
|
}
|
||||||
prompt = sb.String()
|
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,
|
logger.Debug("checking prompt for /completion", "tool_use", cfg.ToolUse,
|
||||||
"msg", msg, "resume", resume, "prompt", prompt, "multimodal_data_count", len(multimodalData))
|
"msg", msg, "resume", resume, "prompt", prompt, "multimodal_data_count", len(multimodalData))
|
||||||
payload := models.NewLCPReq(prompt, chatBody.Model, multimodalData,
|
payload := models.NewLCPReq(prompt, chatBody.Model, multimodalData,
|
||||||
|
|||||||
26
tables.go
26
tables.go
@@ -938,20 +938,18 @@ func makeFilePicker() *tview.Flex {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
filePath := path.Join(currentDisplayDir, actualItemName)
|
filePath := path.Join(currentDisplayDir, actualItemName)
|
||||||
go func() {
|
file, err := os.Open(filePath)
|
||||||
file, err := os.Open(filePath)
|
if err != nil {
|
||||||
if err != nil {
|
imgPreview.SetImage(nil)
|
||||||
app.QueueUpdate(func() { imgPreview.SetImage(nil) })
|
return
|
||||||
return
|
}
|
||||||
}
|
defer file.Close()
|
||||||
defer file.Close()
|
img, _, err := image.Decode(file)
|
||||||
img, _, err := image.Decode(file)
|
if err != nil {
|
||||||
if err != nil {
|
imgPreview.SetImage(nil)
|
||||||
app.QueueUpdate(func() { imgPreview.SetImage(nil) })
|
return
|
||||||
return
|
}
|
||||||
}
|
imgPreview.SetImage(img)
|
||||||
app.QueueUpdate(func() { imgPreview.SetImage(img) })
|
|
||||||
}()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// Set up keyboard navigation
|
// Set up keyboard navigation
|
||||||
|
|||||||
Reference in New Issue
Block a user