mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-30 15:04:16 -07:00
refactor: make baseTimestamp optional in addItem and remove redundant calls (#16471)
This commit is contained in:
@@ -17,13 +17,10 @@ async function defaultSessionView(context: CommandContext) {
|
||||
const now = new Date();
|
||||
const { sessionStartTime } = context.session.stats;
|
||||
if (!sessionStartTime) {
|
||||
context.ui.addItem(
|
||||
{
|
||||
type: MessageType.ERROR,
|
||||
text: 'Session start time is unavailable, cannot calculate stats.',
|
||||
},
|
||||
Date.now(),
|
||||
);
|
||||
context.ui.addItem({
|
||||
type: MessageType.ERROR,
|
||||
text: 'Session start time is unavailable, cannot calculate stats.',
|
||||
});
|
||||
return;
|
||||
}
|
||||
const wallDuration = now.getTime() - sessionStartTime.getTime();
|
||||
@@ -40,7 +37,7 @@ async function defaultSessionView(context: CommandContext) {
|
||||
}
|
||||
}
|
||||
|
||||
context.ui.addItem(statsItem, Date.now());
|
||||
context.ui.addItem(statsItem);
|
||||
}
|
||||
|
||||
export const statsCommand: SlashCommand = {
|
||||
@@ -68,12 +65,9 @@ export const statsCommand: SlashCommand = {
|
||||
kind: CommandKind.BUILT_IN,
|
||||
autoExecute: true,
|
||||
action: (context: CommandContext) => {
|
||||
context.ui.addItem(
|
||||
{
|
||||
type: MessageType.MODEL_STATS,
|
||||
},
|
||||
Date.now(),
|
||||
);
|
||||
context.ui.addItem({
|
||||
type: MessageType.MODEL_STATS,
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -82,12 +76,9 @@ export const statsCommand: SlashCommand = {
|
||||
kind: CommandKind.BUILT_IN,
|
||||
autoExecute: true,
|
||||
action: (context: CommandContext) => {
|
||||
context.ui.addItem(
|
||||
{
|
||||
type: MessageType.TOOL_STATS,
|
||||
},
|
||||
Date.now(),
|
||||
);
|
||||
context.ui.addItem({
|
||||
type: MessageType.TOOL_STATS,
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user