diff --git a/components/GetArxiv.tsx b/components/GetArxiv.tsx index 01f8c393..04dc7f5d 100644 --- a/components/GetArxiv.tsx +++ b/components/GetArxiv.tsx @@ -37,13 +37,14 @@ interface Author { async function getArxivPapers( query: string, - maxResults = 5, + maxResults = 2, offset = -1, sortBy = "submittedDate", sortOrder = "descending" ) { - const maxOffset = 20 - maxResults; // 假设总记录数为 20 + const maxOffset = 30 - maxResults; // 假设总记录数为 20 if (offset === -1) offset = getRandomOffset(maxOffset); + console.log("offset in arxiv", offset); const url = `https://export.arxiv.org/api/query?search_query=${query}&start=${offset}&max_results=${maxResults}&sortBy=${sortBy}&sortOrder=${sortOrder}`; try { diff --git a/components/QuillEditor.tsx b/components/QuillEditor.tsx index eb8ca77d..d809f7b3 100644 --- a/components/QuillEditor.tsx +++ b/components/QuillEditor.tsx @@ -345,14 +345,6 @@ const QEditor = ({ lng }) => { }) .join(""); } - //在对应的位置添加文献 - const nearestNumber = getNumberBeforeCursor(quill!); - dispatch( - addReferencesRedux({ - references: newReferences, - position: nearestNumber, - }) - ); // 确保搜索到的论文不超过 3000 个字符 const trimmedMessage = @@ -378,6 +370,14 @@ const QEditor = ({ lng }) => { // 重新获取更新后的内容并更新 Redux store const updatedContent = quill!.root.innerHTML; dispatch(setEditorContent(updatedContent)); + //在对应的位置添加文献 + const nearestNumber = getNumberBeforeCursor(quill!); + dispatch( + addReferencesRedux({ + references: newReferences, + position: nearestNumber, + }) + ); if (isVip) { //在云端同步supabase const data = await submitPaper(