mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Add an account analytics dashboard to /usage (#45764)
## What changed - Add “Explore analytics” to the `/usage` menu for ChatGPT accounts, opening a full-screen dashboard. - Show usage and messages for consumer accounts, credits and token usage for Business and Enterprise accounts, and plugin and skill activity for both. - Support overview and maximized views, 7- and 30-day ranges, report grouping, daily details, model filtering for token usage, and refresh. - Keep report loading and errors independent, cancel pending loads on close, and retain navigation state across reopening while preserving the composer draft. ## Testing Add regression and snapshot coverage for account-specific reports, range and grouping changes, model filtering, loading and cancellation, small terminals, terminal colors, and draft preservation. GitOrigin-RevId: 46da94a14d6e227551e740b85f9d2d552aaf75b0
This commit is contained in:
1 parent
af3bc6f796
commit
ca53e19c75
68 files changed
+6357
-67
No files matched your search
@@ -1,6 +1,7 @@
|
||||
//! Regression coverage for transcript viewer input, prompt selection, and restoration.
|
||||
//!
|
||||
//! The default-off feature must leave the existing viewer and its draft intact.
|
||||
//! Analytics also preserves the composer and stays separate from transcript backtracking.
|
||||
|
||||
use super::*;
|
||||
use crate::test_support::test_path_display;
|
||||
@@ -39,6 +40,40 @@ async fn press_key(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn analytics_preserves_the_draft_and_retains_the_view_on_reopen() -> Result<()> {
|
||||
let (mut app, _app_event_rx, _op_rx) = make_test_app_with_channels().await;
|
||||
let mut app_server = start_config_write_test_app_server(&app).await?;
|
||||
let mut tui = crate::tui::test_support::make_test_tui()?;
|
||||
app.chat_widget
|
||||
.apply_external_edit("preserved draft".into());
|
||||
app.handle_event(&mut tui, &mut app_server, AppEvent::OpenAnalytics)
|
||||
.await?;
|
||||
for code in [
|
||||
KeyCode::Char('4'),
|
||||
KeyCode::Enter,
|
||||
KeyCode::Down,
|
||||
KeyCode::Char('r'),
|
||||
] {
|
||||
press_key(&mut app, &mut tui, &mut app_server, code).await?;
|
||||
assert!(matches!(app.overlay, Some(Overlay::Analytics(_))));
|
||||
assert!(!app.backtrack.overlay_preview_active);
|
||||
}
|
||||
press_key(&mut app, &mut tui, &mut app_server, KeyCode::Char('q')).await?;
|
||||
assert!(app.overlay.is_none());
|
||||
assert!(app.retained_analytics.is_some());
|
||||
app.handle_event(&mut tui, &mut app_server, AppEvent::OpenAnalytics)
|
||||
.await?;
|
||||
assert!(matches!(app.overlay, Some(Overlay::Analytics(_))));
|
||||
assert!(app.retained_analytics.is_none());
|
||||
press_key(&mut app, &mut tui, &mut app_server, KeyCode::Char('q')).await?;
|
||||
assert_eq!(
|
||||
app.chat_widget.composer_text_with_pending(),
|
||||
"preserved draft"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn transcript_flag_off_preserves_viewer_and_backtracking() -> Result<()> {
|
||||
let (mut app, mut app_event_rx, _op_rx) = make_test_app_with_channels().await;
|
||||
|
||||
Reference in new issue
Block a user