Files
AX-Copilot-Codex/src/AxCopilot/Models/CodeStatsSummary.cs
lacvet d5dbaa6e4a 코드탭 통계 대시보드 병합 및 빈화면 동기화 보강
외부 작업 로그 기준으로 코드탭 병합 누락분을 검토하고 기존 컨텍스트 영속화 경로는 유지한 채 Code 사용량 대시보드만 선택적으로 병합했습니다.

CodeStatsSummary, CodeStatsAggregator, ChatWindow.CodeStatsPresentation, CodeStatsAggregatorTests를 추가해 세션·메시지·토큰·연속일·모델 사용량 통계를 집계하고 EmptyState에서 개요/모델 히스토리 대시보드를 렌더링하도록 구현했습니다.

ChatWindow.xaml, TranscriptRendering, TopicPresetPresentation, ConversationManagementPresentation, OverlaySettingsPresentation, xaml.cs에 UpdateCodeStatsVisibility 연결을 추가해 탭 전환, 첫 메시지 전송, 프리셋 선택, 대화 삭제 시 빈화면과 대시보드가 일관되게 전환되도록 수정했습니다.

README.md와 docs/DEVELOPMENT.md에 2026-04-16 08:10 (KST) 기준 병합 이력과 검증 결과를 반영했습니다.

검증: verify_code_stats_merge 빌드 경고 0 / 오류 0, verify_code_stats_merge_tests 대상 테스트 56개 통과
2026-04-16 08:12:20 +09:00

64 lines
2.3 KiB
C#

namespace AxCopilot.Models;
/// <summary>
/// Period filter for the Code tab usage dashboard.
/// Mirrors the "All / 30d / 7d" controls shown in the reference stats view.
/// </summary>
public enum CodeStatsPeriod
{
/// <summary>Aggregate over every record on disk.</summary>
All = 0,
/// <summary>Aggregate over the last 30 days.</summary>
Last30Days = 30,
/// <summary>Aggregate over the last 7 days.</summary>
Last7Days = 7,
}
/// <summary>
/// One day in the activity heatmap.
/// IntensityLevel is 0..4 where 0 means "no activity".
/// </summary>
public sealed record CodeStatsHeatmapCell(DateTime Date, long Tokens, int IntensityLevel);
/// <summary>One model bucket within a single day of the model chart.</summary>
public sealed record CodeStatsModelDailyTokens(string Model, long Tokens);
/// <summary>One day in the stacked model chart.</summary>
public sealed record CodeStatsDailyModelStack(DateTime Date, IReadOnlyList<CodeStatsModelDailyTokens> Models);
/// <summary>
/// Per-model aggregate row shown beneath the model stacked bar chart.
/// SharePercent is 0..100.
/// </summary>
public sealed record CodeStatsModelTotal(
string Model,
long InTokens,
long OutTokens,
double SharePercent);
/// <summary>
/// Summary model used by the Code tab usage dashboard.
/// </summary>
public sealed record CodeStatsSummary
{
public int SessionsCount { get; init; }
public int MessagesCount { get; init; }
public long TotalTokens { get; init; }
public int ActiveDays { get; init; }
public int CurrentStreak { get; init; }
public int LongestStreak { get; init; }
public int? MostActiveHour { get; init; }
public string? FavoriteModel { get; init; }
public IReadOnlyList<CodeStatsHeatmapCell> Heatmap { get; init; } = Array.Empty<CodeStatsHeatmapCell>();
public IReadOnlyList<CodeStatsDailyModelStack> ModelStack { get; init; } = Array.Empty<CodeStatsDailyModelStack>();
public IReadOnlyList<CodeStatsModelTotal> ModelTotals { get; init; } = Array.Empty<CodeStatsModelTotal>();
public CodeStatsPeriod Period { get; init; }
public DateTime ComputedAtUtc { get; init; }
public static CodeStatsSummary Empty(CodeStatsPeriod period) => new()
{
Period = period,
ComputedAtUtc = DateTime.UtcNow,
};
}