Skip to content

Commit

Permalink
catch comment source code exception
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-husky committed Oct 30, 2024
1 parent 23ef2ff commit 7497dcb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crazy_functions/SourceCode_Comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from crazy_functions.agent_fns.python_comment_agent import PythonCodeComment
from crazy_functions.diagram_fns.file_tree import FileNode
from shared_utils.advanced_markdown_format import markdown_convertion_for_file
from loguru import logger

def 注释源代码(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt):

Expand Down Expand Up @@ -92,7 +93,10 @@ def _task_multi_threading(i_say, gpt_say, fp, file_tree_struct):
preview_html_list = []
for done, fp in zip(worker_done, file_manifest):
if not done: continue
preview_html_list.append(file_tree_struct.manifest[fp].compare_html)
if hasattr(file_tree_struct.manifest[fp], 'compare_html'):
preview_html_list.append(file_tree_struct.manifest[fp].compare_html)
else:
logger.error(f"文件: {fp} 的注释结果未能成功")
file_links = generate_file_link(preview_html_list)

yield from update_ui_lastest_msg(
Expand Down

0 comments on commit 7497dcb

Please sign in to comment.