Request context prompt fixes and improvements. #11

Merged
skobkin merged 1 commit from fix_context_prompt into main 2024-03-12 03:32:01 +00:00
Showing only changes of commit 19da4c6b34 - Show all commits

View file

@ -19,17 +19,22 @@ type ChatContext struct {
} }
func (c RequestContext) Prompt() string { func (c RequestContext) Prompt() string {
prompt := "The chat you're in is called \"" + c.Chat.Title + "\". " + prompt := "The type of chat you're in is \"" + c.Chat.Type + "\". "
"The type of chat is \"" + c.Chat.Type + "\". " +
"The chat description is \"" + c.Chat.Description + "\". " if c.Chat.Title != "" {
prompt += "Chat is called \"" + c.Chat.Title + "\". "
}
if c.Chat.Description != "" {
prompt += "Chat description is \"" + c.Chat.Description + "\". "
}
if c.User.Username != "" { if c.User.Username != "" {
prompt += "The user who wrote you has username \"@" + c.Chat.Description + "\". " prompt += "The user who wrote you has username \"@" + c.User.Username + "\". "
} }
prompt += "Their first name is \"" + c.User.FirstName + "\". " prompt += "Their first name is \"" + c.User.FirstName + "\". "
if c.User.LastName != "" { if c.User.LastName != "" {
prompt += "Their last name is \"" + c.User.LastName + "\". " prompt += "Their last name is \"" + c.User.LastName + "\". "
} }
if c.User.IsPremium { if c.User.IsPremium {
prompt += "They have Telegram Premium subscription. " prompt += "They have Telegram Premium subscription. "
} }