Skip to content

Commit

Permalink
fixes after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Frosendroska committed Jul 29, 2024
1 parent f77a23f commit 8e1eadf
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ class JavaPsiHelper(private val psiFile: PsiFile) : PsiHelper {

log.info(
"The test can be generated for: \n " +
" 1) Class ${javaPsiClassWrapped?.qualifiedName ?: "no class"} \n" +
" 2) Method ${javaPsiMethodWrapped?.name ?: "no method"} \n" +
" 3) Line $line",
" 1) Class ${javaPsiClassWrapped?.qualifiedName ?: "no class"} \n" +
" 2) Method ${javaPsiMethodWrapped?.name ?: "no method"} \n" +
" 3) Line $line",
)

return result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class KotlinPsiMethodWrapper(val psiFunction: KtFunction) : PsiMethodWrapper {
val containingInterface = containingClass?.isInterfaceClass()
// ensure that the function is a non-abstract method defined in an interface
name != "<init>" && // function is not a constructor
bodyExpression != null && // function has an implementation
containingInterface == true // function is defined within an interface
bodyExpression != null && // function has an implementation
containingInterface == true // function is defined within an interface
}

override fun containsLine(lineNumber: Int): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ class Pipeline(
project.service<CoverageVisualisationService>().showCoverage(report)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.jetbrains.research.testspark.tools.llm.error.LLMErrorManager
* A class that manages prompts for generating unit tests.
*
* @constructor Creates a PromptManager with the given parameters.
* @param psiHelper The PsiHelper in the context of witch the pipeline is executed.
* @param psiHelper The PsiHelper in the context of which the pipeline is executed.
* @param caret The place of the caret.
*/
class PromptManager(
Expand Down Expand Up @@ -183,7 +183,7 @@ class PromptManager(

fun isPromptSizeReductionPossible(testGenerationData: TestGenerationData): Boolean {
return (LlmSettingsArguments(project).maxPolyDepth(testGenerationData.polyDepthReducing) > 1) ||
(LlmSettingsArguments(project).maxInputParamsDepth(testGenerationData.inputParamsDepthReducing) > 1)
(LlmSettingsArguments(project).maxInputParamsDepth(testGenerationData.inputParamsDepthReducing) > 1)
}

fun reducePromptSize(testGenerationData: TestGenerationData): Boolean {
Expand All @@ -209,12 +209,8 @@ class PromptManager(
private fun showPromptReductionWarning(testGenerationData: TestGenerationData) {
llmErrorManager.warningProcess(
LLMMessagesBundle.get("promptReduction") + "\n" +
"Maximum depth of polymorphism is ${LlmSettingsArguments(project).maxPolyDepth(testGenerationData.polyDepthReducing)}.\n" +
"Maximum depth for input parameters is ${
LlmSettingsArguments(project).maxInputParamsDepth(
testGenerationData.inputParamsDepthReducing
)
}.",
"Maximum depth of polymorphism is ${LlmSettingsArguments(project).maxPolyDepth(testGenerationData.polyDepthReducing)}.\n" +
"Maximum depth for input parameters is ${LlmSettingsArguments(project).maxInputParamsDepth(testGenerationData.inputParamsDepthReducing)}.",
project,
)
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/properties/llm/LLMDefaults.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ openAIModel=
grazieName=AI Assistant JetBrains
grazieToken=
grazieModel=
huggingFaceName=HuggingFace
huggingFaceToken=
huggingFaceModel=
huggingFaceInitialSystemPrompt=You are a helpful and honest code and programming assistant. Please, respond concisely and truthfully.
maxLLMRequest=3
maxInputParamsDepth=2
maxPolyDepth=2
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/properties/llm/LLMMessages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ grazieError=Grazie test generation feature is not available in this build.
removeTemplateMessage=Choose another default template to remove this one.
removeTemplateTitle=Can't Be Removed
defaultPromptIsNotValidMessage=Default prompt is not valid. Fix it, please.
defaultPromptIsNotValidTitle=Incorrect Prompt State
defaultPromptIsNotValidTitle=Incorrect Prompt State
hfServerError=The selected model may need an HF PRO subscription to use!

0 comments on commit 8e1eadf

Please sign in to comment.