PRININIT / lib /src /inputs.js
Rachit-Tw's picture
Upload 199 files
cbc1ce0 verified
Raw
History Blame Contribute Delete
2.92 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;
staticAnalysis;
issues;
previousFindings;
constructor(systemMessage, title, description, rawSummary, shortSummary, filename, fileContent, fileDiff, patches, diff, commentChain, comment, suggestion, error, staticAnalysis, issues, previousFindings) {
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.staticAnalysis = staticAnalysis;
this.issues = issues;
this.previousFindings = previousFindings;
}
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.staticAnalysis, this.issues, this.previousFindings);
}
render(content) {
if (!content)
return '';
const subs = [
['$system_message', this.systemMessage],
['$title', this.title],
['$description', this.description],
['$raw_summary', this.rawSummary],
['$short_summary', this.shortSummary],
['$filename', this.filename],
['$file_content', this.fileContent],
['$file_diff', this.fileDiff],
['$patches', this.patches],
['$diff', this.diff],
['$comment_chain', this.commentChain],
['$comment', this.comment],
['$suggestion', this.suggestion],
['$error', this.error],
['$static_analysis', this.staticAnalysis],
['$issues', this.issues],
['$previous_findings', this.previousFindings]
];
for (const [key, val] of subs) {
if (val) {
if (key === '$static_analysis') {
const MAX = 1000;
content = content.replace(key, val.length > MAX ? val.substring(0, MAX) + `\n[...truncated]` : val);
}
else {
content = content.replace(key, val);
}
}
}
return content;
}
}
exports.Inputs = Inputs;
//# sourceMappingURL=inputs.js.map