This commit is contained in:
Sergei Poljanski 2026-02-22 21:33:23 +02:00
commit ec1112e162
Signed by: asxpi
GPG key ID: 4F8851660FA4121B
22 changed files with 837 additions and 0 deletions

View file

@ -0,0 +1,70 @@
from bot.models import ReportType
_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}
"""
_CONTENT = """\
Focus on:
- Main topics and themes discussed
- Tone and communication style
- Content formats (long-form, short updates, lists, etc.)
- Key narratives or recurring ideas
- Notable quotes or standout posts
Provide a concise structured summary."""
_CONTENT_STATS = """\
Focus on:
- Main topics and themes discussed
- Tone and communication style
- Content formats used
- Key narratives or recurring ideas
- Posting frequency patterns in this batch
- Engagement patterns (which topics get more views/forwards/replies)
- Any notable spikes or drops in engagement
Provide a concise structured summary with both qualitative and quantitative observations."""
_FULL_AUDIT = """\
Focus on:
- Main topics and themes discussed
- Tone and communication style
- Content formats used
- Key narratives or recurring ideas
- Posting frequency patterns
- Engagement patterns with specific numbers
- Sentiment analysis (positive/negative/neutral distribution)
- Audience interaction patterns
- Content strengths and weaknesses
- Missed opportunities
Provide a detailed structured summary covering all dimensions."""
CHUNK_PROMPTS = {
ReportType.CONTENT: _CONTENT,
ReportType.CONTENT_STATS: _CONTENT_STATS,
ReportType.FULL_AUDIT: _FULL_AUDIT,
}
def build_chunk_prompt(
report_type: ReportType,
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,
)
return base + "\n" + CHUNK_PROMPTS[report_type]