From 46350c1c09bc051c36070f70a497cacf8ebf409a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=91=D0=B0=D0=BD=D0=B4?= =?UTF-8?q?=D1=83=D1=80=D0=B8=D1=81=D1=82?= Date: Tue, 5 May 2026 20:22:12 +1000 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D0=BC=D1=83=D0=B2=20=D0=B1=D0=B0?= =?UTF-8?q?=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/routes.py | 4 ---- services/document_builder.py | 10 +--------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/api/routes.py b/api/routes.py index 3eabd81..94213f0 100644 --- a/api/routes.py +++ b/api/routes.py @@ -138,11 +138,8 @@ def setup_routes(app: FastAPI) -> None: all_files = [] current_date = start_date while current_date <= finish_date: - print(current_date) date_path = current_date.strftime("%Y/%m/%d") - print(date_path) full_dir_path = os.path.join(DOCUMENTS_DIR, date_path) - print(full_dir_path) if os.path.exists(full_dir_path): for file in os.listdir(full_dir_path): @@ -150,7 +147,6 @@ def setup_routes(app: FastAPI) -> None: file_title = file[:-5] # убираем расширение .docx if file_title in titles_from_db: all_files.append(os.path.join(full_dir_path, file)) - print(all_files) current_date += timedelta(days=1) diff --git a/services/document_builder.py b/services/document_builder.py index b624cd4..09575d1 100644 --- a/services/document_builder.py +++ b/services/document_builder.py @@ -35,14 +35,6 @@ def update_bd_and_create_document( clean_response = response_text.strip().replace('```json', '').replace('```', '').strip() data = json.loads(clean_response) - # Проверяем наличие обязательных полей от GPT - # missing_fields = [f for f in REQUIRED_FIELDS if not data.get(f)] - # if missing_fields: - # print(f"Ответ GPT не содержит обязательных полей: {missing_fields} для URL: {url}") - # logger.warning(f"Ответ GPT не содержит обязательных полей: {missing_fields} для URL: {url}") - # print(f"Полученные данные: {data}") - # return - # Нормализация типов: category может приходить как list, а ожидается str if isinstance(data.get('category'), list): data['category'] = ', '.join(data['category']) @@ -67,7 +59,7 @@ def update_bd_and_create_document( print("Данные успешно сохранены в БД") # Создание DOCX документа - path_day = article_date.split()[0] + path_day = parsed_at.split()[0].replace('-', '/') documents_path = os.path.join(DOCUMENTS_DIR, path_day) if not os.path.exists(documents_path): os.makedirs(documents_path)