DevoxxGenieIDEAPlugin icon indicating copy to clipboard operation
DevoxxGenieIDEAPlugin copied to clipboard

[Bug] : Bug in Custom prompt initalization mechanism

Open samkerr4coding opened this issue 1 year ago • 4 comments

It seems that the method :

private void initializeDefaultPrompts() {
        if (customPrompts.isEmpty()) {
            customPrompts.add(new CustomPrompt(TEST_COMMAND, TEST_PROMPT));
            customPrompts.add(new CustomPrompt(EXPLAIN_COMMAND, EXPLAIN_PROMPT));
            customPrompts.add(new CustomPrompt(REVIEW_COMMAND, REVIEW_PROMPT));
            customPrompts.add(new CustomPrompt(FIND_COMMAND, FIND_PROMPT));
            customPrompts.add(new CustomPrompt(TDG_COMMAND, TDG_PROMPT));
        }
    }

is called twice at the initlization of the ToolWindowcontent the first time with the Constructor public DevoxxGenieStateService() the second time by the loadstate method

public void loadState(@NotNull DevoxxGenieStateService state).

The second pass the customPrompt list is coming with only 4 values (dont know why at this point)

The bug can be observed directly in the welcome message where command prompt are dynamically added image and we cannot see the newly added FIND command method.

@stephanj do you confirm?

samkerr4coding avatar Dec 12 '24 16:12 samkerr4coding

Indeed, however the /find should only be shown when RAG is activated. Will you investigate further or should I?

stephanj avatar Dec 12 '24 16:12 stephanj

I'm currently looking into the issue i'll keep you in touch as soon as possible

samkerr4coding avatar Dec 12 '24 17:12 samkerr4coding

Hello @stephanj some feedbacks on this topic it seems that the behavior i did observe was coming from my "deprecated" DevoxxGenieSettingsPlugin.xml file. Default prompt initlization from last version of code (with find command) was dumped by the xml state loaded from the persisted xml file.

I do not have solution at this point as i consider that this file can represent modification done by the user so i assume the user want to reload systematically his custom prompts even after an update of the plugin in IDEA.

However i'm working on a branch where with the following features :

  • A new "Restore default prompt" button in the prompt settings Panel so user can restore an up to date list of default prompts
  • A set of modifications related to issue-196 to avoid interpretation of words starting by / (for this point i will ask you to review my modifs as it is related to the SYSTEM_PROMPT string used to configure the llm)

samkerr4coding avatar Dec 13 '24 16:12 samkerr4coding

Sounds like a plan, thanks for the update.

stephanj avatar Dec 13 '24 16:12 stephanj