diff --git a/src/formatted-summary.ts b/src/formatted-summary.ts index 1637b291..8c8c3511 100644 --- a/src/formatted-summary.ts +++ b/src/formatted-summary.ts @@ -43,7 +43,7 @@ export class FormattedSummary implements Scalar { ### Problems ${this.problems} - ### Suggestions + ### Suggestion ${this.suggestions} `; } diff --git a/src/main.ts b/src/main.ts index acd64c42..d2b433df 100644 --- a/src/main.ts +++ b/src/main.ts @@ -178,7 +178,7 @@ async function run() { await new Feedback( new FormattedSummary( composed.problems, - composed.suggestions + composed.suggestion ), octokit, issue, diff --git a/src/models.ts b/src/models.ts index 9d4b7133..1568437b 100644 --- a/src/models.ts +++ b/src/models.ts @@ -31,6 +31,7 @@ import {MdSuggestions} from "./prompts/md-suggestions"; import {Suggestions} from "./prompts/suggestions"; import {Polish} from "./prompts/polish"; import {Top} from "./prompts/top"; +import {OneSuggestion} from "./prompts/one-suggestion"; /** * Models. @@ -85,25 +86,34 @@ export class Models { ).exec() ) ).exec(); - const suggestions = await new NamedGoal( - "suggestions.md", + const suggestion = await new NamedGoal( + "one", this.def, new Default(), - new MdSuggestions( + new OneSuggestion( + problems, await new NamedGoal( - "suggestions", + "suggestions.md", this.def, new Default(), - new Suggestions( - report, - problems + new MdSuggestions( + await new NamedGoal( + "suggestions", + this.def, + new Default(), + new Suggestions( + report, + problems + ) + ).exec() ) - ).exec() + ).exec(), + report ) ).exec(); return { problems: problems, - suggestions: suggestions + suggestion: suggestion } } } diff --git a/src/prompts/one-suggestion.ts b/src/prompts/one-suggestion.ts new file mode 100644 index 00000000..bde7561c --- /dev/null +++ b/src/prompts/one-suggestion.ts @@ -0,0 +1,61 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2023-2024 Tracehub.git + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * One suggestion. + */ +export class OneSuggestion implements Scalar { + + /** + * Ctor. + * @param probmels Problems + * @param suggestions Suggestions + * @param report Report + */ + constructor( + private readonly probmels: any, + private readonly suggestions: any, + private readonly report: string + ) { + } + + value(): string { + return ` + Take a look at suggestions we propose for solving outlined problems with quality + of following bug report. Such long list of suggestions is absolutely useless. + Nobody reads it and nobody pays attention. In order to be useful, + please suggest only one specific improvement to be made. + The suggestion must be short, less than 30 words. + + Suggestions: +${this.suggestions} + + Problems: +${this.probmels} + + Report: +${this.report} + ` + } +}