conversation_context.py 606 B

123456789101112131415161718
  1. # -*- coding: utf-8 -*-
  2. """Conversation context helpers.
  3. Document state is owned by the frontend/business backend. This helper only
  4. normalizes request context for model prompts.
  5. """
  6. from typing import Any, Dict
  7. class ConversationContextBuilder:
  8. def build(self, state: Dict[str, Any]) -> Dict[str, Any]:
  9. return {
  10. "project_info": state.get("project_info", {}),
  11. "selected_section": state.get("selected_section", {}),
  12. "document_context": state.get("document_context", {}),
  13. "conversation_history": state.get("conversation_history", []),
  14. }