mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-09 11:36:38 +08:00
Update fetch-prompts.mjs
This commit is contained in:
parent
8d2abe36a9
commit
605eb515b4
@ -8,7 +8,7 @@ const RAW_CN_URL = "PlexPt/awesome-chatgpt-prompts-zh/main/prompts-zh.json";
|
|||||||
const CN_URL = MIRRORF_FILE_URL + RAW_CN_URL;
|
const CN_URL = MIRRORF_FILE_URL + RAW_CN_URL;
|
||||||
const RAW_EN_URL = "f/awesome-chatgpt-prompts/main/prompts.csv";
|
const RAW_EN_URL = "f/awesome-chatgpt-prompts/main/prompts.csv";
|
||||||
const EN_URL = MIRRORF_FILE_URL + RAW_EN_URL;
|
const EN_URL = MIRRORF_FILE_URL + RAW_EN_URL;
|
||||||
const FILE = "./public/prompts.json";
|
|
||||||
|
|
||||||
async function fetchCN() {
|
async function fetchCN() {
|
||||||
console.log("[Fetch] fetching cn prompts...");
|
console.log("[Fetch] fetching cn prompts...");
|
||||||
@ -38,11 +38,11 @@ async function fetchEN() {
|
|||||||
async function main() {
|
async function main() {
|
||||||
Promise.all([fetchCN(), fetchEN()])
|
Promise.all([fetchCN(), fetchEN()])
|
||||||
.then(([cn, en]) => {
|
.then(([cn, en]) => {
|
||||||
fs.writeFile(FILE, JSON.stringify({ cn, en }));
|
fs.writeFile(JSON.stringify({ cn, en }));
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error("[Fetch] failed to fetch prompts");
|
console.error("[Fetch] failed to fetch prompts");
|
||||||
fs.writeFile(FILE, JSON.stringify({ cn: [], en: [] }));
|
fs.writeFile(JSON.stringify({ cn: [], en: [] }));
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
console.log("[Fetch] saved to " + FILE);
|
console.log("[Fetch] saved to " + FILE);
|
||||||
|
Loading…
Reference in New Issue
Block a user