Skip to content

Commit

Permalink
fix: 调整pubmed时间
Browse files Browse the repository at this point in the history
  • Loading branch information
14790897 committed Jan 28, 2024
1 parent 743bbf5 commit 8508a35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions components/GetPubMed .tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ async function getPubMedPapers(query: string, year: number, limit = 2) {
"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi";
const db = "pubmed"; // 设定搜索的数据库为PubMed
const retMax = limit; // 检索的最大记录数
const retStart = getRandomOffset(10 - limit); // 假设每页最多10条,根据需要随机偏移

const url = `${baseURL}?db=${db}&term=${query}[Title/Abstract]+AND+${year}[Date+-+Publication]&retMax=${retMax}&retStart=${retStart}&api_key=${process.env.NEXT_PUBLIC_PUBMED_API_KEY}`;
const retStart = getRandomOffset(30 - limit); // 假设每页最多30条,根据需要随机偏移
const url = `${baseURL}?db=${db}&term=${query}[Title/Abstract]+AND+2018:3000[Date - Publication]&retMax=${retMax}&retStart=${retStart}&api_key=${process.env.NEXT_PUBLIC_PUBMED_API_KEY}`;
const response = await axios.get(url, { responseType: "text" });
console.log(response.data);
// 解析XML数据
Expand Down
6 changes: 3 additions & 3 deletions components/chatAI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const sendMessageToOpenAI = async (
prompt ||
`作为论文写作助手,您的主要任务是根据用户提供的研究主题和上下文,以及相关的研究论文,来撰写和完善学术论文。在撰写过程中,请注意以下要点:
1.学术格式:请采用标准的学术论文格式进行写作,包括清晰的段落结构、逻辑严谨的论点展开,以及恰当的专业术语使用。
2.文献引用:只引用与主题紧密相关的论文。在引用文献时,文末应使用方括号内的数字来标注引用来源,如 [1]。请确保每个引用在文章中都有其对应的编号,*无需在文章末尾提供参考文献列表*。
2.文献引用:只引用与主题紧密相关的论文。在引用文献时,文末应使用方括号内的数字来标注引用来源,如 [1]。请确保每个引用在文章中都有其对应的编号,*无需在文章末尾提供参考文献列表*。*每个文献对应的序号只应该出现一次,比如说引用了第一篇文献文中就只能出现一次[1]*。
3.忽略无关文献:对于与主题无关的论文,请不要包含在您的写作中。只关注对理解和阐述主题有实质性帮助的资料。
4.来源明确:在文章中,清楚地指出每个引用的具体来源。引用的信息应准确无误,确保读者能够追溯到原始文献。
5.使用用户所说的语言完成回答,不超过三百字
Expand Down Expand Up @@ -154,15 +154,15 @@ async function processResult(reader, decoder, editor) {
break;
}
buffer += decoder.decode(value, { stream: true });
console.log("buffer", buffer);
// console.log("buffer", buffer);
// 处理缓冲区中的所有完整的 JSON 对象
let boundary;
try {
while ((boundary = buffer.indexOf("}\n")) !== -1) {
// 找到一个完整的 JSON 对象的边界
let jsonStr = buffer.substring(0, boundary + 1);
buffer = buffer.substring(boundary + 2);
console.log("jsonStr", jsonStr);
// console.log("jsonStr", jsonStr);

// 尝试解析 JSON 对象
try {
Expand Down

0 comments on commit 8508a35

Please sign in to comment.