From fc4953f9a7b1331ce548becddfbb98e924286cb1 Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Thu, 28 Sep 2023 02:04:16 +0700 Subject: [PATCH] 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 --- app/store/prompt.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/store/prompt.ts b/app/store/prompt.ts index c6cff1a65..4460f3578 100644 --- a/app/store/prompt.ts +++ b/app/store/prompt.ts @@ -154,10 +154,13 @@ export const usePromptStore = createPersistStore( fetch(PROMPT_URL) .then((res) => res.json()) .then((res) => { - let fetchPrompts = [res.en, res.cn]; + let fetchPrompts = [res.en, res.id, res.cn]; if (getLang() === "cn") { fetchPrompts = fetchPrompts.reverse(); } + if (getLang() === "id") { + fetchPrompts = fetchPrompts.reverse(); + } const builtinPrompts = fetchPrompts.map((promptList: PromptList) => { return promptList.map( ([title, content]) => @@ -175,7 +178,8 @@ export const usePromptStore = createPersistStore( const allPromptsForSearch = builtinPrompts .reduce((pre, cur) => pre.concat(cur), []) .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); }); },