mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-19 20:20:16 +09:00
Merge bc53c17a8c
into 3809375694
This commit is contained in:
commit
71d4abefd3
@ -159,10 +159,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]) =>
|
||||||
@ -180,8 +180,9 @@ export const usePromptStore = createPersistStore(
|
|||||||
const allPromptsForSearch = builtinPrompts
|
const allPromptsForSearch = builtinPrompts
|
||||||
.reduce((pre, cur) => pre.concat(cur), [])
|
.reduce((pre, cur) => pre.concat(cur), [])
|
||||||
.filter((v) => !!v.title && !!v.content);
|
.filter((v) => !!v.title && !!v.content);
|
||||||
SearchService.count.builtin =
|
SearchService.count.builtin = Object.values(res)
|
||||||
res.en.length + res.cn.length + res.tw.length;
|
.filter(Array.isArray)
|
||||||
|
.reduce((total, promptList) => total + promptList.length, 0);
|
||||||
SearchService.init(allPromptsForSearch, userPrompts);
|
SearchService.init(allPromptsForSearch, userPrompts);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user