blazickjp / GPT-CodeApp

This project is everything Chat-GPT should be for developers! An advanced AI-driven coding companion tailored for developers. Seamlessly bridging the gap between traditional coding and AI capabilities, we offer real-time chat interactions, on-demand agent functions, and intuitive code management. Feedback welcome!
MIT License
33 stars 12 forks source link

Refactor Codebase to Use Abstract Syntax Trees for Code Changes #19

Closed blazickjp closed 11 months ago

blazickjp commented 11 months ago

PR Type:

Refactoring


PR Description:

This PR introduces a significant refactor of the codebase to use Abstract Syntax Trees (ASTs) for making code changes. The main changes include:


PR Main Files Walkthrough:

files: - `backend/tests/test_file_ops.py`: This is a new file that contains a comprehensive suite of unit tests for testing the functionality of the AST operations. The tests cover a wide range of scenarios, including modifying function, class, and method docstrings, adding and deleting imports, modifying classes and methods, renaming variables, adding functions and methods, and deleting classes and functions. - `backend/main.py`: This file has been significantly refactored to handle different configuration settings and improve the UX. The changes include setting the model, setting the max message tokens, setting the directory in prompt, setting the files in prompt, and saving the prompt. The file also includes new endpoints for getting the model, getting the max message tokens, and getting the files in prompt. - `backend/tests/test_ast_ops.py`: This is a new file that contains unit tests for the AST operations. The tests cover adding, deleting, and modifying functions. - `backend/agent/agent_functions/file_ops.py`: This is a new file that contains classes and methods for handling AST operations. The classes include AddClass, DeleteClass, ModifyClass, AddMethod, DeleteMethod, ModifyMethod, AddFunction, DeleteFunction, ModifyFunction, AddImport, DeleteImport, ModifyImport, and VariableNameChange. - `backend/agent/agent_functions/ast_ops.py`: This is a new file that contains classes and methods for applying AST changes. The classes include ASTChangeApplicator, AddFunction, DeleteFunction, and ModifyFunction. - `backend/agent/instructor_example.py`: This is a new file, but the content is not shown in the diff. - `backend/tests/test_coding_agent.py`: This is a new file, but the content is not shown in the diff. - `backend/agent/agent_prompts.py`: This is a new file, but the content is not shown in the diff. - `backend/test.py`: This is a new file, but the content is not shown in the diff. - `backend/agent/tset.json`: This is a new file, but the content is not shown in the diff.
blazickjp commented 11 months ago

/describe

github-actions[bot] commented 11 months ago

PR Analysis

How to use

To invoke the PR-Agent, add a comment using one of the following commands: /review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option. /describe: Modify the PR title and description based on the contents of the PR. /improve [--extended]: Suggest improvements to the code in the PR. Extended mode employs several calls, and provides a more thorough feedback. /ask \<QUESTION>: Pose a question about the PR. /update_changelog: Update the changelog based on the PR's contents.

To edit any configuration parameter from configuration.toml, add --config_path=new_value For example: /review --pr_reviewer.extra_instructions="focus on the file: ..." To list the possible configuration parameters, use the /config command.

blazickjp commented 11 months ago

/describe

blazickjp commented 11 months ago

/update_changelog

github-actions[bot] commented 11 months ago

Changelog updates:

2023-11-16

Changed

Added

to commit the new content to the CHANGELOG.md file, please type: '/update_changelog --pr_update_changelog.push_changelog_changes=true'

blazickjp commented 11 months ago

/update_changelog --pr_update_changelog.push_changelog_changes=true