diff --git a/src/datacenter_docs/chat/main.py b/src/datacenter_docs/chat/main.py index 81f8c1b..1eea08d 100644 --- a/src/datacenter_docs/chat/main.py +++ b/src/datacenter_docs/chat/main.py @@ -78,6 +78,8 @@ async def initialize_agent() -> None: agent = None # Create Socket.IO server +# Using async_mode="asgi" for FastAPI integration +# python-socketio 5.x automatically supports Engine.IO v4 for socket.io-client 4.x compatibility sio = socketio.AsyncServer( async_mode="asgi", cors_allowed_origins="*", diff --git a/src/datacenter_docs/generators/base.py b/src/datacenter_docs/generators/base.py index 77e37af..7448cf5 100644 --- a/src/datacenter_docs/generators/base.py +++ b/src/datacenter_docs/generators/base.py @@ -193,26 +193,24 @@ class BaseGenerator(ABC): # Check if section already exists existing = await DocumentationSection.find_one( - DocumentationSection.section_name == self.section + DocumentationSection.section_id == self.section ) if existing: - # Update existing section - existing.content = content + # Update existing section metadata + existing.last_generated = datetime.now() + existing.generation_status = "completed" existing.updated_at = datetime.now() - if metadata: - existing.metadata = metadata await existing.save() self.logger.info(f"Updated existing section: {self.section}") else: - # Create new section + # Create new section with metadata doc_section = DocumentationSection( - section_name=self.section, - title=self.section.replace("_", " ").title(), - content=content, - category=self.name, - tags=[self.name, self.section], - metadata=metadata or {}, + section_id=self.section, + name=self.section.replace("_", " ").title(), + description=f"Auto-generated documentation for {self.name}", + last_generated=datetime.now(), + generation_status="completed", ) await doc_section.insert() self.logger.info(f"Created new section: {self.section}")