from bot.models import Depth, FocusArea from bot.prompts.depth import DEPTH_CHUNK_MODIFIERS from bot.prompts.focus_areas import FOCUS_CHUNK_BULLETS _BASE = """\ You are analyzing a batch of Telegram channel posts. Extract structured insights from this chunk. Channel: {title} Chunk {chunk_idx} of {total_chunks} Posts: {chunk_text} """ def build_chunk_prompt( depth: Depth, focus_areas: list[FocusArea], lang: str, title: str, chunk_text: str, chunk_idx: int, total_chunks: int, ) -> str: base = _BASE.format( title=title, chunk_idx=chunk_idx, total_chunks=total_chunks, chunk_text=chunk_text, ) parts = [base] parts.append(f"Depth: {DEPTH_CHUNK_MODIFIERS[depth]}\n") parts.append("Focus on the following areas:") for area in focus_areas: parts.append(FOCUS_CHUNK_BULLETS[area]) parts.append(f"\nProvide the analysis in {'Russian' if lang == 'ru' else 'English'}.") return "\n".join(parts)