Fix HOME volume mount, genericize topic, add progress statuses, extract lexicon

- Volume was mounted at ~/.claude only, but claude-code writes auth to
  ~/.claude.json too — that file lived on the ephemeral container layer and
  was lost on every recreate. Now the whole $HOME is on the named volume,
  and claude-config moved outside HOME (/app) so it isn't shadowed by it.
- Default /news topic was hardcoded to AI; now it's a configurable
  DEFAULT_TOPIC (plain "главные новости дня"), topic is fully free-form.
- Prompt now instructs Claude to send interim " ..." progress updates via
  send_to_telegram while researching, not just the final digest — a bare
  request like "call this tool" was already taking 3+ minutes end-to-end,
  so silence read as broken.
- All user-facing/prompt text moved into bot/lib/lexicon.dart.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-21 21:53:38 +03:00
parent cb2041fc56
commit 7bfe0dfe0c
8 changed files with 93 additions and 52 deletions

View File

@@ -1,16 +1,17 @@
import 'dart:io';
import 'lexicon.dart';
class Config {
final String telegramToken;
final Set<int> allowedChatIds;
final String newsPrompt;
final String defaultTopic;
final int claudeTimeoutSeconds;
final String mcpConfigPath;
Config({
required this.telegramToken,
required this.allowedChatIds,
required this.newsPrompt,
required this.defaultTopic,
required this.claudeTimeoutSeconds,
required this.mcpConfigPath,
});
@@ -27,14 +28,10 @@ class Config {
return Config(
telegramToken: e['TELEGRAM_BOT_TOKEN'] ?? '',
allowedChatIds: allowed,
newsPrompt: e['NEWS_PROMPT'] ??
'Проведи ресёрч последних новостей и трендов в области искусственного '
'интеллекта за последние 7 дней. Используй поиск в интернете. '
'Составь краткую выжимку: 5-8 пунктов, у каждого — суть в 1-2 '
'предложениях и ссылка на источник.',
defaultTopic: e['DEFAULT_TOPIC'] ?? Lexicon.defaultTopic,
claudeTimeoutSeconds:
int.tryParse(e['CLAUDE_TIMEOUT_SECONDS'] ?? '360') ?? 360,
mcpConfigPath: e['MCP_CONFIG_PATH'] ?? '/home/agent/claude-config/mcp.json',
int.tryParse(e['CLAUDE_TIMEOUT_SECONDS'] ?? '600') ?? 600,
mcpConfigPath: e['MCP_CONFIG_PATH'] ?? '/app/claude-config/mcp.json',
);
}
}