conversation_context.py 587 B

1234567891011121314151617
  1. # -*- coding: utf-8 -*-
  2. """对话上下文处理。
  3. 文档状态由前端/业务后端管理,此组件仅规范化请求上下文供模型提示词使用。
  4. """
  5. from typing import Any, Dict
  6. class ConversationContextBuilder:
  7. def build(self, state: Dict[str, Any]) -> Dict[str, Any]:
  8. return {
  9. "project_info": state.get("project_info", {}),
  10. "selected_section": state.get("selected_section", {}),
  11. "document_context": state.get("document_context", {}),
  12. "conversation_history": state.get("conversation_history", []),
  13. }