feat: add flag to pass custom prompt with default prompt as fallback

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>
This commit is contained in:
Olivier Tremblay 2025-11-10 10:09:42 -05:00
parent 3e39e519dd
commit 254c29b1d7
2 changed files with 24 additions and 22 deletions

View file

@ -19,21 +19,21 @@ I'd like you to summarize the employee's accomplishments for the quarter
I'd like the summary for the accomplishments to be in prose form, in a few paragraphs separated based on areas of work. Keep answers to 500 words for the summary.`
// SummarizeData takes GitHub PRs and Jira issues data and sends it to an OpenAI-compatible endpoint for summarization.
func SummarizeData(employeename string, prs map[string][]contributions.PullRequest, issues []issues.Issue, tasks []vikunja.Task) (string, error) {
func SummarizeData(employeename string, prs map[string][]contributions.PullRequest, issues []issues.Issue, tasks []vikunja.Task, prompt string) (string, error) {
// Build a prompt string
prompt := defaultPrompt + fmt.Sprintf("\n\nHere's the PRs and Tickets for the employee %s:\n\n", employeename)
fullPrompt := prompt + fmt.Sprintf("\n\nHere's the PRs and Tickets for the employee %s:\n\n", employeename)
for repo, prList := range prs {
prompt += fmt.Sprintf("Repository: %s\n", repo)
fullPrompt += fmt.Sprintf("Repository: %s\n", repo)
for _, pr := range prList {
prompt += fmt.Sprintf("- Title: %s\n", pr.Title)
prompt += fmt.Sprintf(" Body: %s\n", pr.Body)
fullPrompt += fmt.Sprintf("- Title: %s\n", pr.Title)
fullPrompt += fmt.Sprintf(" Body: %s\n", pr.Body)
}
}
prompt += fmt.Sprintf("Issues:")
fullPrompt += fmt.Sprintf("Issues:")
for _, issue := range issues {
prompt += fmt.Sprintf("Summary: %s\n", issue.Summary)
prompt += fmt.Sprintf("Description: %s\n", issue.Description)
prompt += fmt.Sprintf("--------")
fullPrompt += fmt.Sprintf("Summary: %s\n", issue.Summary)
fullPrompt += fmt.Sprintf("Description: %s\n", issue.Description)
fullPrompt += fmt.Sprintf("--------")
}
// Get OpenAI endpoint and token from environment variables
@ -57,7 +57,7 @@ func SummarizeData(employeename string, prs map[string][]contributions.PullReque
Messages: []struct {
Role string `json:"role"`
Content string `json:"content"`
}{{Role: "system", Content: prompt}},
}{{Role: "system", Content: fullPrompt}},
}
jsonPayload, err := json.Marshal(payload)