mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-10 12:06:38 +08:00
UI Page [Chats Prompt] (#20)
[+] fix(prompt.ts): add support for fetching prompts in Indonesian language [+] fix(prompt.ts): update count of builtin prompts to include Indonesian prompts
This commit is contained in:
parent
144200e315
commit
fc4953f9a7
@ -154,10 +154,13 @@ 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.cn];
|
let fetchPrompts = [res.en, res.id, res.cn];
|
||||||
if (getLang() === "cn") {
|
if (getLang() === "cn") {
|
||||||
fetchPrompts = fetchPrompts.reverse();
|
fetchPrompts = fetchPrompts.reverse();
|
||||||
}
|
}
|
||||||
|
if (getLang() === "id") {
|
||||||
|
fetchPrompts = fetchPrompts.reverse();
|
||||||
|
}
|
||||||
const builtinPrompts = fetchPrompts.map((promptList: PromptList) => {
|
const builtinPrompts = fetchPrompts.map((promptList: PromptList) => {
|
||||||
return promptList.map(
|
return promptList.map(
|
||||||
([title, content]) =>
|
([title, content]) =>
|
||||||
@ -175,7 +178,8 @@ 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 = res.en.length + res.cn.length;
|
SearchService.count.builtin =
|
||||||
|
res.en.length + res.id.length + res.cn.length;
|
||||||
SearchService.init(allPromptsForSearch, userPrompts);
|
SearchService.init(allPromptsForSearch, userPrompts);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user