- You can use docker for a quick and safe use of ChatDev. You will need some extra steps to allow executing GUI program in docker since ChatDev often create software with GUI and execute them in the Test Phase.
### Install Docker
- Please refer to the [Docker Official Website](https://www.docker.com/get-started/) for installing Docker.
### Prepare GUI connection between Host and Docker
- Take macOS for example,
- install socat and xquartz, you may need to restart the computer after installing the xquartz
```commandline
brew install socat xquartz
```
- open xquartz and go into the settings, allow connections from network clients
- ![xquartz](misc/xquartz.jpg)
- run following command on the host computer and keep it.
"According to the new user's task and some creative brainstorm ideas listed below: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Ideas: \"{ideas}\".",
"We have decided to complete the task through an executable software implemented via a programming language. ",
"As the {assistant_role}, to satisfy the new user's demand and make the software realizable, you should propose a concrete programming language. If python can complete this task via Python, please answer Python; otherwise, answer another programming language (e.g., Java, C++, etc,).",
"Note that we must ONLY discuss the target programming language and do not discuss anything else! Once we all have expressed our opinion(s) and agree with the results of the discussion unanimously, any of us must actively terminate the discussion and conclude the best programming language we have discussed without any other words or reasons, using the format: \"<INFO>*\" where \"*\" represents a programming language."
- As shown in the ChatChain visualization of Default setting, ChatDev will produce a software in the order of:
- Demand Analysis: decide the modality of the software
- Language Choose: decide the programming language
- Coding: write the code
- CodeCompleteAll: complete the missing function/class
- CodeReview: review and modify the code
- Test: run the software and modify the code based on the test report
- EnvironmentDoc: write the environment doc
- Manual: write the manual
- You can use default setting using ``python3 run.py --config "Default"``.
### Art
![demo](misc/ChatChain_Visualization_Art.png)
- Compared to Default, Art setting add a phase before CodeCompleteAll called Art
- The Art phase will first discuss the name and description of the images assets, then use ``openai.Image.create`` to generate the images based on description.
- You can use default setting using ``python3 run.py --config "Art"`` or just ignore the config parameter.
### Human-Agent Interaction
![demo](misc/ChatChain_Visualization_Human.png)
- Compared to Default, in ***Human-Agent-Interaction*** mode you can play as reviewer and asks programmer agent to modify the code based on your comments.
- You can use ***Human-Agent-Interaction*** setting using ``python3 run.py --config "Human"``.
- When chatdev executes to this Phase, on the command interface you will see a hint that ask for input.
- You can run your software in the ``WareHouse/`` and see if it satisfies your need. Then you can type anything you want (bug fix or new feature) in the command interface, then press Enter:
![Human_command](misc/Human_command.png)
- For example
- We first run the ChatDev with task "design a gomoku game"
- Then we type "Please add a restart button" in the HumanAgentInteraction Phase, adding the first feature
- In the second loop of HumanAgentInteraction, we add another feature by typing "Please add a current status bar showing whose turn it is".
- At last, we early exit this mode by typing "End".
- Simply set ``"git_management"`` to ``"True"`` in ``ChatChainConfig.json`` enables the Git Mode, in which ChatDev will make the generated software folder a git repository and automatically make all commits.
- Every change made on the code of generated software will create a commit, including:
- The initial commit, created after the ``Coding`` phase completed, with a commit message ``Finish Coding``.
- Complete ``ArtIntegration`` phase, with a commit message ``Finish Art Integration``.
- Complete ``CodeComplete`` phase, with a commit message ``Code Complete #1/2/3 Finished``(if the CodeComplete is executed in three loops).
- Complete ``CodeReviewModification`` phase, with a commit message ``Review #1/2/3 Finished``(if the CodeReviewModification is executed in three loops).
- Complete ``CodeReviewHuman`` phase, with a commit message ``Human Review #1/2/3 Finished``(if the CodeReviewHuman is executed in three loops).
- Complete ``TestModification`` phase, with a commit message ``Test #1/2/3 Finished``(if the TestModification is executed in three loops).
- All phases completed, with a commit message ``Final Version``.
- On the terminal and online log UI you can see the git summary at the end of process.
- You can also search ``git Information`` in the log file to see when did commit happen.
- ⚠️ There are a few things worth noting about Git Mode:
- ChatDev is a git project, and we need to create another git project in the generated software folder, so we use ``git submodule`` to make this "git over git" function. A ``.gitmodule`` file will be created.
- under the software folder, you can add/commit/push/checkout the software project just like a normal git project, and your commits would not modify the ChatDev git history.
- under the ChatDev folder, the new software has been added to the ChatDev as a whole folder.
- The generated log file would not be added into the software git project, since the log is closed and moved to the software folder after the final commit. We have to do this because the log should record all the git commits, including the final one. So the git operations must be done before the log finalized. You will always see a log file to be added and committed in the software folder, like:
- ![img.png](misc/the_log_left.png)
- When you perform ``git add .`` under the ChatDev project, There will be information like (taking Gomoku for example):
```commandline
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: .gitmodules
new file: WareHouse/Gomoku_GitMode_20231025184031
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
If you add and commit the software log file under the software folder, there will be no ``Changes not staged for commit:``
- Some phase executions may not change the code, and thereby there is no commit. For example, the software is tested without problems and there is no modification, so the test phase would leave no commit.