Replace single report type with composable analysis: depth levels (basic/standard/full) + focus area multi-select (psychology, business, marketing, content, audience, sentiment). Multi-step inline keyboard flow guides users through selection. - i18n: English + Russian, auto-detect from Telegram, /lang override - AI providers: Anthropic + OpenRouter via AIClient abstraction - Telegram Stars payments with per-depth pricing and free trial - SQLite (aiosqlite) for users, analyses, payments tracking - User middleware for auto-registration and language detection - Report persistence: save .md locally, offer file download - New commands: /features, /prices, /lang - Composable prompt system: depth modifiers + focus area fragments
41 lines
999 B
Python
41 lines
999 B
Python
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)
|