feat: Add Together AI and FFmpeg support, introduce core orchestration, and update documentation and install scripts.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# History and Stats Implementation Plan
|
||||
# History and Stats
|
||||
|
||||
This document outlines the design and implementation of the `history` and `stats` features in Toak.
|
||||
|
||||
## Data Storage
|
||||
All transcriptions will be stored in a JSON Lines (`.jsonl`) file located at `~/.local/share/toak/history.jsonl`.
|
||||
Since Toak uses Native AOT and JSON serialization needs source generation, we'll keep the model simple.
|
||||
All transcriptions are stored in a JSON Lines (`.jsonl`) file.
|
||||
- **Location**: `~/.local/share/toak/history.jsonl`
|
||||
|
||||
**Entry Model:**
|
||||
```json
|
||||
@@ -12,32 +12,29 @@ Since Toak uses Native AOT and JSON serialization needs source generation, we'll
|
||||
"Timestamp": "2025-01-15T09:23:00Z",
|
||||
"RawTranscript": "hello world",
|
||||
"RefinedText": "Hello world.",
|
||||
"SkillName": "Professional", // null if default type/script
|
||||
"DurationMs": 1500 // time taken for STT + LLM
|
||||
"SkillName": "Professional", // null if default
|
||||
"DurationMs": 1500 // total processing time
|
||||
}
|
||||
```
|
||||
|
||||
## `toak history` Command
|
||||
Provides access to past dictations.
|
||||
|
||||
- `toak history` - Shows the last 10 entries.
|
||||
- `toak history -n <count>` - Shows the last `<count>` entries.
|
||||
- `toak history --grep <pattern>` - Filters the history entries matching the given keyword in the RefinedText (case-insensitive).
|
||||
- `toak history --export <file>` - Writes the output as a Markdown file.
|
||||
- `toak history --shred` - Deletes the `history.jsonl` file entirely.
|
||||
The CLI provides access to past dictations:
|
||||
- `toak history`: Shows the last 10 entries.
|
||||
- `-n <count>`: Shows the last `<count>` entries.
|
||||
- `--grep <pattern>`: Case-insensitive search through refined text.
|
||||
- `--export <file>`: Export history as a Markdown file.
|
||||
- `--shred`: Securely delete the entire `history.jsonl` file.
|
||||
|
||||
## `toak stats` Command
|
||||
Reads the `history.jsonl` file and outputs usage analytics using `Spectre.Console`.
|
||||
Aggregates usage metrics from the history file:
|
||||
- **Total recordings**: Count of all entries.
|
||||
- **Total duration**: Cumulative time spent transcribing (in minutes).
|
||||
- **Average latency**: Mean processing time per request (in seconds).
|
||||
- **Most active day**: Date with the highest number of recordings.
|
||||
- **Top spoken words**: The 5 most frequent words (>3 characters).
|
||||
|
||||
**Metrics:**
|
||||
- Total recording count
|
||||
- Total processing duration (sum of `DurationMs`)
|
||||
- Average processing duration
|
||||
- Most active day
|
||||
- Most frequently used skill (if any)
|
||||
|
||||
## Architecture Changes
|
||||
1. **`HistoryManager.cs`**: Handles thread-safe appending `HistoryEntry` to the `.jsonl` file, reading, and clearing.
|
||||
2. **`DaemonService.cs`**: Calls `HistoryManager.SaveEntry` during the `ProcessStopRecordingAsync` method after text is finalized.
|
||||
3. **`HistoryCommand.cs` & `StatsCommand.cs`**: CLI command definitions.
|
||||
4. **`AppJsonSerializerContext.cs`**: Needs `[JsonSerializable(typeof(HistoryEntry))]`.
|
||||
## Architecture
|
||||
1. **`HistoryManager.cs`**: Handles thread-safe appending and reading of the `.jsonl` file.
|
||||
2. **`TranscriptionOrchestrator.cs`**: Calls `HistoryManager.SaveEntry` after text is finalized.
|
||||
3. **`HistoryCommand.cs` & `StatsCommand.cs`**: CLI command implementations.
|
||||
4. **`AppJsonSerializerContext.cs`**: Provides AOT-compatible serialization for `HistoryEntry`.
|
||||
|
||||
Reference in New Issue
Block a user