File size: 2,916 Bytes
272a04f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cbc1ce0
 
272a04f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cbc1ce0
272a04f
 
cbc1ce0
272a04f
 
4d0586c
272a04f
4d0586c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cbc1ce0
 
4d0586c
 
 
 
 
 
 
 
 
 
 
272a04f
 
 
 
 
a5489c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
"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