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) fetch(PROMPT_URL)
.then((res) => res.json()) .then((res) => res.json())
.then((res) => { .then((res) => {
let fetchPrompts = [res.en, res.tw, res.cn]; const lang = getLang();
if (getLang() === "cn") { const fetchPrompts = [res[lang], res.en, res.tw, res.cn].filter(
fetchPrompts = fetchPrompts.reverse(); Boolean,
} );
const builtinPrompts = fetchPrompts.map((promptList: PromptList) => { const builtinPrompts = fetchPrompts.map((promptList: PromptList) => {
return promptList.map( return promptList.map(
([title, content]) => ([title, content]) =>