begin implementing comments (#2)

add a section of the main loop that checks for comments on PRs that the
bot has opened

reworks git logic and adds debug commands for git and llm stuff
changes a  bunch of other stuff too
This commit is contained in:
Maximillian von Briesen
2023-05-08 20:14:19 -04:00
committed by GitHub
parent 39d0ad7d0b
commit ab7521477a
14 changed files with 644 additions and 405 deletions

54
cmd/debug-git.go Normal file
View File

@@ -0,0 +1,54 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
var debugGitCmd = &cobra.Command{
Use: "debug-git",
Short: "debug git functionality",
Run: func(cmd *cobra.Command, args []string) {
cfg := getConfig()
p, err := getPullPal(cmd.Context(), cfg)
if err != nil {
fmt.Println("error creating new pull pal", err)
return
}
fmt.Println("Successfully initialized pull pal")
err = p.DebugGit()
if err != nil {
fmt.Println("err debugging git", err)
return
}
},
}
var debugGithubCmd = &cobra.Command{
Use: "debug-github",
Short: "debug github functionality",
Run: func(cmd *cobra.Command, args []string) {
cfg := getConfig()
p, err := getPullPal(cmd.Context(), cfg)
if err != nil {
fmt.Println("error creating new pull pal", err)
return
}
fmt.Println("Successfully initialized pull pal")
err = p.DebugGithub(cfg.usersToListenTo)
if err != nil {
fmt.Println("err debugging github", err)
return
}
},
}
func init() {
rootCmd.AddCommand(debugGitCmd)
rootCmd.AddCommand(debugGithubCmd)
}

View File

@@ -6,9 +6,9 @@ import (
"github.com/spf13/cobra"
)
var debugGitCmd = &cobra.Command{
Use: "debug-git",
Short: "debug git functionality",
var debugLLMCmd = &cobra.Command{
Use: "debug-llm",
Short: "debug llm functionality",
Run: func(cmd *cobra.Command, args []string) {
cfg := getConfig()
@@ -19,14 +19,14 @@ var debugGitCmd = &cobra.Command{
}
fmt.Println("Successfully initialized pull pal")
err = p.DebugGit()
err = p.DebugLLM()
if err != nil {
fmt.Println("err debugging git", err)
fmt.Println("err debugging prompts", err)
return
}
},
}
func init() {
rootCmd.AddCommand(debugGitCmd)
rootCmd.AddCommand(debugLLMCmd)
}

View File

@@ -7,6 +7,7 @@ import (
"github.com/mobyvb/pull-pal/pullpal"
"github.com/mobyvb/pull-pal/vc"
"github.com/sashabaranov/go-openai"
"go.uber.org/zap"
"github.com/spf13/cobra"
@@ -79,7 +80,8 @@ func getPullPal(ctx context.Context, cfg config) (*pullpal.PullPal, error) {
Handles: cfg.usersToListenTo,
Labels: cfg.requiredIssueLabels,
}
p, err := pullpal.NewPullPal(ctx, log.Named("pullpal"), listIssueOptions, author, repo, cfg.openAIToken)
// TODO make model configurable
p, err := pullpal.NewPullPal(ctx, log.Named("pullpal"), listIssueOptions, author, repo, openai.GPT4, cfg.openAIToken)
return p, err
}