mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 13:06:57 +08:00
feat: using fetch to get buildin masks
This commit is contained in:
@@ -22,6 +22,20 @@ export const BUILTIN_MASK_STORE = {
|
||||
},
|
||||
};
|
||||
|
||||
export const BUILTIN_MASKS: BuiltinMask[] = [...CN_MASKS, ...TW_MASKS, ...EN_MASKS].map(
|
||||
(m) => BUILTIN_MASK_STORE.add(m),
|
||||
);
|
||||
export const BUILTIN_MASKS: BuiltinMask[] = [];
|
||||
|
||||
if (typeof window != "undefined") {
|
||||
// run in browser skip in next server
|
||||
fetch("/masks.json")
|
||||
.then((res) => res.json())
|
||||
.catch((error) => {
|
||||
console.error("[Fetch] failed to fetch masks", error);
|
||||
return { cn: [], tw: [], en: [] };
|
||||
})
|
||||
.then((masks) => {
|
||||
const { cn = [], tw = [], en = [] } = masks;
|
||||
return [...cn, ...tw, ...en].map((m) => {
|
||||
BUILTIN_MASKS.push(BUILTIN_MASK_STORE.add(m));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user