2023-04-22 16:23:56 -04:00
|
|
|
package llm
|
|
|
|
|
|
|
|
// File represents a file in a git repository.
|
|
|
|
type File struct {
|
2023-09-04 16:44:59 -04:00
|
|
|
Path string `yaml:"path"`
|
|
|
|
Contents string `yaml:"contents"`
|
2023-04-22 16:23:56 -04:00
|
|
|
}
|
|
|
|
|
2023-05-08 20:14:19 -04:00
|
|
|
type ResponseType int
|
|
|
|
|
|
|
|
const (
|
|
|
|
ResponseAnswer ResponseType = iota
|
|
|
|
ResponseCodeChange
|
|
|
|
)
|
|
|
|
|
2023-04-22 16:23:56 -04:00
|
|
|
// CodeChangeRequest contains all necessary information for generating a prompt for a LLM.
|
|
|
|
type CodeChangeRequest struct {
|
2023-05-12 00:59:21 -04:00
|
|
|
Files []File
|
|
|
|
Subject string
|
|
|
|
Body string
|
|
|
|
IssueNumber int
|
|
|
|
BaseBranch string
|
2023-04-22 16:23:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CodeChangeResponse contains data derived from an LLM response to a prompt generated via a CodeChangeRequest.
|
|
|
|
type CodeChangeResponse struct {
|
2023-09-04 16:44:59 -04:00
|
|
|
Files []File `yaml:"files"`
|
|
|
|
Notes string `yaml:"notes"`
|
2023-04-22 16:23:56 -04:00
|
|
|
}
|
|
|
|
|
2023-05-08 20:14:19 -04:00
|
|
|
// TODO support threads
|
|
|
|
type DiffCommentRequest struct {
|
|
|
|
File File
|
|
|
|
Contents string
|
|
|
|
Diff string
|
2023-09-04 16:44:59 -04:00
|
|
|
PRNumber int
|
2023-04-22 16:23:56 -04:00
|
|
|
}
|
|
|
|
|
2023-05-08 20:14:19 -04:00
|
|
|
type DiffCommentResponse struct {
|
2023-09-04 16:44:59 -04:00
|
|
|
Type ResponseType `yaml:"responseType"`
|
|
|
|
Response string `yaml:"response"`
|
|
|
|
File File `yaml:"file"`
|
2023-04-22 16:23:56 -04:00
|
|
|
}
|