RocketChat / Apps.RC.AI.Programmer

Generate short code snippets in various languages using LLMs within Rocket.Chat. Share directly or create pull requests on GitHub.
1 stars 0 forks source link

[Feature] Allow Users to Ask For Code Refinement & UI (Contextual Bar) Improvement #20

Closed RyanbowZ closed 1 month ago

RyanbowZ commented 2 months ago

This PR mainly includes the function updates to support the use case of asking for code refinements, together with well designed LLM prompts to incorporate user input and clear contextual bar UI to enable a smooth interaction and correct functionality.

Several quality updates are also made, such as fixing indentation and variable names problems, replacing the openSurfaceView logics with updateSurfaceView to ensure proper render when two contextual bars open simultaneously.

Issue(s)

This PR's function updates closed #15 #16 #17 #18 and #19 .

Acceptance Criteria fulfillment

Proposed Changes

This PR completed the functions to support the use case for asking for code refinements. Users can now ask the LLM to generate a variation of the code to satisfy their specific needs based on the previous generated code version. To support the function of making code refinements, we also designed a new LLM prompt such that to tell the LLM to make refinements on the previous code generation results according to the requirements input by the user.

To enable the smooth user interaction, the app now splits the function of generate code and refine code into two contextual bars. Users can now type in their requirements in the generate code input box and press 'generate' button to generate code. Users can also type in the refinement need in the regeneration code input box and press 'regenerate' button to ask for a refinement over the code results.

Meanwhile, considering the case when app opens a new surface view, there's already other surface view opened, we will choose to update the surface view on the existed surface view to resolve the conflicts. Besides, several minor issues have also been resolved, such as indentation fix and variable names.

Results

image image