Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/A-F-V/obsidian-arcana
Browse files Browse the repository at this point in the history
  • Loading branch information
A-F-V committed Jun 30, 2023
2 parents 2a6d5b0 + a307025 commit a180e25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
17 changes: 12 additions & 5 deletions src/plugins/Nostradamus/Nostradamus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}
6 changes: 3 additions & 3 deletions src/plugins/Socrates/AgentState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/Socrates/SocratesView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ export const SocratesView = (
};

React.useEffect(() => {
console.log('Registering events');
addSocrates();
addAllAgentsInFolder();

Expand All @@ -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);
Expand Down

0 comments on commit a180e25

Please sign in to comment.