diff --git a/app/src/config/AI.ts b/app/src/config/ai.ts similarity index 88% rename from app/src/config/AI.ts rename to app/src/config/ai.ts index dfae27715..31b587937 100644 --- a/app/src/config/AI.ts +++ b/app/src/config/ai.ts @@ -1,6 +1,6 @@ import {fetchPost} from "../util/fetch"; -export const AI = { +export const ai = { element: undefined as Element, genHTML: () => { return `
@@ -54,15 +54,15 @@ export const AI = {
`; }, bindEvent: () => { - AI.element.querySelectorAll("input").forEach((item) => { + ai.element.querySelectorAll("input").forEach((item) => { item.addEventListener("change", () => { fetchPost("/api/setting/setAI", { openAI: { - apiBaseURL: (AI.element.querySelector("#apiBaseURL") as HTMLInputElement).value, - apiKey: (AI.element.querySelector("#apiKey") as HTMLInputElement).value, - apiMaxTokens: parseInt((AI.element.querySelector("#apiMaxTokens") as HTMLInputElement).value), - apiProxy: (AI.element.querySelector("#apiProxy") as HTMLInputElement).value, - apiTimeout: parseInt((AI.element.querySelector("#apiTimeout") as HTMLInputElement).value), + apiBaseURL: (ai.element.querySelector("#apiBaseURL") as HTMLInputElement).value, + apiKey: (ai.element.querySelector("#apiKey") as HTMLInputElement).value, + apiMaxTokens: parseInt((ai.element.querySelector("#apiMaxTokens") as HTMLInputElement).value), + apiProxy: (ai.element.querySelector("#apiProxy") as HTMLInputElement).value, + apiTimeout: parseInt((ai.element.querySelector("#apiTimeout") as HTMLInputElement).value), } }, response => { window.siyuan.config.ai = response.data; diff --git a/app/src/config/index.ts b/app/src/config/index.ts index d16a52600..1360f0a28 100644 --- a/app/src/config/index.ts +++ b/app/src/config/index.ts @@ -11,7 +11,7 @@ import {keymap} from "./keymap"; import {bazaar} from "./bazaar"; import {query} from "./query"; import {Dialog} from "../dialog"; -import {AI} from "./AI"; +import {ai} from "./ai"; import {card} from "./card"; export const openSetting = () => { @@ -82,9 +82,9 @@ export const openSetting = () => { fileTree.bindEvent(); break; case "AI": - containerElement.innerHTML = AI.genHTML(); - AI.element = dialog.element.querySelector('.config__tab-container[data-name="AI"]'); - AI.bindEvent(); + containerElement.innerHTML = ai.genHTML(); + ai.element = dialog.element.querySelector('.config__tab-container[data-name="AI"]'); + ai.bindEvent(); break; case "card": containerElement.innerHTML = card.genHTML();