| export class Inputs { |
| systemMessage: string |
| title: string |
| description: string |
| rawSummary: string |
| shortSummary: string |
| filename: string |
| fileContent: string |
| fileDiff: string |
| patches: string |
| diff: string |
| commentChain: string |
| comment: string |
| suggestion: string |
| error: string |
| taskDescription: string |
| codebaseStructure: string |
| remedyContext: string |
|
|
| constructor( |
| systemMessage = '', |
| title = 'no title provided', |
| description = 'no description provided', |
| rawSummary = '', |
| shortSummary = '', |
| filename = '', |
| fileContent = 'file contents cannot be provided', |
| fileDiff = 'file diff cannot be provided', |
| patches = '', |
| diff = 'no diff', |
| commentChain = 'no other comments on this patch', |
| comment = 'no comment provided', |
| suggestion = '', |
| error = '', |
| taskDescription = '', |
| codebaseStructure = '', |
| remedyContext = '' |
| ) { |
| this.systemMessage = systemMessage |
| this.title = title |
| this.description = description |
| this.rawSummary = rawSummary |
| this.shortSummary = shortSummary |
| this.filename = filename |
| this.fileContent = fileContent |
| this.fileDiff = fileDiff |
| this.patches = patches |
| this.diff = diff |
| this.commentChain = commentChain |
| this.comment = comment |
| this.suggestion = suggestion |
| this.error = error |
| this.taskDescription = taskDescription |
| this.codebaseStructure = codebaseStructure |
| this.remedyContext = remedyContext |
| } |
|
|
| clone(): Inputs { |
| return new Inputs( |
| this.systemMessage, |
| this.title, |
| this.description, |
| this.rawSummary, |
| this.shortSummary, |
| this.filename, |
| this.fileContent, |
| this.fileDiff, |
| this.patches, |
| this.diff, |
| this.commentChain, |
| this.comment, |
| this.suggestion, |
| this.error, |
| this.taskDescription, |
| this.codebaseStructure, |
| this.remedyContext |
| ) |
| } |
|
|
| render(content: string): string { |
| if (!content) { |
| return '' |
| } |
| if (this.systemMessage) { |
| content = content.replace('$system_message', this.systemMessage) |
| } |
| if (this.title) { |
| content = content.replace('$title', this.title) |
| } |
| if (this.description) { |
| content = content.replace('$description', this.description) |
| } |
| if (this.rawSummary) { |
| content = content.replace('$raw_summary', this.rawSummary) |
| } |
| if (this.shortSummary) { |
| content = content.replace('$short_summary', this.shortSummary) |
| } |
| if (this.filename) { |
| content = content.replace('$filename', this.filename) |
| } |
| if (this.fileContent) { |
| content = content.replace('$file_content', this.fileContent) |
| } |
| if (this.fileDiff) { |
| content = content.replace('$file_diff', this.fileDiff) |
| } |
| if (this.patches) { |
| content = content.replace('$patches', this.patches) |
| } |
| if (this.diff) { |
| content = content.replace('$diff', this.diff) |
| } |
| if (this.taskDescription) { |
| content = content.replace('$task_description', this.taskDescription) |
| } |
| if (this.codebaseStructure) { |
| content = content.replace('$codebase_structure', this.codebaseStructure) |
| } |
| if (this.commentChain) { |
| content = content.replace('$comment_chain', this.commentChain) |
| } |
| if (this.comment) { |
| content = content.replace('$comment', this.comment) |
| } |
| if (this.suggestion) { |
| content = content.replace('$suggestion', this.suggestion) |
| } |
| if (this.error) { |
| content = content.replace('$error', this.error) |
| } |
| if (this.remedyContext) { |
| content = content.replace('$remedy_context', this.remedyContext) |
| } |
| return content |
| } |
| } |
|
|