Skip to content

Commit 6ff2e8f

Browse files
committed
change online_log -> visualizer
1 parent 69ef21f commit 6ff2e8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+178
-3853
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN pip install --no-cache-dir -r requirements.txt
1717
# (you'll need to provide the actual key when running the container)
1818
ENV OPENAI_API_KEY=your_OpenAI_API_key
1919

20-
# Expose the port for online_log/app.py
20+
# Expose the port for visualizer/app.py
2121
EXPOSE 8000
2222

2323
# Set an entry point that runs a shell for interactive mode

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
【English | <a href="readme/README-Chinese.md">Chinese</a> | <a href="readme/README-Japanese.md">Japanese</a> | <a href="readme/README-Korean.md">Korean</a> | <a href="readme/README-Filipino.md">Filipino</a> | <a href="readme/README-French.md">French</a> | <a href="readme/README-Slovak.md">Slovak</a> | <a href="readme/README-Portuguese.md">Portuguese</a> | <a href="readme/README-Spanish.md">Spanish</a> | <a href="readme/README-Dutch.md">Dutch</a> | <a href="readme/README-Hindi.md">Hindi</a> | <a href="readme/README-Bahasa-Indonesia.md">Bahasa Indonesia</a>】
99
</p>
1010
<p align="center">
11-
【📚 <a href="wiki.md">Wiki</a> | 🚀 <a href="wiki.md#local-demo">Local Demo</a> | 👥 <a href="Contribution.md">Community Built Software</a> | 🔧 <a href="wiki.md#customization">Customization</a> | 👾 <a href="https://discord.gg/bn4t2Jy6TT")>Discord</a>】
11+
【📚 <a href="wiki.md">Wiki</a> | 🚀 <a href="wiki.md#visualizer">Visualizer</a> | 👥 <a href="Contribution.md">Community Built Software</a> | 🔧 <a href="wiki.md#customization">Customization</a> | 👾 <a href="https://discord.gg/bn4t2Jy6TT")>Discord</a>】
1212

1313
</p>
1414

1515
## 📖 Overview
1616

