mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-23 14:10:18 +09:00
切换jsdelivr镜像,更新prompts列表
This commit is contained in:
parent
b966107117
commit
54e3753d93
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,13 @@
|
|||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import fs from "fs/promises";
|
import fs from "fs/promises";
|
||||||
|
|
||||||
const RAW_FILE_URL = "https://raw.githubusercontent.com/";
|
const MIRRORF_FILE_URL = "https://cdn.jsdelivr.net/gh/";
|
||||||
const MIRRORF_FILE_URL = "http://raw.fgit.ml/";
|
|
||||||
|
|
||||||
const RAW_CN_URL = "PlexPt/awesome-chatgpt-prompts-zh/main/prompts-zh.json";
|
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_TW_URL = "PlexPt/awesome-chatgpt-prompts-zh/main/prompts-zh-TW.json";
|
const RAW_TW_URL = "PlexPt/awesome-chatgpt-prompts-zh@main/prompts-zh-TW.json";
|
||||||
const TW_URL = MIRRORF_FILE_URL + RAW_TW_URL;
|
const TW_URL = MIRRORF_FILE_URL + RAW_TW_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";
|
const FILE = "./public/prompts.json";
|
||||||
|
|
||||||
@ -84,11 +83,11 @@ async function fetchEN() {
|
|||||||
async function main() {
|
async function main() {
|
||||||
Promise.all([fetchCN(), fetchTW(), fetchEN()])
|
Promise.all([fetchCN(), fetchTW(), fetchEN()])
|
||||||
.then(([cn, tw, en]) => {
|
.then(([cn, tw, en]) => {
|
||||||
fs.writeFile(FILE, JSON.stringify({ cn, tw, en }));
|
fs.writeFile(FILE, JSON.stringify({ cn, tw, en }, null, 2));
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error("[Fetch] failed to fetch prompts");
|
console.error("[Fetch] failed to fetch prompts");
|
||||||
fs.writeFile(FILE, JSON.stringify({ cn: [], tw: [], en: [] }));
|
fs.writeFile(FILE, JSON.stringify({ cn: [], tw: [], en: [] }, null, 2));
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
console.log("[Fetch] saved to " + FILE);
|
console.log("[Fetch] saved to " + FILE);
|
||||||
|
Loading…
Reference in New Issue
Block a user