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:
@@ -110,14 +110,19 @@ export const useSlashCommandProcessor = (
|
||||
} else if (message.type === MessageType.STATS) {
|
||||
historyItemContent = {
|
||||
type: 'stats',
|
||||
stats: message.stats,
|
||||
lastTurnStats: message.lastTurnStats,
|
||||
duration: message.duration,
|
||||
};
|
||||
} else if (message.type === MessageType.MODEL_STATS) {
|
||||
historyItemContent = {
|
||||
type: 'model_stats',
|
||||
};
|
||||
} else if (message.type === MessageType.TOOL_STATS) {
|
||||
historyItemContent = {
|
||||
type: 'tool_stats',
|
||||
};
|
||||
} else if (message.type === MessageType.QUIT) {
|
||||
historyItemContent = {
|
||||
type: 'quit',
|
||||
stats: message.stats,
|
||||
duration: message.duration,
|
||||
};
|
||||
} else if (message.type === MessageType.COMPRESSION) {
|
||||
@@ -262,16 +267,28 @@ export const useSlashCommandProcessor = (
|
||||
{
|
||||
name: 'stats',
|
||||
altName: 'usage',
|
||||
description: 'check session stats',
|
||||
action: (_mainCommand, _subCommand, _args) => {
|
||||
description: 'check session stats. Usage: /stats [model|tools]',
|
||||
action: (_mainCommand, subCommand, _args) => {
|
||||
if (subCommand === 'model') {
|
||||
addMessage({
|
||||
type: MessageType.MODEL_STATS,
|
||||
timestamp: new Date(),
|
||||
});
|
||||
return;
|
||||
} else if (subCommand === 'tools') {
|
||||
addMessage({
|
||||
type: MessageType.TOOL_STATS,
|
||||
timestamp: new Date(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
const { sessionStartTime, cumulative, currentTurn } = session.stats;
|
||||
const { sessionStartTime } = session.stats;
|
||||
const wallDuration = now.getTime() - sessionStartTime.getTime();
|
||||
|
||||
addMessage({
|
||||
type: MessageType.STATS,
|
||||
stats: cumulative,
|
||||
lastTurnStats: currentTurn,
|
||||
duration: formatDuration(wallDuration),
|
||||
timestamp: new Date(),
|
||||
});
|
||||
@@ -805,7 +822,7 @@ export const useSlashCommandProcessor = (
|
||||
description: 'exit the cli',
|
||||
action: async (mainCommand, _subCommand, _args) => {
|
||||
const now = new Date();
|
||||
const { sessionStartTime, cumulative } = session.stats;
|
||||
const { sessionStartTime } = session.stats;
|
||||
const wallDuration = now.getTime() - sessionStartTime.getTime();
|
||||
|
||||
setQuittingMessages([
|
||||
@@ -816,7 +833,6 @@ export const useSlashCommandProcessor = (
|
||||
},
|
||||
{
|
||||
type: 'quit',
|
||||
stats: cumulative,
|
||||
duration: formatDuration(wallDuration),
|
||||
id: now.getTime(),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user