代码拉取完成,页面将自动刷新
# This template is specifically for importing/sharing, using better
# notes 'import from clipboard': copy the content and
# goto Zotero menu bar, click Edit->New Template from Clipboard.
# Do not copy-paste this to better notes template editor directly.
name: "[text] Outline Summary"
content: |-
// @use-markdown
// @author Polygon
// @link https://gitee.com/zotero-chinese/zotero-magic-for-user/blob/master/outline-summary.yaml
// @warning 自动解析文献的基本结构并分部分总结
${{
// ✍️可修改[0]为[1]
sharedObj.by = ["Magic", "Grobid"][0]
// ✍️可修改"简体中文"为"其它语言"
sharedObj.language = "简体中文"
sharedObj.itemID = targetNoteItem ? (await targetNoteItem.parentItem.getBestAttachment()).id: undefined;
sharedObj.setGPTText = async (text) => {
const window = Zotero.getMainWindow()
await window.Meet.Global.views.show()
window.Meet.Global.views.inputContainer.querySelector("input").value = text
}
sharedObj.getBasicInfo = async () => {
return await Zotero.ZoteroMagic.api.paperSummary.getBasicInfo(sharedObj.by, sharedObj.itemID)
}
sharedObj.getSectionInfo = async (keywords) => {
return await Zotero.ZoteroMagic.api.paperSummary.getSectionInfo(keywords, sharedObj.by, sharedObj.itemID)
}
sharedObj.setGPTSystemMsg = () => {
const window = Zotero.getMainWindow()
window.Meet.Global.views.messages = [
{
"role": "system",
"content": "You are a researcher in the field of [___studyField___] who is good at summarizing papers using concise statements"
}
]
}
sharedObj.getGPTResponseText = async (question) => {
if (_env.dryRun) {return "GPT回答内容"}
const window = Zotero.getMainWindow()
return await window.Meet.Global.views.execText(question)
}
return `# Magic Zotero Outline Summary大纲总结\n⏰创建时间:${new Date().toLocaleString()}`
}}$
${{
const outline = {}
const getOutline = (outline, levels) => {
levels.forEach(level => {
if (!outline[level]) {
outline[level] = {text: ""}
}
outline = outline[level]
})
return outline
}
await Zotero.ZoteroMagic.api.paperSummary.PDFParserInstance.process(
async (paragraph, levels) => {
let _outline = getOutline(outline, levels)
_outline.text += (paragraph.text + "\n")
},
sharedObj.itemID
)
const window = Zotero.getMainWindow()
window.console.log(outline)
let result = ""
for (let key in outline) {
window.console.log(key)
sharedObj.setGPTSystemMsg()
await sharedObj.setGPTText(`正在总结[${key}]...`)
result +=
await sharedObj.getGPTResponseText(`
按照下面要求:
- 用精炼的语言,适当的排版,总结本段文字内容;
- 善用MD语言,你正处于MD文档环境中;
- 每个部分不要超过200字;
- 保留子标题,标题按照## xxx的md语法分级显示,但也要进行翻译;
- 适当使用emoj,丰富输出结果;
- 善用md语法,尽可能分要点;
- 语言一定要精炼,不要单纯重复原文;
- 直接输出总结结果,不要表现出总结二字,你只是对原文的转述;
- 文字如果过长请注意分段;
- 除了专有名词,所有输出文字请转化为${sharedObj.language};
你要总结的内容是:
${JSON.stringify(outline[key])}
`)
result += "\n\n"
}
return result
}}$
${{
const window = Zotero.getMainWindow()
window.Meet.Global.views.hide()
let model = window.Meet.Connector ? window.Meet.Connector.AI : Zotero.Prefs.get("extensions.zotero.zoterogpt.model", true);
targetNoteItem.setTags([{tag: "🤖大纲总结"},{ tag: `🤖${model}`}]);
await targetNoteItem.saveTx();
return ""
}}$
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。