PRIX / lib /src /inputs.js
yamxxx1's picture
Upload 139 files
7da7e2c verified
Raw
History Blame
4.3 kB
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Inputs = void 0;
class Inputs {
systemMessage;
title;
description;
rawSummary;
shortSummary;
filename;
fileContent;
fileDiff;
patches;
diff;
commentChain;
comment;
suggestion;
error;
taskDescription;
codebaseStructure;
remedyContext;
batchContent;
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 = '', batchContent = '') {
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;
this.batchContent = batchContent;
}
clone() {
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, this.batchContent);
}
render(content) {
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) {
let desc = this.description;
if (desc.length > 2000) {
desc = `${desc.substring(0, 2000)}\n\n[Note: PR Description truncated]`;
}
content = content.replace('$description', desc);
}
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);
}
if (this.batchContent) {
content = content.replace('$batch_content', this.batchContent);
}
return content;
}
}
exports.Inputs = Inputs;
//# sourceMappingURL=inputs.js.map