From 4329c70952aa1ea438ef7e1ecd4c03e9f3ffb022 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 22 Mar 2023 09:59:29 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=AF=E6=8C=81=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=86=85=E9=85=8D=E7=BD=AE=E4=BA=BA=E5=B7=A5=E6=99=BA=E8=83=BD?= =?UTF-8?q?=20https://github.com/siyuan-note/siyuan/issues/7714?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/config/{AI.ts => ai.ts} | 14 +++++++------- app/src/config/index.ts | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) rename app/src/config/{AI.ts => ai.ts} (88%) 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();