feat: 增加了时间范围选择,除arxiv
This commit is contained in:
parent
a38b9cee52
commit
49a757f6c7
|
@ -4,6 +4,8 @@
|
||||||
"AI写作": "AI writing",
|
"AI写作": "AI writing",
|
||||||
"Paper2AI": "Paper2AI",
|
"Paper2AI": "Paper2AI",
|
||||||
"点击AI写作就是正常的对话交流,点击寻找文献会根据输入的主题词去寻找对应论文": "Click AI Write for normal conversation, click Paper2AI to find corresponding papers based on the input topic",
|
"点击AI写作就是正常的对话交流,点击寻找文献会根据输入的主题词去寻找对应论文": "Click AI Write for normal conversation, click Paper2AI to find corresponding papers based on the input topic",
|
||||||
|
"生成轮数": "Generation Rounds",
|
||||||
|
"时间范围": "Range of literature release dates, from this time to this year",
|
||||||
"+ Add Paper": "+ Add Paper",
|
"+ Add Paper": "+ Add Paper",
|
||||||
"Buy VIP TO UNLOCK Cloud Sync and Edit Mutiple Papers Simultaneously": "Buy VIP TO UNLOCK Cloud Sync and Edit Mutiple Papers Simultaneously",
|
"Buy VIP TO UNLOCK Cloud Sync and Edit Mutiple Papers Simultaneously": "Buy VIP TO UNLOCK Cloud Sync and Edit Mutiple Papers Simultaneously",
|
||||||
"Paper Management": "Paper Management",
|
"Paper Management": "Paper Management",
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
"AI写作": "AI写作",
|
"AI写作": "AI写作",
|
||||||
"Paper2AI": "寻找文献",
|
"Paper2AI": "寻找文献",
|
||||||
"点击AI写作就是正常的对话交流,点击寻找文献会根据输入的主题词去寻找对应论文": "点击AI写作就是正常的对话交流,点击寻找文献会根据输入的主题词去寻找对应论文",
|
"点击AI写作就是正常的对话交流,点击寻找文献会根据输入的主题词去寻找对应论文": "点击AI写作就是正常的对话交流,点击寻找文献会根据输入的主题词去寻找对应论文",
|
||||||
|
"生成轮数": "生成轮数",
|
||||||
|
"时间范围": "文献发布日期范围,从这个时间到今年",
|
||||||
"+ Add Paper": "+ 添加新论文(会直接替换编辑器里的内容)",
|
"+ Add Paper": "+ 添加新论文(会直接替换编辑器里的内容)",
|
||||||
"Buy VIP TO UNLOCK Cloud Sync and Edit Mutiple Papers Simultaneously": "购买VIP解锁云同步和同时编辑多篇论文",
|
"Buy VIP TO UNLOCK Cloud Sync and Edit Mutiple Papers Simultaneously": "购买VIP解锁云同步和同时编辑多篇论文",
|
||||||
"Paper Management": "论文管理",
|
"Paper Management": "论文管理",
|
||||||
|
|
|
@ -23,7 +23,7 @@ async function getPubMedPapers(
|
||||||
const retMax = limit; // 检索的最大记录数
|
const retMax = limit; // 检索的最大记录数
|
||||||
const maxOffset = 20 - limit; // 假设总记录数为 20
|
const maxOffset = 20 - limit; // 假设总记录数为 20
|
||||||
if (offset === -1) offset = getRandomOffset(maxOffset);
|
if (offset === -1) offset = getRandomOffset(maxOffset);
|
||||||
const url = `${baseURL}?db=${db}&term=${query}[Title/Abstract]+AND+2018:3000[Date - Publication]&retMax=${retMax}&retStart=${offset}&api_key=${process.env.NEXT_PUBLIC_PUBMED_API_KEY}`;
|
const url = `${baseURL}?db=${db}&term=${query}[Title/Abstract]+AND+${year}:3000[Date - Publication]&retMax=${retMax}&retStart=${offset}&api_key=${process.env.NEXT_PUBLIC_PUBMED_API_KEY}`;
|
||||||
const response = await axios.get(url, { responseType: "text" });
|
const response = await axios.get(url, { responseType: "text" });
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
// 解析XML数据
|
// 解析XML数据
|
||||||
|
|
|
@ -44,6 +44,10 @@ import {
|
||||||
import { debounce } from "lodash";
|
import { debounce } from "lodash";
|
||||||
//i18n
|
//i18n
|
||||||
import { useTranslation } from "@/app/i18n/client";
|
import { useTranslation } from "@/app/i18n/client";
|
||||||
|
//notification
|
||||||
|
import { ToastContainer } from "react-toastify";
|
||||||
|
import "react-toastify/dist/ReactToastify.css";
|
||||||
|
import NotifyButton from "@/components/Notification"; // 确保路径正确
|
||||||
|
|
||||||
const toolbarOptions = [
|
const toolbarOptions = [
|
||||||
["bold", "italic", "underline", "strike"], // 加粗、斜体、下划线和删除线
|
["bold", "italic", "underline", "strike"], // 加粗、斜体、下划线和删除线
|
||||||
|
@ -110,6 +114,8 @@ const QEditor = ({ lng }) => {
|
||||||
"生成次数",
|
"生成次数",
|
||||||
1
|
1
|
||||||
); // 初始值设为1
|
); // 初始值设为1
|
||||||
|
//选择时间范围
|
||||||
|
const [timeRange, setTimeRange] = useLocalStorage("时间范围", "2019");
|
||||||
const [generateNumber, setGenerateNumber] = useState(0); //当前任务的进行数
|
const [generateNumber, setGenerateNumber] = useState(0); //当前任务的进行数
|
||||||
const [openProgressBar, setOpenProgressBar] = useState(false);
|
const [openProgressBar, setOpenProgressBar] = useState(false);
|
||||||
|
|
||||||
|
@ -338,7 +344,12 @@ const QEditor = ({ lng }) => {
|
||||||
})
|
})
|
||||||
.join("");
|
.join("");
|
||||||
} else if (selectedSource === "semanticScholar") {
|
} else if (selectedSource === "semanticScholar") {
|
||||||
rawData = await getSemanticPapers(topic, "2015-2023", offset, limit);
|
rawData = await getSemanticPapers(
|
||||||
|
topic,
|
||||||
|
`${timeRange}-2024`,
|
||||||
|
offset,
|
||||||
|
limit
|
||||||
|
);
|
||||||
//判断返回的文献是否跟用户输入的主题相关
|
//判断返回的文献是否跟用户输入的主题相关
|
||||||
if (isEvaluateTopicMatch) {
|
if (isEvaluateTopicMatch) {
|
||||||
const { relevantPapers, nonRelevantPapers } =
|
const { relevantPapers, nonRelevantPapers } =
|
||||||
|
@ -367,7 +378,12 @@ const QEditor = ({ lng }) => {
|
||||||
})
|
})
|
||||||
.join("");
|
.join("");
|
||||||
} else if (selectedSource === "pubmed") {
|
} else if (selectedSource === "pubmed") {
|
||||||
rawData = await fetchPubMedData(topic, 2020, offset, limit);
|
rawData = await fetchPubMedData(
|
||||||
|
topic,
|
||||||
|
Number(timeRange)!,
|
||||||
|
offset,
|
||||||
|
limit
|
||||||
|
);
|
||||||
if (!rawData) {
|
if (!rawData) {
|
||||||
throw new Error("未搜索到文献 from PubMed.");
|
throw new Error("未搜索到文献 from PubMed.");
|
||||||
}
|
}
|
||||||
|
@ -501,12 +517,22 @@ const QEditor = ({ lng }) => {
|
||||||
<option value="gpt-4">gpt-4</option>
|
<option value="gpt-4">gpt-4</option>
|
||||||
<option value="deepseek-chat">deepseek-chat</option>
|
<option value="deepseek-chat">deepseek-chat</option>
|
||||||
</select>
|
</select>
|
||||||
|
{/* 进行几轮生成 */}
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
|
title={t("生成轮数")}
|
||||||
value={generatedPaperNumber}
|
value={generatedPaperNumber}
|
||||||
onChange={handleGeneratedPaperNumberChange}
|
onChange={handleGeneratedPaperNumberChange}
|
||||||
className="border border-gray-300 text-gray-700 text-sm p-1 rounded w-16"
|
className="border border-gray-300 text-gray-700 text-sm p-1 rounded w-16"
|
||||||
/>
|
/>
|
||||||
|
{/* 时间范围 */}
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
title={t("时间范围")}
|
||||||
|
value={timeRange}
|
||||||
|
onChange={(e) => setTimeRange(e.target.value)}
|
||||||
|
className="border border-gray-300 text-gray-700 text-sm p-1 rounded w-16"
|
||||||
|
/>
|
||||||
<button
|
<button
|
||||||
onClick={() => formatTextInEditor(quill)} // 假设 updateIndex 是处理更新操作的函数
|
onClick={() => formatTextInEditor(quill)} // 假设 updateIndex 是处理更新操作的函数
|
||||||
className="bg-gray-300 hover:bg-gray-400 text-black font-bold py-2 px-4 rounded"
|
className="bg-gray-300 hover:bg-gray-400 text-black font-bold py-2 px-4 rounded"
|
||||||
|
@ -525,6 +551,7 @@ const QEditor = ({ lng }) => {
|
||||||
<ReferenceList editor={quill} lng={lng} />
|
<ReferenceList editor={quill} lng={lng} />
|
||||||
<ExportDocx editor={quill} />
|
<ExportDocx editor={quill} />
|
||||||
</div>
|
</div>
|
||||||
|
<ToastContainer />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user