AI‑агент комментирования кода — демо

Частичная версия: локальная генерация шаблонных комментариев.

LLM Studio LangChain
До
import os def scan_repo(path): files = [] for root, _, names in os.walk(path): for name in names: if name.endswith(".py"): files.append(os.path.join(root, name)) return files def enrich_file(path, agent): with open(path, "r", encoding="utf-8") as f: code = f.read() return agent.add_comments(code) def run_pipeline(repo_path, agent): files = scan_repo(repo_path) result = [] for file_path in files: result.append(enrich_file(file_path, agent)) return result
После
import os # Сканирует репозиторий. Параметры: path. Возвращает: Список найденных элементов. def scan_repo(path): files = [] for root, _, names in os.walk(path): for name in names: if name.endswith(".py"): files.append(os.path.join(root, name)) return files # Дополняет файл. Параметры: path, agent. Возвращает: Преобразованные данные. def enrich_file(path, agent): with open(path, "r", encoding="utf-8") as f: code = f.read() return agent.add_comments(code) # Запускает конвейер. Параметры: repo_path, agent. Возвращает: Результат выполнения функции. def run_pipeline(repo_path, agent): files = scan_repo(repo_path) result = [] for file_path in files: result.append(enrich_file(file_path, agent)) return result