mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 15:31:27 +00:00
feat(cli): display timestamp in /chat list (#4733)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
parent
107ce8afa3
commit
b1e0fb157b
2 changed files with 32 additions and 1 deletions
|
|
@ -70,9 +70,17 @@ const listCommand: SlashCommand = {
|
|||
};
|
||||
}
|
||||
|
||||
const maxNameLength = Math.max(
|
||||
...chatDetails.map((chat) => chat.name.length),
|
||||
);
|
||||
|
||||
let message = 'List of saved conversations:\n\n';
|
||||
for (const chat of chatDetails) {
|
||||
message += ` - \u001b[36m${chat.name}\u001b[0m\n`;
|
||||
const paddedName = chat.name.padEnd(maxNameLength, ' ');
|
||||
const isoString = chat.mtime.toISOString();
|
||||
const match = isoString.match(/(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/);
|
||||
const formattedDate = match ? `${match[1]} ${match[2]}` : 'Invalid Date';
|
||||
message += ` - \u001b[36m${paddedName}\u001b[0m \u001b[90m(saved on ${formattedDate})\u001b[0m\n`;
|
||||
}
|
||||
message += `\n\u001b[90mNote: Newest last, oldest first\u001b[0m`;
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue