From 640b7fc47c8c0166a78b7c5584cd6983c3292970 Mon Sep 17 00:00:00 2001 From: TQuynh109 Date: Mon, 1 Jun 2026 04:07:18 +0000 Subject: [PATCH] fix simulation context and add model name to ouput --- backend/app/api/simulation.py | 4 ++-- backend/app/models/project.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/app/api/simulation.py b/backend/app/api/simulation.py index 71960cf7..8c9697e6 100644 --- a/backend/app/api/simulation.py +++ b/backend/app/api/simulation.py @@ -309,7 +309,7 @@ def _check_simulation_prepared(simulation_id: str) -> tuple: # - completed: đã chạy xong, nghĩa là đã chuẩn bị xong từ trước # - stopped: đã dừng, nghĩa là đã chuẩn bị xong từ trước # - failed: chạy thất bại (nhưng phần chuẩn bị đã hoàn tất) - prepared_statuses = ["ready", "preparing", "running", "completed", "stopped", "failed"] + prepared_statuses = ["ready", "preparing", "running", "completed", "stopped", "failed", "paused"] if status in prepared_statuses and config_generated: # Lấy thông tin thống kê file @@ -468,7 +468,7 @@ def prepare_simulation(): entity_types_list = data.get('entity_types') use_llm_for_profiles = data.get('use_llm_for_profiles', True) - parallel_profile_count = data.get('parallel_profile_count', 5) + parallel_profile_count = data.get('parallel_profile_count', 20) # ========== Đồng bộ lấy số lượng thực thể (trước khi chạy tác vụ nền) ========== # Nhờ đó frontend có thể lấy ngay tổng số Agent dự kiến sau khi gọi prepare diff --git a/backend/app/models/project.py b/backend/app/models/project.py index f49a9427..c59afd43 100644 --- a/backend/app/models/project.py +++ b/backend/app/models/project.py @@ -49,6 +49,7 @@ class Project: simulation_requirement: Optional[str] = None chunk_size: int = 500 chunk_overlap: int = 50 + llm_model_name: Optional[str] = None # Thông tin lỗi error: Optional[str] = None @@ -63,6 +64,7 @@ class Project: "updated_at": self.updated_at, "files": self.files, "total_text_length": self.total_text_length, + "llm_model_name": self.llm_model_name, "ontology": self.ontology, "analysis_summary": self.analysis_summary, "graph_id": self.graph_id, @@ -88,6 +90,7 @@ class Project: updated_at=data.get('updated_at', ''), files=data.get('files', []), total_text_length=data.get('total_text_length', 0), + llm_model_name=data.get('llm_model_name'), ontology=data.get('ontology'), analysis_summary=data.get('analysis_summary'), graph_id=data.get('graph_id'), @@ -151,7 +154,8 @@ class ProjectManager: name=name, status=ProjectStatus.CREATED, created_at=now, - updated_at=now + updated_at=now, + llm_model_name=Config.LLM_MODEL_NAME ) # Thiết lập các thư mục con trong không gian thư mục của project