mirror of
https://github.com/manibatra/obsidian-text2anki-openai.git
synced 2026-07-22 07:40:28 +00:00
Use Obsidian requestURL
This commit is contained in:
parent
1905f599b9
commit
1db6ea57f8
1 changed files with 10 additions and 2 deletions
12
main.ts
12
main.ts
|
|
@ -1,4 +1,11 @@
|
|||
import { App, Plugin, PluginSettingTab, Setting, Notice } from "obsidian";
|
||||
import {
|
||||
App,
|
||||
Plugin,
|
||||
PluginSettingTab,
|
||||
Setting,
|
||||
Notice,
|
||||
requestUrl,
|
||||
} from "obsidian";
|
||||
import { Configuration, OpenAIApi } from "openai";
|
||||
interface FlashcardGeneratorSettings {
|
||||
modelName: string;
|
||||
|
|
@ -203,7 +210,8 @@ export default class FlashcardGeneratorPlugin extends Plugin {
|
|||
}
|
||||
|
||||
async invokeAnkiConnect(action: string, params?: any) {
|
||||
const response = await fetch("http://localhost:8765", {
|
||||
const response = await requestUrl({
|
||||
url: "http://localhost:8765",
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
action,
|
||||
|
|
|
|||
Loading…
Reference in a new issue