generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7da3a15
commit 305f967
Showing
6 changed files
with
62 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
async function useAudio(filePath: string) { | ||
const result = await fetch("http://localhost:3000/api/audio", { | ||
method: "POST", | ||
body: JSON.stringify({ filePath }), | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
const data = await result.json(); | ||
console.log("audio data", data); | ||
return data.text; | ||
import { requestUrl } from "obsidian"; | ||
import { logMessage } from "../../utils"; | ||
|
||
// audio type of type base64 | ||
async function useAudio(audioFileBase64: string) { | ||
const baseUrl = "https://file-organizer-2000.vercel.app/"; | ||
|
||
const endpoint = "api/audio"; | ||
const url = `${baseUrl}/${endpoint}`; | ||
try { | ||
const result = await requestUrl({ | ||
url: url, | ||
method: "POST", | ||
body: JSON.stringify({ file: audioFileBase64 }), | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
const data = await result.json; | ||
logMessage(data.text); | ||
return data.text; | ||
} catch (error) { | ||
console.error("Error uploading audio file:", error); | ||
} | ||
} | ||
|
||
export default useAudio; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters