expand_service.py 730 B

12345678910111213141516171819202122
  1. """标书扩写服务。"""
  2. from typing import Any, Dict
  3. from ..models.schemas import OutlineResponse
  4. from ..utils.openai_util import OpenAIUtil
  5. from ..utils.prompts.expand_prompts import build_expand_outline_messages
  6. class ExpandService:
  7. """负责从已有技术方案中提取旧目录。"""
  8. def __init__(self, ai: OpenAIUtil | None = None):
  9. self.ai = ai or OpenAIUtil()
  10. async def generate_expand_outline(self, file_content: str) -> Dict[str, Any]:
  11. """从已有技术方案中提取目录结构。"""
  12. return await self.ai.collect_json_response(
  13. messages=build_expand_outline_messages(file_content),
  14. temperature=0.7,
  15. schema=OutlineResponse,
  16. )