From edc33774eddee9fd8cded135155a72dcad20a8fb Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Fri, 10 May 2024 16:16:45 +0300 Subject: [PATCH] feat(#87): completes analysis once --- .../java/git/tracehub/codereview/action/AnalysisRoutine.java | 5 ++--- .../git/tracehub/codereview/action/deep/AnalyzedWith.java | 4 ++-- .../tracehub/codereview/action/prompt/SuggestionPrompt.java | 2 +- .../tracehub/codereview/action/deep/AnalyzedWithTest.java | 2 +- .../codereview/action/prompt/SuggestionPromptTest.java | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/git/tracehub/codereview/action/AnalysisRoutine.java b/src/main/java/git/tracehub/codereview/action/AnalysisRoutine.java index a84fa70..587502a 100644 --- a/src/main/java/git/tracehub/codereview/action/AnalysisRoutine.java +++ b/src/main/java/git/tracehub/codereview/action/AnalysisRoutine.java @@ -104,13 +104,12 @@ public void exec(final Pull pull, final String model) throws Exception { ) ); final String score = analysis.completion(); - Logger.info(this, "Suggested review score is %s", score); if (score.toLowerCase(Locale.ROOT).contains("excellent")) { new FeedbackInPull( new StartWithNickname( this.approver, new AnalyzedWith( - analysis, + score, model ) ), @@ -143,7 +142,7 @@ public void exec(final Pull pull, final String model) throws Exception { ).asString() ) ) - ), + ).completion(), model ), score diff --git a/src/main/java/git/tracehub/codereview/action/deep/AnalyzedWith.java b/src/main/java/git/tracehub/codereview/action/deep/AnalyzedWith.java index 45a04c6..b1c5405 100644 --- a/src/main/java/git/tracehub/codereview/action/deep/AnalyzedWith.java +++ b/src/main/java/git/tracehub/codereview/action/deep/AnalyzedWith.java @@ -37,7 +37,7 @@ public final class AnalyzedWith implements Text { /** * Model. */ - private final Model model; + private final String completion; /** * Tag. @@ -48,7 +48,7 @@ public final class AnalyzedWith implements Text { public String asString() throws Exception { return String.join( "\n", - this.model.completion(), + this.completion, "", String.format( "Analyzed with `%s`", diff --git a/src/main/java/git/tracehub/codereview/action/prompt/SuggestionPrompt.java b/src/main/java/git/tracehub/codereview/action/prompt/SuggestionPrompt.java index cb0a969..7124f00 100644 --- a/src/main/java/git/tracehub/codereview/action/prompt/SuggestionPrompt.java +++ b/src/main/java/git/tracehub/codereview/action/prompt/SuggestionPrompt.java @@ -48,7 +48,7 @@ public final class SuggestionPrompt implements Text { public String asString() throws Exception { return String.join( "\n", - "Code review was not excellent, please post one suggestion for code reviewer", + "Code review was not excellent, please post one small suggestion (30 words is a max) for code reviewer", "what he/she can improve in the future.", "Start suggestion with text \"I would recommend ...\"", "Code review:", diff --git a/src/test/java/git/tracehub/codereview/action/deep/AnalyzedWithTest.java b/src/test/java/git/tracehub/codereview/action/deep/AnalyzedWithTest.java index c50fbbf..6a97805 100644 --- a/src/test/java/git/tracehub/codereview/action/deep/AnalyzedWithTest.java +++ b/src/test/java/git/tracehub/codereview/action/deep/AnalyzedWithTest.java @@ -38,7 +38,7 @@ final class AnalyzedWithTest { @Test void tagsResponse() throws Exception { final String tagged = new AnalyzedWith( - new FakeModel(), "fake-gpt-4" + new FakeModel().completion(), "fake-gpt-4" ).asString(); final String expected = "This is a fake completion performed by" diff --git a/src/test/java/git/tracehub/codereview/action/prompt/SuggestionPromptTest.java b/src/test/java/git/tracehub/codereview/action/prompt/SuggestionPromptTest.java index bd8a40c..22ccedd 100644 --- a/src/test/java/git/tracehub/codereview/action/prompt/SuggestionPromptTest.java +++ b/src/test/java/git/tracehub/codereview/action/prompt/SuggestionPromptTest.java @@ -45,7 +45,7 @@ void compilesSuggestionPrompt() throws Exception { ).asString(); final String expected = String.join( "\n", - "Code review was not excellent, please post one suggestion for code reviewer", + "Code review was not excellent, please post one small suggestion (30 words is a max) for code reviewer", "what he/she can improve in the future.", "Start suggestion with text \"I would recommend ...\"", "Code review:",