Update title generation prompt
This commit is contained in:
parent
eec9eb41e9
commit
008fdc0d37
@ -149,7 +149,9 @@ func FormatForExternalPrompt(messages []model.Message, system bool) string {
|
||||
}
|
||||
|
||||
func GenerateTitle(ctx *lmcli.Context, messages []model.Message) (string, error) {
|
||||
const prompt = `Above is an excerpt from a conversation between a user and AI assistant. Please reply with a short title (no more than 8 words) that reflects the topic of the conversation, read from the user's perspective.
|
||||
const prompt = `Above is an excerpt from a conversation between a user and AI assistant.
|
||||
|
||||
Reply with a short title (no more than 8 words) that reflects the topic of the conversation, read from the user's perspective.
|
||||
|
||||
Example conversation:
|
||||
|
||||
@ -163,11 +165,13 @@ Assistant:
|
||||
Hello! How may I assist you?
|
||||
"""
|
||||
|
||||
Example response:
|
||||
Your response:
|
||||
|
||||
"""
|
||||
Title: A brief introduction
|
||||
"""
|
||||
|
||||
Respond only as shown above.
|
||||
`
|
||||
conversation := FormatForExternalPrompt(messages, false)
|
||||
|
||||
@ -193,9 +197,10 @@ Title: A brief introduction
|
||||
return "", err
|
||||
}
|
||||
|
||||
response = strings.TrimPrefix(response, "Title: ")
|
||||
response = strings.Trim(response, "\"")
|
||||
// TODO: validate response format
|
||||
response = strings.TrimPrefix(response, "Title:")
|
||||
response = strings.TrimSpace(response)
|
||||
response = strings.Trim(response, "\"")
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user