Compare commits

...

6 commits
main ... 1.1.3

Author SHA1 Message Date
Evan's Oasis
f66c80de83
Update README.md 2024-07-08 14:19:54 -04:00
Evan's Oasis
523376c46b
Update README.md 2024-07-08 14:19:00 -04:00
Mossy1022
6455c243dd Added command for smart memo 2024-07-08 14:16:56 -04:00
Mossy1022
eb2a195ad6 Updated to catch error for normailized path and simply do root path 2024-07-08 12:46:22 -04:00
Mossy1022
b6800d50ea Merge branch 'main' of https://github.com/Mossy1022/Smart-Memos 2024-07-08 12:41:05 -04:00
Evan's Oasis
84d2d32077
Update README.md 2024-07-08 11:09:58 -04:00
6 changed files with 27 additions and 7 deletions

View file

@ -28,8 +28,8 @@ Note* This plugin currently uses online openAI models to recieve and transcribe
## Usage
Once installed, the Smart Memos Plugin provides an intuitive interface to transcribe your audio files and generate notes.
- **Adding Audio**: To speak your memo directly into Obsidian, tap the microphone icon to open the smart memos popup that'll automatically start recording. To import audio into a note, simply drag and drop the file into it.
- **Transcribing Audio**: To transcribe an audio file after it's been imported into a note, move your cursor right underneath the audio file and use the command `Smart transcribe` from the command palette (`Ctrl + p` for Windows and `Cmd + p` for Mac). The plugin will transcribe the audio file and generate detailed notes. If you're speaking directly to Obsidian, you can select the "Smart Transcribe" button to transcribe what you've recorded.
- **Adding Audio**: Ensure you have a note opened. To speak your memo directly into Obsidian, tap the microphone icon or use the command `Record smart memo` from the command pallet (`Ctrl + p` for Windows and `Cmd + p` for Mac) to open the smart memos popup that'll automatically start recording. To import audio into a note, simply drag and drop the file into it.
- **Transcribing Audio**: To transcribe an audio file after it's been imported into a note, move your cursor right underneath the audio file and use the command `Smart transcribe` from the command palette. The plugin will transcribe the audio file and generate detailed notes. If you're speaking directly to Obsidian, you can select the "Smart Transcribe" button to transcribe what you've recorded.
- **Customizing the Prompt**: You can customize the prompt that will be sent to the AI model before adding your transcribed audio in the plugin settings.
- **Include Raw Transcript**: If you just want clean notes returned, you can remove the addition of the raw transcript at the end by toggling it off in the settings

View file

@ -2,8 +2,18 @@ import { App, TFile, TFolder, normalizePath } from 'obsidian';
export async function saveFile(app: App, audioBlob: Blob, fileName: string, path: string): Promise<TFile> {
try {
const normalizedPath = normalizePath(path);
const filePath = `${normalizedPath}/${fileName}`;
let normalizedPath: string;
try {
normalizedPath = normalizePath(path);
if (!normalizedPath) {
console.warn('Normalized path is invalid, using root path');
normalizedPath = '/'; // Set to root path of the vault
}
} catch (error) {
console.warn('Error normalizing path, using root path:', error);
normalizedPath = '/'; // Set to root path of the vault
} const filePath = `${normalizedPath}/${fileName}`;
await ensureDirectoryExists(app, normalizedPath);

11
main.ts
View file

@ -61,6 +61,16 @@ export default class SmartMemosPlugin extends Plugin {
}
});
// Add the record smart memo command
this.addCommand({
id: 'record-smart-memo',
name: 'Record smart memo',
editorCallback: async (editor: Editor, view: MarkdownView) => {
// Open the audio recorder and store the recorded audio
this.audioFile = await new SmartMemosAudioRecordModal(this.app, this.handleAudioRecording.bind(this)).open();
}
});
this.registerMarkdownPostProcessor((el: HTMLElement, ctx: MarkdownPostProcessorContext) => {
const audioLinks = el.querySelectorAll('a.internal-link[data-href$=".wav"]');
console.log('audio links: ', audioLinks);
@ -97,7 +107,6 @@ export default class SmartMemosPlugin extends Plugin {
// Add the audio recorder ribbon
// Update the callback for the audio recorder ribbon
this.addRibbonIcon('microphone', 'Record smart memo', async (evt: MouseEvent) => {
// Open the audio recorder and store the recorded audio
this.audioFile = await new SmartMemosAudioRecordModal(this.app, this.handleAudioRecording.bind(this)).open();

View file

@ -1,7 +1,7 @@
{
"id": "smart-memos",
"name": "Smart Memos",
"version": "1.1.2",
"version": "1.1.3",
"minAppVersion": "0.15.0",
"description": "Create personalized and intelligent analysis, summaries, and more for audio recordings that can be imported or spoken directly into a note",
"author": "Evan Moscoso",

View file

@ -1,6 +1,6 @@
{
"name": "smart-memos",
"version": "1.1.2",
"version": "1.1.3",
"description": "Create personalized and intelligent analysis, summaries, and more for audio recordings that can be imported or spoken directly into a note",
"main": "main.js",
"scripts": {

1
whisper.cpp Submodule

@ -0,0 +1 @@
Subproject commit c118733a29ad4a984015a5c08fd585086d01087a