浏览代码

fix: #829 filter empty prompt

Yidadaa 1 年之前
父节点
当前提交
ea3e8a7459
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      app/store/prompt.ts

+ 3 - 4
app/store/prompt.ts

@@ -116,10 +116,9 @@ export const usePromptStore = create<PromptStore>()(
               })
               .concat([...(state?.prompts?.values() ?? [])]);
 
-            const allPromptsForSearch = builtinPrompts.reduce(
-              (pre, cur) => pre.concat(cur),
-              [],
-            );
+            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.init(allPromptsForSearch);
           });