This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user