refactor: remove duplicate os.Getenv calls for OpenAI env vars in SummarizeData
Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>
This commit is contained in:
parent
e640db11e7
commit
0520777c71
1 changed files with 9 additions and 8 deletions
|
|
@ -21,6 +21,15 @@ I'd like the summary for the accomplishments to be in prose form, in a few parag
|
|||
|
||||
// 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, prompt string) (string, error) {
|
||||
// Get OpenAI endpoint and token from environment variables
|
||||
openaiEndpoint := os.Getenv("OPENAI_ENDPOINT")
|
||||
openaiToken := os.Getenv("OPENAI_TOKEN")
|
||||
openaiModel := os.Getenv("OPENAI_MODEL")
|
||||
|
||||
if openaiEndpoint == "" || openaiToken == "" {
|
||||
return "", fmt.Errorf("OPENAI_ENDPOINT and OPENAI_TOKEN must be set in environment variables")
|
||||
}
|
||||
|
||||
// Build a prompt string
|
||||
fullPrompt := prompt + fmt.Sprintf("\n\nHere's the PRs and Tickets for the employee %s:\n\n", employeename)
|
||||
for repo, prList := range prs {
|
||||
|
|
@ -43,14 +52,6 @@ func SummarizeData(employeename string, prs map[string][]contributions.PullReque
|
|||
}
|
||||
promptf.WriteString(fullPrompt)
|
||||
defer promptf.Close()
|
||||
// Get OpenAI endpoint and token from environment variables
|
||||
openaiEndpoint := os.Getenv("OPENAI_ENDPOINT")
|
||||
openaiToken := os.Getenv("OPENAI_TOKEN")
|
||||
openaiModel := os.Getenv("OPENAI_MODEL")
|
||||
|
||||
if openaiEndpoint == "" || openaiToken == "" {
|
||||
return "", fmt.Errorf("OPENAI_ENDPOINT and OPENAI_TOKEN must be set in environment variables")
|
||||
}
|
||||
|
||||
// Create a JSON payload for the OpenAI API
|
||||
payload := struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue