diff --git a/src/plugins/Nostradamus/Nostradamus.ts b/src/plugins/Nostradamus/Nostradamus.ts index 4979c58..e42449b 100644 --- a/src/plugins/Nostradamus/Nostradamus.ts +++ b/src/plugins/Nostradamus/Nostradamus.ts @@ -25,11 +25,8 @@ export default class NostradamusPlugin extends ArcanaPluginBase { const file = view.file; // Get the better name let betterName = await this.getBetterName(file); - // If the betterName does not include .md then add it - if (!betterName.endsWith('.md')) { - betterName += '.md'; - } - // Get the parent folder of the file + betterName = this.normalizeTitle(betterName); + const parentFolder = file.parent; const parentName = normalizePath(parentFolder?.path ?? ''); // Join the parent folder and the better name @@ -62,4 +59,14 @@ export default class NostradamusPlugin extends ArcanaPluginBase { return await this.arcana.complete(question, context); } + + private normalizeTitle(title: string): string { + // Remove the extension + title = title.replace('.md', ''); + // Remove slashes and colons + title = title.replace(/[:/\\]/g, ''); + // Add extension back + title += '.md'; + return title; + } } diff --git a/src/plugins/Socrates/AgentState.ts b/src/plugins/Socrates/AgentState.ts index 68d089a..9931942 100644 --- a/src/plugins/Socrates/AgentState.ts +++ b/src/plugins/Socrates/AgentState.ts @@ -84,9 +84,9 @@ function isSerializable(x: any) { } function ChatAgentReducer(state = initialState, action: ChatAgentAction) { - console.log('ChatAgentReducer', action, state); - console.log('isSerializable action', isSerializable(action)); - console.log('isSerializable state', isSerializable(state)); + //console.log('ChatAgentReducer', action, state); + //console.log('isSerializable action', isSerializable(action)); + //console.log('isSerializable state', isSerializable(state)); switch (action.type) { case 'agent/add': { const agent: AgentData = action.agent; diff --git a/src/plugins/Socrates/SocratesView.tsx b/src/plugins/Socrates/SocratesView.tsx index c93e3ec..a92be44 100644 --- a/src/plugins/Socrates/SocratesView.tsx +++ b/src/plugins/Socrates/SocratesView.tsx @@ -179,7 +179,6 @@ export const SocratesView = ( }; React.useEffect(() => { - console.log('Registering events'); addSocrates(); addAllAgentsInFolder(); @@ -191,7 +190,6 @@ export const SocratesView = ( arcana.registerInterval(interval); return () => { - console.log('Unregistering events'); arcana.app.vault.off('create', createAgent); arcana.app.vault.off('modify', onModify); arcana.app.vault.off('delete', onDelete);