v0.2.3: Timestamp filenames for chat history (YYYYMMDDHHmmss)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
svemagie
2026-03-04 23:37:56 +01:00
parent 64fac6bde9
commit 20e47596d4
4 changed files with 15 additions and 6 deletions
+4 -2
View File
@@ -776,9 +776,11 @@ ${content}`;
const folder = this.plugin.settings.threadsFolder; const folder = this.plugin.settings.threadsFolder;
await this.app.vault.createFolder(folder).catch(() => { await this.app.vault.createFolder(folder).catch(() => {
}); });
const date = new Date(thread.created).toISOString().slice(0, 10); const d = new Date(thread.created);
const ts = d.getFullYear().toString() + String(d.getMonth() + 1).padStart(2, "0") + String(d.getDate()).padStart(2, "0") + String(d.getHours()).padStart(2, "0") + String(d.getMinutes()).padStart(2, "0") + String(d.getSeconds()).padStart(2, "0");
const date = d.toISOString().slice(0, 10);
const safeName = thread.title.replace(/[\\/:*?"<>|]/g, " ").slice(0, 60); const safeName = thread.title.replace(/[\\/:*?"<>|]/g, " ").slice(0, 60);
const fileName = `${folder}/${date} ${safeName}.md`; const fileName = `${folder}/${ts} ${safeName}.md`;
let content = `--- let content = `---
created: ${date} created: ${date}
id: ${thread.id} id: ${thread.id}
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"id": "memex-chat", "id": "memex-chat",
"name": "Memex Chat", "name": "Memex Chat",
"version": "0.2.2", "version": "0.2.3",
"minAppVersion": "1.4.0", "minAppVersion": "1.4.0",
"description": "Chat with your Obsidian vault using Claude AI — semantic context retrieval, @ mentions, thread history.", "description": "Chat with your Obsidian vault using Claude AI — semantic context retrieval, @ mentions, thread history.",
"author": "Sven", "author": "Sven",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "memex-chat", "name": "memex-chat",
"version": "0.2.2", "version": "0.2.3",
"description": "Obsidian plugin: Chat with your vault using Claude AI", "description": "Obsidian plugin: Chat with your vault using Claude AI",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
+9 -2
View File
@@ -904,9 +904,16 @@ export class ChatView extends ItemView {
const folder = this.plugin.settings.threadsFolder; const folder = this.plugin.settings.threadsFolder;
await this.app.vault.createFolder(folder).catch(() => {}); await this.app.vault.createFolder(folder).catch(() => {});
const date = new Date(thread.created).toISOString().slice(0, 10); const d = new Date(thread.created);
const ts = d.getFullYear().toString()
+ String(d.getMonth() + 1).padStart(2, "0")
+ String(d.getDate()).padStart(2, "0")
+ String(d.getHours()).padStart(2, "0")
+ String(d.getMinutes()).padStart(2, "0")
+ String(d.getSeconds()).padStart(2, "0");
const date = d.toISOString().slice(0, 10);
const safeName = thread.title.replace(/[\\/:*?"<>|]/g, " ").slice(0, 60); const safeName = thread.title.replace(/[\\/:*?"<>|]/g, " ").slice(0, 60);
const fileName = `${folder}/${date} ${safeName}.md`; const fileName = `${folder}/${ts} ${safeName}.md`;
let content = `---\ncreated: ${date}\nid: ${thread.id}\ntags: [chat]\n---\n\n# ${thread.title}\n\n`; let content = `---\ncreated: ${date}\nid: ${thread.id}\ntags: [chat]\n---\n\n# ${thread.title}\n\n`;
for (const msg of thread.messages) { for (const msg of thread.messages) {