forked from XiaoMo/ChatGPT-Next-Web
Merge branch 'main' of https://github.com/Yidadaa/ChatGPT-Next-Web
This commit is contained in:
commit
bfad3df3b3
@ -102,7 +102,7 @@ We recommend that you follow the steps below to re-deploy:
|
|||||||
|
|
||||||
### Enable Automatic Updates
|
### Enable Automatic Updates
|
||||||
|
|
||||||
After forking the project, due to the limitations imposed by Github, you need to manually enable Workflows and Upstream Sync Action on the Actions page of the forked project. Once enabled, automatic updates will be scheduled every hour:
|
After forking the project, due to the limitations imposed by GitHub, you need to manually enable Workflows and Upstream Sync Action on the Actions page of the forked project. Once enabled, automatic updates will be scheduled every hour:
|
||||||
|
|
||||||
![Automatic Updates](./docs/images/enable-actions.jpg)
|
![Automatic Updates](./docs/images/enable-actions.jpg)
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ After forking the project, due to the limitations imposed by Github, you need to
|
|||||||
|
|
||||||
### Manually Updating Code
|
### Manually Updating Code
|
||||||
|
|
||||||
If you want to update instantly, you can check out the [Github documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) to learn how to synchronize a forked project with upstream code.
|
If you want to update instantly, you can check out the [GitHub documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) to learn how to synchronize a forked project with upstream code.
|
||||||
|
|
||||||
You can star or watch this project or follow author to get release notifictions in time.
|
You can star or watch this project or follow author to get release notifictions in time.
|
||||||
|
|
||||||
|
@ -10,10 +10,20 @@ 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";
|
||||||
|
|
||||||
|
const timeoutPromise = (timeout) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
reject(new Error('Request timeout'));
|
||||||
|
}, timeout);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
async function fetchCN() {
|
async function fetchCN() {
|
||||||
console.log("[Fetch] fetching cn prompts...");
|
console.log("[Fetch] fetching cn prompts...");
|
||||||
try {
|
try {
|
||||||
const raw = await (await fetch(CN_URL)).json();
|
// const raw = await (await fetch(CN_URL)).json();
|
||||||
|
const response = await Promise.race([fetch(CN_URL), timeoutPromise(5000)]);
|
||||||
|
const raw = await response.json();
|
||||||
return raw.map((v) => [v.act, v.prompt]);
|
return raw.map((v) => [v.act, v.prompt]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("[Fetch] failed to fetch cn prompts", error);
|
console.error("[Fetch] failed to fetch cn prompts", error);
|
||||||
@ -24,13 +34,15 @@ async function fetchCN() {
|
|||||||
async function fetchEN() {
|
async function fetchEN() {
|
||||||
console.log("[Fetch] fetching en prompts...");
|
console.log("[Fetch] fetching en prompts...");
|
||||||
try {
|
try {
|
||||||
const raw = await (await fetch(EN_URL)).text();
|
// const raw = await (await fetch(EN_URL)).text();
|
||||||
|
const response = await Promise.race([fetch(EN_URL), timeoutPromise(5000)]);
|
||||||
|
const raw = response.text();
|
||||||
return raw
|
return raw
|
||||||
.split("\n")
|
.split("\n")
|
||||||
.slice(1)
|
.slice(1)
|
||||||
.map((v) => v.split('","').map((v) => v.replace('"', "")));
|
.map((v) => v.split('","').map((v) => v.replace('"', "")));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("[Fetch] failed to fetch cn prompts", error);
|
console.error("[Fetch] failed to fetch en prompts", error);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user