建议提交信息:

docs: 修订 AA 论文文字与格式,更新 .gitignore 并整理项目结构

  - 修正 AA54562-25.tex 中的拼写错误和零宽字符
  - 统一数学符号格式,去除段落多余前导空格和换行
  - 更新 .gitignore 忽略 ADS 输出文件和 AI 工具目录
This commit is contained in:
fengmengqi
2026-05-25 18:05:27 +08:00
parent 845c0ac815
commit 0663091691
26 changed files with 6013 additions and 13 deletions
+32
View File
@@ -0,0 +1,32 @@
---
name: ads_metadata_search
description: "用于在 ADS 中搜索天体物理文献,提取元数据信息。当用户要求搜索天文论文、查找作者、查看论文引用情况、查询 Bibcode,或者想了解某篇特定天体物理文献的信息时,务必触发并使用本技能(哪怕用户没有明确提到 ADS)。注意:如果用户明确要求下载全文 PDF 或 HTML,请不要使用本技能(应转用 downloader 技能)。"
---
# ADS Metadata Search (ADS 文献元数据搜索)
本技能利用 ADS API 搜索关于天文学、天体物理学、物理学的文献,提取特定的字段信息(如作者、标题、年份、Bibcode、摘要、被引数等)。**注意:它不会下载文献的 PDF 或 HTML,只提取元数据。如果你需要下载文献全文包,请使用 `ads_literature_downloader`。**
## 运行方式
由于查询通过命令行参数直接获取较困难(尤其是复杂的 query 字符串),我们通过内部包含的 Python 脚本 `scripts/search.py` 完成。
你可以通过执行该脚本来工作:
```bash
python c:\Users\fmq\Documents\astro\Article\.agents\skills\ads_metadata_search\scripts\search.py \
--query "author:\"Hawking, S.\"" \
--output "results.json" \
--rows 10
```
### 参数选项
- `--query`: ADS查询语法字符串 (例如: `author:"Smith, J." year:2020``orcid:0000-0001-xxxx-xxxx`)
- `--output`: 结果保存到的 JSON 文件路径
- `--rows`: 返回的条目数量(默认 10)。如果你需要大量数据,可以增加到 50, 100 等。如果您只需要一条精准记录,可以设置为 1。
- `--year_range`: 年份区间,例如 `2018-2023``2020`
### 脚本输出
脚本不仅会将详细元数据如 `bibcode`, `title`, `author`, `year`, `abstract`, `citation_count`, `reference_count` 写入 `output` 的 JSON 文件,还会在终端输出摘要预览,方便你进行查看。
拿到信息以后,如有必要,可以调用下载能力技能或者向用户继续询问后续需要分析什么。
@@ -0,0 +1,66 @@
import ads
import json
import argparse
import sys
# 如果你没有在环境变量里设置 ADS_DEV_KEY,将使用以下的硬编码 Token
ads.config.token = "dpJWki7eHJ48TwlKz2AUyhXAxBgZrKo6AjE8hZwp"
def main():
parser = argparse.ArgumentParser(description="Search ADS and return metadata")
parser.add_argument("--query", required=True, help="ADS Search Query")
parser.add_argument("--output", required=True, help="Output JSON file path")
parser.add_argument("--rows", type=int, default=10, help="Number of rows to return")
parser.add_argument("--year_range", help="Year range to filter, e.g. 2018-2023 or 2020")
args = parser.parse_args()
print(f"Searching ADS for query: {args.query}")
query_params = {
"q": args.query,
"rows": args.rows,
"fl": ["bibcode", "title", "author", "year", "abstract", "citation_count", "reference_count", "pub", "doi"]
}
if args.year_range:
if '-' in args.year_range:
start_year, end_year = args.year_range.split('-')
query_params["fq"] = f"year:[{start_year} TO {end_year}]"
else:
query_params["fq"] = f"year:{args.year_range}"
try:
papers = list(ads.SearchQuery(**query_params))
results = []
for p in papers:
record = {
"bibcode": getattr(p, "bibcode", "") or "",
"title": getattr(p, "title", [""])[0] if getattr(p, "title", None) else "",
"author": getattr(p, "author", []),
"year": getattr(p, "year", "") or "",
"abstract": getattr(p, "abstract", "") or "",
"citation_count": getattr(p, "citation_count", 0) or 0,
"reference_count": getattr(p, "reference_count", 0) or 0,
"pub": getattr(p, "pub", "") or "",
"doi": getattr(p, "doi", [""])[0] if getattr(p, "doi", None) else ""
}
results.append(record)
with open(args.output, "w", encoding="utf-8") as f:
json.dump(results, f, ensure_ascii=False, indent=2)
print(f"Found {len(results)} papers. Saved metadata to {args.output}.")
# 打印简单摘要到终端
for i, r in enumerate(results[:5]):
print(f"\n[{i+1}] {r['title']} ({r['year']})")
print(f" Bibcode: {r['bibcode']} | Citations: {r['citation_count']}")
authors = ", ".join(r['author'][:3]) + (" et al." if len(r['author']) > 3 else "")
print(f" Authors: {authors}")
except Exception as e:
print(f"Query Failed: {e}")
sys.exit(1)
if __name__ == "__main__":
main()