diff --git a/dokogen/ui.py b/dokogen/ui.py index 94aaa53..6fecafd 100644 --- a/dokogen/ui.py +++ b/dokogen/ui.py @@ -3006,7 +3006,7 @@ class DokoGenApp: security_data = { 'name': isys.name or '', 'description': isys.description or '', - 'category': isys.category or '', + 'category': self._norm_category(isys.category) or '', 'sphere': isys.sphere or '', 'object_type': isys.object_type or '', 'architecture': isys.architecture or '', @@ -3134,8 +3134,9 @@ class DokoGenApp: if not lb: return lb.delete(0, tk.END) - for line in (text or '').split('\n'): - line = line.strip() + import re as _re3 + for line in _re3.split(r'[\n,;]+', text or ''): + line = line.strip().lstrip('•-–— ') if line: lb.insert(tk.END, line) @@ -3533,7 +3534,7 @@ class DokoGenApp: data = { 'name': isys.name or '', 'description': isys.description or '', - 'category': isys.category or '', + 'category': self._norm_category(isys.category) or '', 'sphere': isys.sphere or '', 'object_type': isys.object_type or '', 'criteria_values': isys.criteria_values or '', @@ -3590,6 +3591,12 @@ class DokoGenApp: self._verify_log("🤖 Проверка категорий ИИ завершена") self.log("🤖 Проверка категорий ИИ завершена") + @staticmethod + def _norm_category(cat): + """Нормализация категории значимости: '1'/'2'/'3' → 'I'/'II'/'III'.""" + cat = (cat or '').strip() + return {'1': 'I', '2': 'II', '3': 'III'}.get(cat, cat or '') + def _check_object_partial_click(self): """🧩 ИИ-проверка всего объекта по частям: каждый блок — отдельный запрос, данные и ответы ИИ пишутся во временную папку (dokogen_ai_*).""" @@ -3616,13 +3623,15 @@ class DokoGenApp: 'architecture': isys.architecture, 'typical_object': isys.typical_object, 'net_category': isys.net_category, 'net_purpose': isys.net_purpose}}, {'name': 'Безопасность (нарушитель, угрозы, меры)', 'prompt': 'check_security', - 'data': {'name': isys.name, 'description': isys.description, 'category': isys.category, + 'data': {'name': isys.name, 'description': isys.description, + 'category': self._norm_category(isys.category), 'sphere': isys.sphere, 'attacker_category': isys.attacker_category, 'attacker_level': isys.attacker_level, 'attacker_types': isys.attacker_types, 'threats': isys.threats, 'incidents': isys.incidents, 'org_measures': isys.org_measures, 'tech_measures': isys.tech_measures}}, {'name': 'Категории значимости (ПП 127)', 'prompt': 'check_criteria', - 'data': {'name': isys.name, 'description': isys.description, 'category': isys.category, + 'data': {'name': isys.name, 'description': isys.description, + 'category': self._norm_category(isys.category), 'sphere': isys.sphere, 'object_type': isys.object_type, 'criteria_values': isys.criteria_values, 'criteria_justification': isys.criteria_justification}},