fix: always call SummarizeData to ensure prompt file is created for debugging, but only call OpenAI endpoint if env vars are set
Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>
This commit is contained in:
parent
038ee769bb
commit
979aa66b17
2 changed files with 17 additions and 12 deletions
|
|
@ -72,18 +72,19 @@ func main() {
|
||||||
openaiToken := os.Getenv("OPENAI_TOKEN")
|
openaiToken := os.Getenv("OPENAI_TOKEN")
|
||||||
openaiModel := os.Getenv("OPENAI_MODEL")
|
openaiModel := os.Getenv("OPENAI_MODEL")
|
||||||
|
|
||||||
// Check if OpenAI environment variables are set before calling Summarize
|
// Always call SummarizeData to ensure prompt file is created for debugging
|
||||||
if openaiEndpoint == "" || openaiToken == "" {
|
|
||||||
fmt.Println("Error: OPENAI_ENDPOINT and OPENAI_TOKEN must be set in environment variables to summarize")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
summ, err := SummarizeData(*employeename, prs, issues, vikunjaTasks, finalPrompt, openaiEndpoint, openaiToken, openaiModel)
|
summ, err := SummarizeData(*employeename, prs, issues, vikunjaTasks, finalPrompt, openaiEndpoint, openaiToken, openaiModel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(fmt.Errorf("error getting PRs: %w", err))
|
fmt.Println(fmt.Errorf("error getting PRs: %w", err))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only call summarization endpoint if OpenAI env vars are set
|
||||||
|
if openaiEndpoint != "" && openaiToken != "" {
|
||||||
fmt.Println(summ)
|
fmt.Println(summ)
|
||||||
|
} else {
|
||||||
|
fmt.Println("OpenAI endpoint and token not set, but prompt file was created for debugging")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func DoPrs(proj, ghusername, start, end string) map[string][]contributions.PullRequest {
|
func DoPrs(proj, ghusername, start, end string) map[string][]contributions.PullRequest {
|
||||||
|
|
|
||||||
|
|
@ -100,11 +100,15 @@ func SummarizeData(employeename string, prs map[string][]contributions.PullReque
|
||||||
// Build the prompt
|
// Build the prompt
|
||||||
fullPrompt := buildPrompt(employeename, prs, issues, tasks, prompt)
|
fullPrompt := buildPrompt(employeename, prs, issues, tasks, prompt)
|
||||||
|
|
||||||
// Call the summarization endpoint
|
// Call the summarization endpoint only if OpenAI env vars are set
|
||||||
|
if openaiEndpoint != "" && openaiToken != "" {
|
||||||
result, err := callSummarizationEndpoint(fullPrompt, openaiEndpoint, openaiToken, openaiModel)
|
result, err := callSummarizationEndpoint(fullPrompt, openaiEndpoint, openaiToken, openaiModel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return just the prompt if OpenAI env vars are not set
|
||||||
|
return fullPrompt, nil
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue