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:
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'config.dart';
|
||||
import 'lexicon.dart';
|
||||
|
||||
enum ClaudeOutcome { success, busy, timeout, failure }
|
||||
|
||||
@@ -73,16 +74,11 @@ class ClaudeRunner {
|
||||
}
|
||||
|
||||
String _buildPrompt({required int chatId, String? topic}) {
|
||||
final base = topic == null || topic.isEmpty
|
||||
? config.newsPrompt
|
||||
: 'Проведи ресёрч последних новостей и трендов по теме "$topic" за последние '
|
||||
'7 дней. Используй поиск в интернете. Составь краткую выжимку: 5-8 пунктов, '
|
||||
'у каждого — суть в 1-2 предложениях и ссылка на источник.';
|
||||
|
||||
return '$base\n\n'
|
||||
'Когда выжимка готова, ОБЯЗАТЕЛЬНО вызови инструмент send_to_telegram с '
|
||||
'параметрами chat_id=$chatId и text=<готовый текст в Markdown, с заголовком>. '
|
||||
'Это единственный способ доставить материал — не выводи финальный ответ никак '
|
||||
'иначе, только через вызов этого инструмента.';
|
||||
final effectiveTopic = (topic == null || topic.isEmpty) ? config.defaultTopic : topic;
|
||||
return [
|
||||
Lexicon.researchInstruction(effectiveTopic),
|
||||
Lexicon.progressInstruction(chatId),
|
||||
Lexicon.finalDeliveryInstruction(chatId),
|
||||
].join('\n\n');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user