mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
feat: Change /stats to include more detailed breakdowns (#2615)
This commit is contained in:
@@ -296,19 +296,9 @@ describe('useSlashCommandProcessor', () => {
|
||||
describe('/stats command', () => {
|
||||
it('should show detailed session statistics', async () => {
|
||||
// Arrange
|
||||
const cumulativeStats = {
|
||||
totalTokenCount: 900,
|
||||
promptTokenCount: 200,
|
||||
candidatesTokenCount: 400,
|
||||
cachedContentTokenCount: 100,
|
||||
turnCount: 1,
|
||||
toolUsePromptTokenCount: 50,
|
||||
thoughtsTokenCount: 150,
|
||||
};
|
||||
mockUseSessionStats.mockReturnValue({
|
||||
stats: {
|
||||
sessionStartTime: new Date('2025-01-01T00:00:00.000Z'),
|
||||
cumulative: cumulativeStats,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -326,7 +316,6 @@ describe('useSlashCommandProcessor', () => {
|
||||
2, // Called after the user message
|
||||
expect.objectContaining({
|
||||
type: MessageType.STATS,
|
||||
stats: cumulativeStats,
|
||||
duration: '1h 2m 3s',
|
||||
}),
|
||||
expect.any(Number),
|
||||
@@ -334,6 +323,44 @@ describe('useSlashCommandProcessor', () => {
|
||||
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('should show model-specific statistics when using /stats model', async () => {
|
||||
// Arrange
|
||||
const { handleSlashCommand } = getProcessor();
|
||||
|
||||
// Act
|
||||
await act(async () => {
|
||||
handleSlashCommand('/stats model');
|
||||
});
|
||||
|
||||
// Assert
|
||||
expect(mockAddItem).toHaveBeenNthCalledWith(
|
||||
2, // Called after the user message
|
||||
expect.objectContaining({
|
||||
type: MessageType.MODEL_STATS,
|
||||
}),
|
||||
expect.any(Number),
|
||||
);
|
||||
});
|
||||
|
||||
it('should show tool-specific statistics when using /stats tools', async () => {
|
||||
// Arrange
|
||||
const { handleSlashCommand } = getProcessor();
|
||||
|
||||
// Act
|
||||
await act(async () => {
|
||||
handleSlashCommand('/stats tools');
|
||||
});
|
||||
|
||||
// Assert
|
||||
expect(mockAddItem).toHaveBeenNthCalledWith(
|
||||
2, // Called after the user message
|
||||
expect.objectContaining({
|
||||
type: MessageType.TOOL_STATS,
|
||||
}),
|
||||
expect.any(Number),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('/about command', () => {
|
||||
@@ -598,7 +625,6 @@ describe('useSlashCommandProcessor', () => {
|
||||
},
|
||||
{
|
||||
type: 'quit',
|
||||
stats: expect.any(Object),
|
||||
duration: '1h 2m 3s',
|
||||
id: expect.any(Number),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user