mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-16 22:13:47 +08:00
Merge remote-tracking branch 'upstream/main' into dev
# Conflicts: # app/api/google/[...path]/route.ts # app/client/platforms/google.ts # app/constant.ts # app/store/prompt.ts # app/utils/hooks.ts # public/prompts.json
This commit is contained in:
@@ -9,8 +9,6 @@ import {
|
||||
DEFAULT_MODELS,
|
||||
DEFAULT_SYSTEM_TEMPLATE,
|
||||
KnowledgeCutOffDate,
|
||||
ServiceProvider,
|
||||
ModelProvider,
|
||||
StoreKey,
|
||||
SUMMARIZE_MODEL,
|
||||
GEMINI_SUMMARIZE_MODEL,
|
||||
|
||||
@@ -168,7 +168,7 @@ export const usePromptStore = createPersistStore(
|
||||
fetch(PROMPT_URL)
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
let fetchPrompts = [res.en, res.cn];
|
||||
let fetchPrompts = [res.en, res.tw, res.cn];
|
||||
if (getLang() === "cn") {
|
||||
fetchPrompts = fetchPrompts.reverse();
|
||||
}
|
||||
@@ -183,50 +183,59 @@ export const usePromptStore = createPersistStore(
|
||||
}) as Prompt,
|
||||
);
|
||||
});
|
||||
|
||||
const userPrompts = usePromptStore.getState().getUserPrompts() ?? [];
|
||||
|
||||
const allPromptsForSearch = builtinPrompts
|
||||
.reduce((pre, cur) => pre.concat(cur), [])
|
||||
.filter((v) => !!v.title && !!v.content);
|
||||
SearchService.count.builtin =
|
||||
res.en.length + res.cn.length + res.tw.length;
|
||||
SearchService.init(allPromptsForSearch, userPrompts);
|
||||
// let gptPrompts: Prompt[] = [];
|
||||
try {
|
||||
fetch(GPT_PROMPT_URL)
|
||||
.then((res2) => res2.json())
|
||||
.then((res2) => {
|
||||
const gptPrompts: Prompt[] = res2["items"].map(
|
||||
(prompt: {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
prompt: string;
|
||||
category: string;
|
||||
}) => {
|
||||
return {
|
||||
id: prompt["id"],
|
||||
title: prompt["title"],
|
||||
content: prompt["prompt"],
|
||||
createdAt: Date.now(),
|
||||
};
|
||||
},
|
||||
);
|
||||
const userPrompts =
|
||||
usePromptStore.getState().getUserPrompts() ?? [];
|
||||
const allPromptsForSearch = builtinPrompts
|
||||
.reduce((pre, cur) => pre.concat(cur), [])
|
||||
.filter((v) => !!v.title && !!v.content);
|
||||
SearchService.count.builtin =
|
||||
res.en.length + res.cn.length + res["total"];
|
||||
SearchService.init(
|
||||
allPromptsForSearch,
|
||||
userPrompts,
|
||||
gptPrompts,
|
||||
);
|
||||
});
|
||||
} catch (e) {
|
||||
console.log("[gpt prompt]", e);
|
||||
const userPrompts =
|
||||
usePromptStore.getState().getUserPrompts() ?? [];
|
||||
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, userPrompts);
|
||||
}
|
||||
// try {
|
||||
// fetch(GPT_PROMPT_URL)
|
||||
// .then((res2) => res2.json())
|
||||
// .then((res2) => {
|
||||
// const gptPrompts: Prompt[] = res2["items"].map(
|
||||
// (prompt: {
|
||||
// id: string;
|
||||
// title: string;
|
||||
// description: string;
|
||||
// prompt: string;
|
||||
// category: string;
|
||||
// }) => {
|
||||
// return {
|
||||
// id: prompt["id"],
|
||||
// title: prompt["title"],
|
||||
// content: prompt["prompt"],
|
||||
// createdAt: Date.now(),
|
||||
// };
|
||||
// },
|
||||
// );
|
||||
// const userPrompts =
|
||||
// usePromptStore.getState().getUserPrompts() ?? [];
|
||||
// const allPromptsForSearch = builtinPrompts
|
||||
// .reduce((pre, cur) => pre.concat(cur), [])
|
||||
// .filter((v) => !!v.title && !!v.content);
|
||||
// SearchService.count.builtin =
|
||||
// res.en.length + res.cn.length + res["total"];
|
||||
// SearchService.init(
|
||||
// allPromptsForSearch,
|
||||
// userPrompts,
|
||||
// gptPrompts,
|
||||
// );
|
||||
// });
|
||||
// } catch (e) {
|
||||
// console.log("[gpt prompt]", e);
|
||||
// const userPrompts =
|
||||
// usePromptStore.getState().getUserPrompts() ?? [];
|
||||
// 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, userPrompts);
|
||||
// }
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user