fix: нормализация категории 1/2/3→I/II/III перед ИИ-проверкой (устраняет ложное противоречие с обоснованием); разбивка предложений ИИ по запятым/строкам при применении

This commit is contained in:
2026-08-05 01:36:26 +04:00
parent 638e2446d5
commit 88ab71dc14
+15 -6
View File
@@ -3006,7 +3006,7 @@ class DokoGenApp:
security_data = { security_data = {
'name': isys.name or '', 'name': isys.name or '',
'description': isys.description or '', 'description': isys.description or '',
'category': isys.category or '', 'category': self._norm_category(isys.category) or '',
'sphere': isys.sphere or '', 'sphere': isys.sphere or '',
'object_type': isys.object_type or '', 'object_type': isys.object_type or '',
'architecture': isys.architecture or '', 'architecture': isys.architecture or '',
@@ -3134,8 +3134,9 @@ class DokoGenApp:
if not lb: if not lb:
return return
lb.delete(0, tk.END) lb.delete(0, tk.END)
for line in (text or '').split('\n'): import re as _re3
line = line.strip() for line in _re3.split(r'[\n,;]+', text or ''):
line = line.strip().lstrip('•-–— ')
if line: if line:
lb.insert(tk.END, line) lb.insert(tk.END, line)
@@ -3533,7 +3534,7 @@ class DokoGenApp:
data = { data = {
'name': isys.name or '', 'name': isys.name or '',
'description': isys.description or '', 'description': isys.description or '',
'category': isys.category or '', 'category': self._norm_category(isys.category) or '',
'sphere': isys.sphere or '', 'sphere': isys.sphere or '',
'object_type': isys.object_type or '', 'object_type': isys.object_type or '',
'criteria_values': isys.criteria_values or '', 'criteria_values': isys.criteria_values or '',
@@ -3590,6 +3591,12 @@ class DokoGenApp:
self._verify_log("🤖 Проверка категорий ИИ завершена") self._verify_log("🤖 Проверка категорий ИИ завершена")
self.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): def _check_object_partial_click(self):
"""🧩 ИИ-проверка всего объекта по частям: каждый блок — отдельный запрос, """🧩 ИИ-проверка всего объекта по частям: каждый блок — отдельный запрос,
данные и ответы ИИ пишутся во временную папку (dokogen_ai_*).""" данные и ответы ИИ пишутся во временную папку (dokogen_ai_*)."""
@@ -3616,13 +3623,15 @@ class DokoGenApp:
'architecture': isys.architecture, 'typical_object': isys.typical_object, 'architecture': isys.architecture, 'typical_object': isys.typical_object,
'net_category': isys.net_category, 'net_purpose': isys.net_purpose}}, 'net_category': isys.net_category, 'net_purpose': isys.net_purpose}},
{'name': 'Безопасность (нарушитель, угрозы, меры)', 'prompt': 'check_security', {'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, 'sphere': isys.sphere, 'attacker_category': isys.attacker_category,
'attacker_level': isys.attacker_level, 'attacker_types': isys.attacker_types, 'attacker_level': isys.attacker_level, 'attacker_types': isys.attacker_types,
'threats': isys.threats, 'incidents': isys.incidents, 'threats': isys.threats, 'incidents': isys.incidents,
'org_measures': isys.org_measures, 'tech_measures': isys.tech_measures}}, 'org_measures': isys.org_measures, 'tech_measures': isys.tech_measures}},
{'name': 'Категории значимости (ПП 127)', 'prompt': 'check_criteria', {'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, 'sphere': isys.sphere, 'object_type': isys.object_type,
'criteria_values': isys.criteria_values, 'criteria_values': isys.criteria_values,
'criteria_justification': isys.criteria_justification}}, 'criteria_justification': isys.criteria_justification}},