v0.2.3: Timestamp filenames for chat history (YYYYMMDDHHmmss)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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
@@ -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
@@ -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
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user