| 658 | } |
| 659 | |
| 660 | fn loaded_entry(fixture: LoadedEntryFixture) -> LoadedEntry { |
| 661 | let usage = TokenUsageRaw { |
| 662 | input_tokens: fixture.input_tokens, |
| 663 | output_tokens: fixture.output_tokens, |
| 664 | cache_creation_input_tokens: fixture.cache_creation_tokens, |
| 665 | cache_read_input_tokens: fixture.cache_read_tokens, |
| 666 | speed: None, |
| 667 | cache_creation: None, |
| 668 | }; |
| 669 | let timestamp = TimestampMs::from_millis(fixture.timestamp); |
| 670 | LoadedEntry { |
| 671 | data: UsageEntry { |
| 672 | session_id: Some(fixture.session_id.to_string()), |
| 673 | timestamp: format_rfc3339_millis(timestamp), |
| 674 | version: fixture.version.map(str::to_string), |
| 675 | message: UsageMessage { |
| 676 | usage, |
| 677 | model: fixture.model.map(str::to_string), |
| 678 | id: Some(format!("msg-{}", fixture.timestamp)), |
| 679 | }, |
| 680 | cost_usd: None, |
| 681 | request_id: None, |
| 682 | is_api_error_message: None, |
| 683 | is_sidechain: None, |
| 684 | }, |
| 685 | timestamp, |
| 686 | date: fixture.date.to_string(), |
| 687 | project: Arc::from(fixture.project_path), |
| 688 | session_id: Arc::from(fixture.session_id), |
| 689 | project_path: Arc::from(fixture.project_path), |
| 690 | cost: fixture.cost, |
| 691 | extra_total_tokens: fixture.extra_total_tokens, |
| 692 | credits: fixture.credits, |
| 693 | message_count: fixture.message_count, |
| 694 | model: fixture.model.map(str::to_string), |
| 695 | usage_limit_reset_time: None, |
| 696 | missing_pricing_model: fixture.missing_pricing_model.map(str::to_string), |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | struct SummaryFixture { |
| 701 | date: Option<&'static str>, |