35 lines
795 B
Go
35 lines
795 B
Go
package pierre
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"git.schreifuchs.ch/schreifuchs/pierre-bot/internal/chatter"
|
|
)
|
|
|
|
type Service struct {
|
|
maxChunkSize int
|
|
guidelines []string
|
|
git GitAdapter
|
|
chat ChatAdapter
|
|
}
|
|
|
|
func New(chat ChatAdapter, git GitAdapter, maxChunkSize int, guidelines []string) *Service {
|
|
return &Service{
|
|
git: git,
|
|
chat: chat,
|
|
maxChunkSize: maxChunkSize,
|
|
guidelines: guidelines,
|
|
}
|
|
}
|
|
|
|
type GitAdapter interface {
|
|
GetDiff(ctx context.Context, owner, repo string, prID int) (io.ReadCloser, error)
|
|
AddComment(ctx context.Context, owner, repo string, prID int, comment Comment) error
|
|
}
|
|
|
|
type ChatAdapter interface {
|
|
GenerateStructured(ctx context.Context, messages []chatter.Message, target interface{}) error
|
|
GetProviderName() string
|
|
}
|