Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/7695

Vanessaaeb13079e16b
diff --git a/app/src/config/AI.ts b/app/src/config/AI.ts
index 968ad6e89c..38686915bc 100644
--- a/app/src/config/AI.ts
+++ b/app/src/config/AI.ts
@@ -58,11 +58,11 @@ export const AI = {
item.addEventListener("change", () => {
fetchPost("/api/setting/setAI", {
openAI: {
- apiBaseURL: (AI.element.querySelector("#apiBaseURL") as HTMLInputElement).checked,
+ apiBaseURL: (AI.element.querySelector("#apiBaseURL") as HTMLInputElement).value,
apiKey: (AI.element.querySelector("#apiKey") as HTMLInputElement).value,
- apiMaxTokens: (AI.element.querySelector("#apiMaxTokens") as HTMLInputElement).value,
- apiProxy: (AI.element.querySelector("#apiProxy") as HTMLInputElement).checked,
- apiTimeout: (AI.element.querySelector("#apiTimeout") as HTMLInputElement).checked,
+ 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/card.ts b/app/src/config/card.ts
index 416e8a052a..66016fef9c 100644
--- a/app/src/config/card.ts
+++ b/app/src/config/card.ts
@@ -5,32 +5,56 @@ export const card = {
genHTML: () => {
return `<label class="fn__flex b3-label">
<div class="fn__flex-1">
- ${window.siyuan.languages.selectOpen}
- <div class="b3-label__text">${window.siyuan.languages.fileTree2}</div>
+ dailyNewCardLimit
+ <div class="b3-label__text">dailyNewCardLimitdailyNewCardLimit</div>
</div>
<span class="fn__space"></span>
- <input class="b3-switch fn__flex-center" id="alwaysSelectOpenedFile" type="checkbox"${window.siyuan.config.fileTree.alwaysSelectOpenedFile ? " checked" : ""}/>
+ <input class="b3-text-field fn__flex-center" id="dailyNewCardLimit" step="1" min="1" type="number"${window.siyuan.config.flashcard.dailyNewCardLimit ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
- ${window.siyuan.languages.fileTree7}
- <div class="b3-label__text">${window.siyuan.languages.fileTree8}</div>
+ dailyReviewCardLimit
+ <div class="b3-label__text">dailyReviewCardLimitdailyReviewCardLimit</div>
</div>
<span class="fn__space"></span>
- <input class="b3-switch fn__flex-center" id="openFilesUseCurrentTab" type="checkbox"${window.siyuan.config.fileTree.openFilesUseCurrentTab ? " checked" : ""}/>
+ <input class="b3-text-field fn__flex-center" id="dailyReviewCardLimit" step="1" min="1" type="number"${window.siyuan.config.flashcard.dailyReviewCardLimit ? " checked" : ""}/>
+</label>
+<label class="fn__flex b3-label">
+ <div class="fn__flex-1">
+ list
+ <div class="b3-label__text">listlist</div>
+ </div>
+ <span class="fn__space"></span>
+ <input class="b3-switch fn__flex-center" id="list" type="checkbox"${window.siyuan.config.flashcard.list ? " checked" : ""}/>
+</label>
+<label class="fn__flex b3-label">
+ <div class="fn__flex-1">
+ superBlock
+ <div class="b3-label__text">superBlocksuperBlock</div>
+ </div>
+ <span class="fn__space"></span>
+ <input class="b3-switch fn__flex-center" id="superBlock" type="checkbox"${window.siyuan.config.flashcard.superBlock ? " checked" : ""}/>
+</label>
+<label class="fn__flex b3-label">
+ <div class="fn__flex-1">
+ deck
+ <div class="b3-label__text">deckdeck</div>
+ </div>
+ <span class="fn__space"></span>
+ <input class="b3-switch fn__flex-center" id="deck" type="checkbox"${window.siyuan.config.flashcard.deck ? " checked" : ""}/>
</label>`;
},
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,
+ dailyNewCardLimit: parseInt((card.element.querySelector("#dailyNewCardLimit") as HTMLInputElement).value),
+ dailyReviewCardLimit: parseInt((card.element.querySelector("#dailyReviewCardLimit") as HTMLInputElement).value),
+ list: (card.element.querySelector("#list") as HTMLInputElement).checked,
+ superBlock: (card.element.querySelector("#superBlock") as HTMLInputElement).checked,
+ deck: (card.element.querySelector("#deck") as HTMLInputElement).checked,
}, response => {
- window.siyuan.config.ai = response.data;
+ window.siyuan.config.flashcard = response.data;
});
});
});
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index a18373a277..62ec63615a 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -392,6 +392,13 @@ declare interface IConfig {
repo: {
key: string
},
+ flashcard: {
+ dailyNewCardLimit: number
+ dailyReviewCardLimit: number
+ list: boolean
+ superBlock: boolean
+ deck: boolean
+ }
ai: {
openAI: {
apiBaseURL: string