mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-10 12:30:27 +08:00
This commit is contained in:
parent
a6c3015a07
commit
b0705985ac
@ -3,7 +3,13 @@ import {fetchPost} from "../util/fetch";
|
|||||||
export const AI = {
|
export const AI = {
|
||||||
element: undefined as Element,
|
element: undefined as Element,
|
||||||
genHTML: () => {
|
genHTML: () => {
|
||||||
return `<label class="fn__flex b3-label">
|
return `<div class="fn__flex-column" style="height: 100%">
|
||||||
|
<div class="layout-tab-bar fn__flex">
|
||||||
|
<div data-type="openai" class="item item--full item--focus"><span class="fn__flex-1"></span><span class="item__text">OpenAI</span><span class="fn__flex-1"></span></div>
|
||||||
|
</div>
|
||||||
|
<div class="fn__flex-1">
|
||||||
|
<div data-type="openai">
|
||||||
|
<label class="fn__flex b3-label">
|
||||||
<div class="fn__flex-1">
|
<div class="fn__flex-1">
|
||||||
APIKey
|
APIKey
|
||||||
<div class="b3-label__text">APIKeyAPIKeyAPIKey</div>
|
<div class="b3-label__text">APIKeyAPIKeyAPIKey</div>
|
||||||
@ -42,7 +48,10 @@ export const AI = {
|
|||||||
</div>
|
</div>
|
||||||
<span class="fn__space"></span>
|
<span class="fn__space"></span>
|
||||||
<input class="b3-text-field fn__flex-center" id="apiBaseURL" value="${window.siyuan.config.ai.openAI.apiBaseURL}"/>
|
<input class="b3-text-field fn__flex-center" id="apiBaseURL" value="${window.siyuan.config.ai.openAI.apiBaseURL}"/>
|
||||||
</label>`;
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
},
|
},
|
||||||
bindEvent: () => {
|
bindEvent: () => {
|
||||||
AI.element.querySelectorAll("input").forEach((item) => {
|
AI.element.querySelectorAll("input").forEach((item) => {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import {fetchPost} from "../util/fetch";
|
||||||
|
|
||||||
export const card = {
|
export const card = {
|
||||||
element: undefined as Element,
|
element: undefined as Element,
|
||||||
@ -20,5 +21,18 @@ export const card = {
|
|||||||
</label>`;
|
</label>`;
|
||||||
},
|
},
|
||||||
bindEvent: () => {
|
bindEvent: () => {
|
||||||
|
card.element.querySelectorAll("input").forEach((item) => {
|
||||||
|
item.addEventListener("change", () => {
|
||||||
|
fetchPost("/api/setting/setFlashcard", {
|
||||||
|
apiBaseURL: (card.element.querySelector("#apiBaseURL") as HTMLInputElement).checked,
|
||||||
|
apiKey: (card.element.querySelector("#apiKey") as HTMLInputElement).value,
|
||||||
|
apiMaxTokens: (card.element.querySelector("#apiMaxTokens") as HTMLInputElement).value,
|
||||||
|
apiProxy: (card.element.querySelector("#apiProxy") as HTMLInputElement).checked,
|
||||||
|
apiTimeout: (card.element.querySelector("#apiTimeout") as HTMLInputElement).checked,
|
||||||
|
}, response => {
|
||||||
|
window.siyuan.config.ai = response.data;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user