Improve prompt store lang sorting

This commit is contained in:
Peter Dave Hello 2024-07-14 16:54:16 +08:00
parent 115f357a07
commit 16c16887ae
1 changed files with 4 additions and 4 deletions

View File

@ -154,10 +154,10 @@ export const usePromptStore = createPersistStore(
fetch(PROMPT_URL)
.then((res) => res.json())
.then((res) => {
let fetchPrompts = [res.en, res.tw, res.cn];
if (getLang() === "cn") {
fetchPrompts = fetchPrompts.reverse();
}
const lang = getLang();
const fetchPrompts = [res[lang], res.en, res.tw, res.cn].filter(
Boolean,
);
const builtinPrompts = fetchPrompts.map((promptList: PromptList) => {
return promptList.map(
([title, content]) =>