1717
- **ChatDev** stands as a **virtual software company** that operates through various **intelligent agents** holding
18-
different roles, including Chief Executive Officer <img src='online_log/static/figures/ceo.png' height=20>, Chief Product Officer <img src='online_log/static/figures/cpo.png' height=20>, Chief Technology Officer <img src='online_log/static/figures/cto.png' height=20>, programmer <img src='online_log/static/figures/programmer.png' height=20>, reviewer <img src='online_log/static/figures/reviewer.png' height=20>, tester <img src='online_log/static/figures/tester.png' height=20>, art designer <img src='online_log/static/figures/designer.png' height=20>. These
18+
different roles, including Chief Executive Officer <img src='visualizer/static/figures/ceo.png' height=20>, Chief Product Officer <img src='visualizer/static/figures/cpo.png' height=20>, Chief Technology Officer <img src='visualizer/static/figures/cto.png' height=20>, programmer <img src='visualizer/static/figures/programmer.png' height=20>, reviewer <img src='visualizer/static/figures/reviewer.png' height=20>, tester <img src='visualizer/static/figures/tester.png' height=20>, art designer <img src='visualizer/static/figures/designer.png' height=20>. These
1919
agents form a multi-agent organizational structure and are united by a mission to "revolutionize the digital world
2020
through programming." The agents within ChatDev **collaborate** by participating in specialized functional seminars,
2121
including tasks such as designing, coding, testing, and documenting.
@@ -40,16 +40,16 @@
4040
<p align="center">
4141
<img src='./misc/docker.png' width=400>
4242
</p>
43-
- September 25, 2023: The **Git** mode is now available, enabling the programmer <img src='online_log/static/figures/programmer.png' height=20> to utilize Git for version control. To enable this feature, simply set ``"git_management"`` to ``"True"`` in ``ChatChainConfig.json``. See [guide](wiki.md#git-mode).
43+
- September 25, 2023: The **Git** mode is now available, enabling the programmer <img src='visualizer/static/figures/programmer.png' height=20> to utilize Git for version control. To enable this feature, simply set ``"git_management"`` to ``"True"`` in ``ChatChainConfig.json``. See [guide](wiki.md#git-mode).
4444
<p align="center">
4545
<img src='./misc/github.png' width=600>
4646
</p>
47-
- September 20, 2023: The **Human-Agent-Interaction** mode is now available! You can get involved with the ChatDev team by playing the role of reviewer <img src='online_log/static/figures/reviewer.png' height=20> and making suggestions to the programmer <img src='online_log/static/figures/programmer.png' height=20>;
47+
- September 20, 2023: The **Human-Agent-Interaction** mode is now available! You can get involved with the ChatDev team by playing the role of reviewer <img src='visualizer/static/figures/reviewer.png' height=20> and making suggestions to the programmer <img src='visualizer/static/figures/programmer.png' height=20>;
4848
try ``python3 run.py --task [description_of_your_idea] --config "Human"``. See [guide](wiki.md#human-agent-interaction) and [example](WareHouse/Gomoku_HumanAgentInteraction_20230920135038).
4949
<p align="center">
5050
<img src='./misc/Human_intro.png' width=600>
5151
</p>
52-
- September 1, 2023: The **Art** mode is available now! You can activate the designer agent <img src='online_log/static/figures/designer.png' height=20> to generate images used in the software;
52+
- September 1, 2023: The **Art** mode is available now! You can activate the designer agent <img src='visualizer/static/figures/designer.png' height=20> to generate images used in the software;
5353
try ``python3 run.py --task [description_of_your_idea] --config "Art"``. See [guide](wiki.md#art) and [example](WareHouse/gomokugameArtExample_THUNLP_20230831122822).
5454
- August 28, 2023: The system is publicly available.
5555
- August 17, 2023: The v1.0.0 version was ready for release.
@@ -152,8 +152,7 @@ To get started, follow these steps:
152152
For more detailed information, please refer to our [Wiki](wiki.md), where you can find:
153153

154154
- An introduction to all command run parameters.
155-
- A straightforward guide for setting up a local web demo, which includes enhanced visualized logs, a replay demo, and a
156-
simple ChatChain Visualizer.
155+
- A straightforward guide for setting up a local web visualizer demo, which can visualize real-time logs, replayed logs, and ChatChain.
157156
- An overview of the ChatDev framework.
158157
- A comprehensive introduction to all advanced parameters in ChatChain configuration.
159158
- Guides for customizing ChatDev, including:

camel/agents/role_playing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from camel.messages import ChatMessage, UserChatMessage
2424
from camel.messages import SystemMessage
2525
from camel.typing import ModelType, RoleType, TaskType, PhaseType
26-
from chatdev.utils import log_arguments, log_and_print_online
26+
from chatdev.utils import log_arguments, log_visualize
2727

2828

2929
@log_arguments
@@ -199,7 +199,7 @@ def init_chat(self, phase_type: PhaseType = None,
199199
self.user_agent.update_messages(pseudo_msg)
200200

201201
# here we concatenate to store the real message in the log
202-
log_and_print_online(self.user_agent.role_name,
202+
log_visualize(self.user_agent.role_name,
203203
"**[Start Chat]**\n\n[" + self.assistant_agent.system_message.content + "]\n\n" + content)
204204
return None, user_msg
205205

chatdev/chat_chain.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from camel.typing import TaskType, ModelType
1212
from chatdev.chat_env import ChatEnv, ChatEnvConfig
1313
from chatdev.statistics import get_info
14-
from chatdev.utils import log_and_print_online, now
14+
from chatdev.utils import log_visualize, now
1515

1616

1717
def check_bool(s):
@@ -234,7 +234,7 @@ def pre_processing(self):
234234
preprocess_msg += "**Log File**: {}\n\n".format(self.log_filepath)
235235
preprocess_msg += "**ChatDevConfig**:\n{}\n\n".format(self.chat_env.config.__str__())
236236
preprocess_msg += "**ChatGPTConfig**:\n{}\n\n".format(chat_gpt_config)
237-
log_and_print_online(preprocess_msg)
237+
log_visualize(preprocess_msg)
238238

239239
# init task prompt
240240
if check_bool(self.config['self_improve']):
@@ -254,14 +254,14 @@ def post_processing(self):
254254
root = os.path.dirname(filepath)
255255

256256
if self.chat_env_config.git_management:
257-
git_online_log = "**[Git Information]**\n\n"
257+
log_git_info = "**[Git Information]**\n\n"
258258

259259
self.chat_env.codes.version += 1
260260
os.system("cd {}; git add .".format(self.chat_env.env_dict["directory"]))
261-
git_online_log += "cd {}; git add .\n".format(self.chat_env.env_dict["directory"])
261+
log_git_info += "cd {}; git add .\n".format(self.chat_env.env_dict["directory"])
262262
os.system("cd {}; git commit -m \"v{} Final Version\"".format(self.chat_env.env_dict["directory"], self.chat_env.codes.version))
263-
git_online_log += "cd {}; git commit -m \"v{} Final Version\"\n".format(self.chat_env.env_dict["directory"], self.chat_env.codes.version)
264-
log_and_print_online(git_online_log)
263+
log_git_info += "cd {}; git commit -m \"v{} Final Version\"\n".format(self.chat_env.env_dict["directory"], self.chat_env.codes.version)
264+
log_visualize(log_git_info)
265265

266266
git_info = "**[Git Log]**\n\n"
267267
import subprocess
@@ -276,7 +276,7 @@ def post_processing(self):
276276
log_output = "Error when executing " + command
277277

278278
git_info += log_output
279-
log_and_print_online(git_info)
279+
log_visualize(git_info)
280280

281281
post_info = "**[Post Info]**\n\n"
282282
now_time = now()
@@ -300,7 +300,7 @@ def post_processing(self):
300300
shutil.rmtree(file_path, ignore_errors=True)
301301
post_info += "{} Removed.".format(file_path) + "\n\n"
302302

303-
log_and_print_online(post_info)
303+
log_visualize(post_info)
304304

305305
logging.shutdown()
306306
time.sleep(1)
@@ -339,14 +339,14 @@ def self_task_improve(self, task_prompt):
339339
model_type=self.model_type,
340340
)
341341

342-
# log_and_print_online("System", role_play_session.assistant_sys_msg)
343-
# log_and_print_online("System", role_play_session.user_sys_msg)
342+
# log_visualize("System", role_play_session.assistant_sys_msg)
343+
# log_visualize("System", role_play_session.user_sys_msg)
344344

345345
_, input_user_msg = role_play_session.init_chat(None, None, self_task_improve_prompt)
346346
assistant_response, user_response = role_play_session.step(input_user_msg, True)
347347
revised_task_prompt = assistant_response.msg.content.split("<INFO>")[-1].lower().strip()
348-
log_and_print_online(role_play_session.assistant_agent.role_name, assistant_response.msg.content)
349-
log_and_print_online(
348+
log_visualize(role_play_session.assistant_agent.role_name, assistant_response.msg.content)
349+
log_visualize(
350350
"**[Task Prompt Self Improvement]**\n**Original Task Prompt**: {}\n**Improved Task Prompt**: {}".format(
351351
task_prompt, revised_task_prompt))
352352
return revised_task_prompt

chatdev/chat_env.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from chatdev.codes import Codes
1313
from chatdev.documents import Documents
1414
from chatdev.roster import Roster
15-
from chatdev.utils import log_and_print_online
15+
from chatdev.utils import log_visualize
1616

1717

1818
class ChatEnvConfig:
@@ -60,7 +60,7 @@ def fix_module_not_found_error(test_reports):
6060
for match in re.finditer(r"No module named '(\S+)'", test_reports, re.DOTALL):
6161
module = match.group(1)
6262
subprocess.Popen("pip install {}".format(module), shell=True).wait()
63-
log_and_print_online("**[CMD Execute]**\n\n[CMD] pip install {}".format(module))
63+
log_visualize("**[CMD Execute]**\n\n[CMD] pip install {}".format(module))
6464

6565
def set_directory(self, directory):
6666
assert len(self.env_dict['directory']) == 0

chatdev/codes.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import re
44
import subprocess
55

6-
from chatdev.utils import log_and_print_online
6+
from chatdev.utils import log_visualize
77

88

99
class Codes:
@@ -70,7 +70,7 @@ def _update_codes(self, generated_content):
7070
7171
'''\n""" + unified_diff + "\n```"
7272

73-
log_and_print_online(update_codes_content)
73+
log_visualize(update_codes_content)
7474
self.codebooks[key] = new_codes.codebooks[key]
7575

7676
def _rewrite_codes(self, git_management, phase_info=None) -> None:
@@ -91,12 +91,12 @@ def _rewrite_codes(self, git_management, phase_info=None) -> None:
9191
if git_management:
9292
if not phase_info:
9393
phase_info = ""
94-
git_online_log = "**[Git Information]**\n\n"
94+
log_git_info = "**[Git Information]**\n\n"
9595
if self.version == 1.0:
9696
os.system("cd {}; git init".format(self.directory))
97-
git_online_log += "cd {}; git init\n".format(self.directory)
97+
log_git_info += "cd {}; git init\n".format(self.directory)
9898
os.system("cd {}; git add .".format(self.directory))
99-
git_online_log += "cd {}; git add .\n".format(self.directory)
99+
log_git_info += "cd {}; git add .\n".format(self.directory)
100100

101101
# check if there exist diff
102102
completed_process = subprocess.run("cd {}; git status".format(self.directory), shell=True, text=True,
@@ -106,18 +106,18 @@ def _rewrite_codes(self, git_management, phase_info=None) -> None:
106106
return
107107

108108
os.system("cd {}; git commit -m \"v{}\"".format(self.directory, str(self.version) + " " + phase_info))
109-
git_online_log += "cd {}; git commit -m \"v{}\"\n".format(self.directory,
109+
log_git_info += "cd {}; git commit -m \"v{}\"\n".format(self.directory,
110110
str(self.version) + " " + phase_info)
111111
if self.version == 1.0:
112112
os.system("cd {}; git submodule add ./{} {}".format(os.path.dirname(os.path.dirname(self.directory)),
113113
"WareHouse/" + os.path.basename(self.directory),
114114
"WareHouse/" + os.path.basename(self.directory)))
115-
git_online_log += "cd {}; git submodule add ./{} {}\n".format(
115+
log_git_info += "cd {}; git submodule add ./{} {}\n".format(
116116
os.path.dirname(os.path.dirname(self.directory)),
117117
"WareHouse/" + os.path.basename(self.directory),
118118
"WareHouse/" + os.path.basename(self.directory))
119-
log_and_print_online(rewrite_codes_content)
120-
log_and_print_online(git_online_log)
119+
log_visualize(rewrite_codes_content)
120+
log_visualize(log_git_info)
121121

122122
def _get_codes(self) -> str:
123123
content = ""
@@ -134,4 +134,4 @@ def _load_from_hardware(self, directory) -> None:
134134
if filename.endswith(".py"):
135135
code = open(os.path.join(directory, filename), "r", encoding="utf-8").read()
136136
self.codebooks[filename] = self._format_code(code)
137-
log_and_print_online("{} files read from {}".format(len(self.codebooks.keys()), directory))
137+
log_visualize("{} files read from {}".format(len(self.codebooks.keys()), directory))

chatdev/composed_phase.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from camel.typing import ModelType
77
from chatdev.chat_env import ChatEnv
8-
from chatdev.utils import log_and_print_online
8+
from chatdev.utils import log_visualize
99

1010

1111
def check_bool(s):
@@ -142,7 +142,7 @@ def execute(self, chat_env) -> ChatEnv:
142142
max_turn_step = phase_item['max_turn_step']
143143
need_reflect = check_bool(phase_item['need_reflect'])
144144
self.phase_env["cycle_index"] = cycle_index
145-
log_and_print_online(
145+
log_visualize(
146146
f"**[Execute Detail]**\n\nexecute SimplePhase:[{phase}] in ComposedPhase:[{self.phase_name}], cycle {cycle_index}")
147147
if phase in self.phases:
148148
self.phases[phase].phase_env = self.phase_env
@@ -246,7 +246,7 @@ def update_chat_env(self, chat_env):
246246

247247
def break_cycle(self, phase_env) -> bool:
248248
if not phase_env['exist_bugs_flag']:
249-
log_and_print_online(f"**[Test Info]**\n\nAI User (Software Test Engineer):\nTest Pass!\n")
249+
log_visualize(f"**[Test Info]**\n\nAI User (Software Test Engineer):\nTest Pass!\n")
250250
return True
251251
else:
252252
return False

0 commit comments

Comments
 (0)