TitleGenerator
Category: Agent
Source: title_generator.dart
Classes
TitleGenerator
Generates short session titles using an [LlmClient].
Constructor
dart
TitleGenerator({required LlmClient llmClient, this.onUsage})Properties
| Property | Type | Description |
|---|---|---|
systemPrompt | const |
Methods
void Function(UsageInfo)
Optional per-call usage callback. Surfaces wire this to SessionManager.recordUsage(stats, role: 'title') so small-model title-generation cost is accounted for in session totals.
Future<String?> generate(String userMessage)
Generate a title from the first user message.
Returns null if title generation fails for any reason.
Future<String?> generateFromContext(TitleContext context)
static String? sanitize(String? raw)
Sanitize a title to printable ASCII, collapsing whitespace.
Returns null if the result is empty after sanitization.