myagent-ai 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +30 -0
- package/README.md +333 -0
- package/agents/__init__.py +6 -0
- package/agents/__pycache__/main_agent.cpython-312.pyc +0 -0
- package/agents/base.py +115 -0
- package/agents/main_agent.py +695 -0
- package/agents/memory_agent.py +313 -0
- package/agents/tool_agent.py +248 -0
- package/chatbot/__init__.py +5 -0
- package/chatbot/base.py +124 -0
- package/chatbot/discord_bot.py +146 -0
- package/chatbot/feishu_bot.py +548 -0
- package/chatbot/manager.py +164 -0
- package/chatbot/qq_bot.py +189 -0
- package/chatbot/telegram_bot.py +167 -0
- package/chatbot/wechat_bot.py +558 -0
- package/communication/__init__.py +66 -0
- package/communication/channel.py +576 -0
- package/communication/crypto.py +347 -0
- package/communication/manager.py +397 -0
- package/communication/peer.py +156 -0
- package/config.py +464 -0
- package/core/__init__.py +10 -0
- package/core/config_broadcast.py +276 -0
- package/core/llm.py +878 -0
- package/core/logger.py +241 -0
- package/core/task_queue.py +362 -0
- package/core/utils.py +184 -0
- package/executor/__init__.py +4 -0
- package/executor/__pycache__/engine.cpython-312.pyc +0 -0
- package/executor/engine.py +1215 -0
- package/groups/__init__.py +15 -0
- package/groups/manager.py +724 -0
- package/knowledge/__init__.py +4 -0
- package/knowledge/rag.py +444 -0
- package/main.py +801 -0
- package/memory/__init__.py +4 -0
- package/memory/manager.py +840 -0
- package/organization/__init__.py +4 -0
- package/organization/manager.py +350 -0
- package/package.json +58 -0
- package/requirements.txt +59 -0
- package/setup.py +40 -0
- package/skills/ASR/LICENSE.txt +21 -0
- package/skills/ASR/SKILL.md +580 -0
- package/skills/ASR/scripts/asr.ts +27 -0
- package/skills/LLM/LICENSE.txt +21 -0
- package/skills/LLM/SKILL.md +856 -0
- package/skills/LLM/scripts/chat.ts +32 -0
- package/skills/TTS/LICENSE.txt +21 -0
- package/skills/TTS/SKILL.md +735 -0
- package/skills/TTS/tts.ts +25 -0
- package/skills/VLM/LICENSE.txt +21 -0
- package/skills/VLM/SKILL.md +588 -0
- package/skills/VLM/scripts/vlm.ts +57 -0
- package/skills/__init__.py +5 -0
- package/skills/agent-browser/SKILL.md +328 -0
- package/skills/ai-news-collectors/SKILL.md +157 -0
- package/skills/ai-news-collectors/_meta.json +6 -0
- package/skills/ai-news-collectors/references/sources.md +128 -0
- package/skills/aminer-open-academic/SKILL.md +312 -0
- package/skills/aminer-open-academic/_meta.json +6 -0
- package/skills/aminer-open-academic/evals/evals.json +46 -0
- package/skills/aminer-open-academic/references/api-catalog.md +1032 -0
- package/skills/aminer-open-academic/scripts/__pycache__/aminer_client.cpython-312.pyc +0 -0
- package/skills/aminer-open-academic/scripts/aminer_client.py +875 -0
- package/skills/auto-target-tracker/SKILL.md +317 -0
- package/skills/base.py +147 -0
- package/skills/blog-writer/2024-02-17-radical-transparency-sales.md +35 -0
- package/skills/blog-writer/2024-02-17-raycast-spotlight-superpowers.md +33 -0
- package/skills/blog-writer/2024-02-17-short-form-content-marketing.md +47 -0
- package/skills/blog-writer/2024-02-17-typing-speed-benefits.md +33 -0
- package/skills/blog-writer/2024-03-14-effective-ai-prompts.md +55 -0
- package/skills/blog-writer/2024-11-08-ai-revolutionizing-entry-level-sales.md +43 -0
- package/skills/blog-writer/2025-11-12-why-ai-art-is-useless.md +49 -0
- package/skills/blog-writer/README.md +2 -0
- package/skills/blog-writer/SKILL.md +158 -0
- package/skills/blog-writer/__pycache__/manage_examples.cpython-312.pyc +0 -0
- package/skills/blog-writer/_meta.json +6 -0
- package/skills/blog-writer/manage_examples.py +90 -0
- package/skills/blog-writer/style-guide.md +160 -0
- package/skills/browser_skill.py +146 -0
- package/skills/coding-agent/SKILL.md +120 -0
- package/skills/coding-agent/_meta.json +6 -0
- package/skills/coding-agent/criteria.md +48 -0
- package/skills/coding-agent/execution.md +42 -0
- package/skills/coding-agent/memory-template.md +38 -0
- package/skills/coding-agent/planning.md +31 -0
- package/skills/coding-agent/state.md +60 -0
- package/skills/coding-agent/verification.md +39 -0
- package/skills/content-strategy/SKILL.md +181 -0
- package/skills/content-strategy/_meta.json +6 -0
- package/skills/contentanalysis/ExtractWisdom/SKILL.md +229 -0
- package/skills/contentanalysis/ExtractWisdom/Workflows/Extract.md +60 -0
- package/skills/contentanalysis/SKILL.md +14 -0
- package/skills/docx/CHANGELOG.md +85 -0
- package/skills/docx/LICENSE.txt +30 -0
- package/skills/docx/SKILL.md +455 -0
- package/skills/docx/docx-js.md +681 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/docx/ooxml/scripts/__pycache__/pack.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/__pycache__/unpack.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/__pycache__/validate.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/pack.py +159 -0
- package/skills/docx/ooxml/scripts/unpack.py +29 -0
- package/skills/docx/ooxml/scripts/validate.py +69 -0
- package/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/base.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/docx.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/pptx.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/__pycache__/redlining.cpython-312.pyc +0 -0
- package/skills/docx/ooxml/scripts/validation/base.py +951 -0
- package/skills/docx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/docx/ooxml.md +615 -0
- package/skills/docx/scripts/__init__.py +1 -0
- package/skills/docx/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/docx/scripts/__pycache__/add_toc_placeholders.cpython-312.pyc +0 -0
- package/skills/docx/scripts/__pycache__/document.cpython-312.pyc +0 -0
- package/skills/docx/scripts/__pycache__/utilities.cpython-312.pyc +0 -0
- package/skills/docx/scripts/add_toc_placeholders.py +220 -0
- package/skills/docx/scripts/document.py +1302 -0
- package/skills/docx/scripts/templates/comments.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/skills/docx/scripts/templates/people.xml +3 -0
- package/skills/docx/scripts/utilities.py +374 -0
- package/skills/dream-interpreter/SKILL.md +88 -0
- package/skills/dream-interpreter/assets/example_asset.txt +24 -0
- package/skills/dream-interpreter/references/api_reference.md +34 -0
- package/skills/dream-interpreter/references/interpretation-guide.md +83 -0
- package/skills/dream-interpreter/references/output-schema.md +65 -0
- package/skills/dream-interpreter/references/questioning-strategy.md +62 -0
- package/skills/dream-interpreter/references/visual-mapping.md +81 -0
- package/skills/dream-interpreter/scripts/__pycache__/example.cpython-312.pyc +0 -0
- package/skills/dream-interpreter/scripts/example.py +19 -0
- package/skills/dream-interpreter/skill.json +7 -0
- package/skills/file_skill.py +246 -0
- package/skills/finance/Finance_API_Doc.md +445 -0
- package/skills/finance/SKILL.md +53 -0
- package/skills/fullstack-dev/SKILL.md +205 -0
- package/skills/get-fortune-analysis/SKILL.md +370 -0
- package/skills/get-fortune-analysis/lunar_python.py +91 -0
- package/skills/gift-evaluator/SKILL.md +83 -0
- package/skills/gift-evaluator/__pycache__/html_tools.cpython-312.pyc +0 -0
- package/skills/gift-evaluator/html_tools.py +268 -0
- package/skills/image-edit/LICENSE.txt +21 -0
- package/skills/image-edit/SKILL.md +896 -0
- package/skills/image-edit/scripts/image-edit.ts +36 -0
- package/skills/image-generation/LICENSE.txt +21 -0
- package/skills/image-generation/SKILL.md +583 -0
- package/skills/image-generation/scripts/image-generation.ts +28 -0
- package/skills/image-understand/LICENSE.txt +21 -0
- package/skills/image-understand/SKILL.md +855 -0
- package/skills/image-understand/scripts/image-understand.ts +41 -0
- package/skills/interview-designer/README.md +70 -0
- package/skills/interview-designer/SKILL.md +53 -0
- package/skills/interview-designer/_meta.json +6 -0
- package/skills/interview-designer/references/design_rationale.md +43 -0
- package/skills/interview-designer/templates/interview_guide_template.md +62 -0
- package/skills/market-research-reports/SKILL.md +901 -0
- package/skills/market-research-reports/assets/FORMATTING_GUIDE.md +428 -0
- package/skills/market-research-reports/assets/market_report_template.tex +1380 -0
- package/skills/market-research-reports/assets/market_research.sty +564 -0
- package/skills/market-research-reports/references/data_analysis_patterns.md +548 -0
- package/skills/market-research-reports/references/report_structure_guide.md +999 -0
- package/skills/market-research-reports/references/visual_generation_guide.md +1077 -0
- package/skills/market-research-reports/scripts/__pycache__/generate_market_visuals.cpython-312.pyc +0 -0
- package/skills/market-research-reports/scripts/generate_market_visuals.py +529 -0
- package/skills/marketing-mode/README.md +49 -0
- package/skills/marketing-mode/SKILL.md +693 -0
- package/skills/marketing-mode/_meta.json +6 -0
- package/skills/marketing-mode/mode-prompt.md +39 -0
- package/skills/marketing-mode/skill.json +51 -0
- package/skills/mindfulness-meditation/SKILL.md +65 -0
- package/skills/mindfulness-meditation/_meta.json +6 -0
- package/skills/multi-search-engine/CHANGELOG.md +15 -0
- package/skills/multi-search-engine/CHANNELLOG.md +48 -0
- package/skills/multi-search-engine/SKILL.md +78 -0
- package/skills/multi-search-engine/_meta.json +6 -0
- package/skills/multi-search-engine/config.json +14 -0
- package/skills/multi-search-engine/metadata.json +7 -0
- package/skills/multi-search-engine/references/international-search.md +651 -0
- package/skills/pdf/LICENSE.txt +30 -0
- package/skills/pdf/SKILL.md +1534 -0
- package/skills/pdf/forms.md +205 -0
- package/skills/pdf/reference.md +765 -0
- package/skills/pdf/scripts/__pycache__/add_zai_metadata.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/check_bounding_boxes.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/check_bounding_boxes_test.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/check_fillable_fields.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/convert_pdf_to_images.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/create_validation_image.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/extract_form_field_info.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/fill_fillable_fields.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/fill_pdf_form_with_annotations.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/__pycache__/sanitize_code.cpython-312.pyc +0 -0
- package/skills/pdf/scripts/add_zai_metadata.py +172 -0
- package/skills/pdf/scripts/check_bounding_boxes.py +70 -0
- package/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/skills/pdf/scripts/check_fillable_fields.py +12 -0
- package/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/skills/pdf/scripts/create_validation_image.py +41 -0
- package/skills/pdf/scripts/extract_form_field_info.py +152 -0
- package/skills/pdf/scripts/fill_fillable_fields.py +114 -0
- package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/skills/pdf/scripts/sanitize_code.py +110 -0
- package/skills/podcast-generate/LICENSE.txt +21 -0
- package/skills/podcast-generate/SKILL.md +198 -0
- package/skills/podcast-generate/generate.ts +661 -0
- package/skills/podcast-generate/package.json +30 -0
- package/skills/podcast-generate/readme.md +177 -0
- package/skills/podcast-generate/test_data/segments.jsonl +3 -0
- package/skills/podcast-generate/tsconfig.json +26 -0
- package/skills/pptx/LICENSE.txt +30 -0
- package/skills/pptx/SKILL.md +507 -0
- package/skills/pptx/html2pptx.md +625 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/pptx/ooxml/scripts/__pycache__/pack.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/__pycache__/unpack.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/__pycache__/validate.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/pack.py +159 -0
- package/skills/pptx/ooxml/scripts/unpack.py +29 -0
- package/skills/pptx/ooxml/scripts/validate.py +69 -0
- package/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/base.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/docx.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/pptx.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/__pycache__/redlining.cpython-312.pyc +0 -0
- package/skills/pptx/ooxml/scripts/validation/base.py +951 -0
- package/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/pptx/ooxml.md +427 -0
- package/skills/pptx/scripts/__pycache__/inventory.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/inventory.cpython-313.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/rearrange.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/replace.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/__pycache__/thumbnail.cpython-312.pyc +0 -0
- package/skills/pptx/scripts/html2pptx.js +1044 -0
- package/skills/pptx/scripts/inventory.py +1020 -0
- package/skills/pptx/scripts/rearrange.py +231 -0
- package/skills/pptx/scripts/replace.py +385 -0
- package/skills/pptx/scripts/thumbnail.py +450 -0
- package/skills/qingyan-research/SKILL.md +294 -0
- package/skills/qingyan-research/__pycache__/generate_html.cpython-312.pyc +0 -0
- package/skills/qingyan-research/generate_html.py +33 -0
- package/skills/registry.py +344 -0
- package/skills/search_skill.py +228 -0
- package/skills/seo-content-writer/SKILL.md +661 -0
- package/skills/seo-content-writer/_meta.json +6 -0
- package/skills/seo-content-writer/references/content-structure-templates.md +875 -0
- package/skills/seo-content-writer/references/title-formulas.md +339 -0
- package/skills/skill-creator/LICENSE.txt +202 -0
- package/skills/skill-creator/SKILL.md +485 -0
- package/skills/skill-creator/agents/analyzer.md +274 -0
- package/skills/skill-creator/agents/comparator.md +202 -0
- package/skills/skill-creator/agents/grader.md +223 -0
- package/skills/skill-creator/assets/eval_review.html +146 -0
- package/skills/skill-creator/eval-viewer/__pycache__/generate_review.cpython-312.pyc +0 -0
- package/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/skills/skill-creator/references/schemas.md +430 -0
- package/skills/skill-creator/scripts/__init__.py +0 -0
- package/skills/skill-creator/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/aggregate_benchmark.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/generate_report.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/improve_description.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/package_skill.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/quick_validate.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/run_eval.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/run_loop.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/__pycache__/utils.cpython-312.pyc +0 -0
- package/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/skills/skill-creator/scripts/generate_report.py +326 -0
- package/skills/skill-creator/scripts/improve_description.py +236 -0
- package/skills/skill-creator/scripts/package_skill.py +136 -0
- package/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/skills/skill-creator/scripts/run_eval.py +310 -0
- package/skills/skill-creator/scripts/run_loop.py +328 -0
- package/skills/skill-creator/scripts/utils.py +47 -0
- package/skills/skill-finder-cn/SKILL.md +66 -0
- package/skills/skill-finder-cn/_meta.json +6 -0
- package/skills/skill-finder-cn/package.json +5 -0
- package/skills/skill-finder-cn/scripts/search.sh +15 -0
- package/skills/skill-vetter/SKILL.md +137 -0
- package/skills/stock-analysis-skill/SKILL.md +156 -0
- package/skills/stock-analysis-skill/package.json +21 -0
- package/skills/stock-analysis-skill/src/analyzer.ts +264 -0
- package/skills/stock-analysis-skill/src/dataFetcher.ts +130 -0
- package/skills/stock-analysis-skill/src/dividend.ts +226 -0
- package/skills/stock-analysis-skill/src/index.ts +327 -0
- package/skills/stock-analysis-skill/src/rumorScanner.ts +200 -0
- package/skills/stock-analysis-skill/src/types.ts +167 -0
- package/skills/stock-analysis-skill/src/watchlist.ts +292 -0
- package/skills/stock-analysis-skill/tsconfig.json +15 -0
- package/skills/storyboard-manager/SKILL.md +532 -0
- package/skills/storyboard-manager/index.js +9 -0
- package/skills/storyboard-manager/package.json +11 -0
- package/skills/storyboard-manager/references/character_development.md +232 -0
- package/skills/storyboard-manager/references/story_structures.md +148 -0
- package/skills/storyboard-manager/scripts/__pycache__/consistency_checker.cpython-312.pyc +0 -0
- package/skills/storyboard-manager/scripts/__pycache__/timeline_tracker.cpython-312.pyc +0 -0
- package/skills/storyboard-manager/scripts/consistency_checker.py +391 -0
- package/skills/storyboard-manager/scripts/timeline_tracker.py +352 -0
- package/skills/system_skill.py +249 -0
- package/skills/ui-ux-pro-max/SKILL.md +43 -0
- package/skills/ui-ux-pro-max/_meta.json +6 -0
- package/skills/ui-ux-pro-max/assets/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/assets/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/assets/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/assets/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/assets/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/assets/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/assets/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/assets/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/assets/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/assets/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/assets/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/assets/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/references/upstream-README.md +488 -0
- package/skills/ui-ux-pro-max/references/upstream-skill-content.md +288 -0
- package/skills/ui-ux-pro-max/scripts/__init__.py +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/search.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +1071 -0
- package/skills/ui-ux-pro-max/scripts/search.py +111 -0
- package/skills/video-generation/LICENSE.txt +21 -0
- package/skills/video-generation/SKILL.md +1082 -0
- package/skills/video-generation/scripts/video.ts +168 -0
- package/skills/video-understand/LICENSE.txt +21 -0
- package/skills/video-understand/SKILL.md +916 -0
- package/skills/video-understand/scripts/video-understand.ts +41 -0
- package/skills/visual-design-foundations/SKILL.md +318 -0
- package/skills/visual-design-foundations/references/color-systems.md +417 -0
- package/skills/visual-design-foundations/references/spacing-iconography.md +425 -0
- package/skills/visual-design-foundations/references/typography-systems.md +432 -0
- package/skills/web-reader/LICENSE.txt +21 -0
- package/skills/web-reader/SKILL.md +1140 -0
- package/skills/web-reader/scripts/web-reader.ts +37 -0
- package/skills/web-search/LICENSE.txt +21 -0
- package/skills/web-search/SKILL.md +912 -0
- package/skills/web-search/scripts/web_search.ts +44 -0
- package/skills/web-shader-extractor/SKILL.md +145 -0
- package/skills/web-shader-extractor/references/config-extraction.md +50 -0
- package/skills/web-shader-extractor/references/encoded-definitions.md +53 -0
- package/skills/web-shader-extractor/references/extraction-workflow.md +61 -0
- package/skills/web-shader-extractor/references/porting-strategy.md +164 -0
- package/skills/web-shader-extractor/references/shader-injection.md +126 -0
- package/skills/web-shader-extractor/references/shaders-com.md +190 -0
- package/skills/web-shader-extractor/references/tech-signatures.md +54 -0
- package/skills/web-shader-extractor/references/tsl-extraction.md +41 -0
- package/skills/web-shader-extractor/references/unicorn-studio.md +353 -0
- package/skills/web-shader-extractor/scripts/fetch-rendered-dom.mjs +153 -0
- package/skills/web-shader-extractor/scripts/scan-bundle.sh +76 -0
- package/skills/writing-plans/SKILL.md +116 -0
- package/skills/writing-plans/_meta.json +6 -0
- package/skills/xlsx/LICENSE.txt +30 -0
- package/skills/xlsx/SKILL.md +496 -0
- package/skills/xlsx/__pycache__/recalc.cpython-312.pyc +0 -0
- package/skills/xlsx/recalc.py +178 -0
- package/start.sh +36 -0
- package/web/__init__.py +1 -0
- package/web/__pycache__/api_server.cpython-312.pyc +0 -0
- package/web/api_server.py +2043 -0
- package/web/ui/chat.html +3235 -0
- package/web/ui/index.html +458 -0
|
@@ -0,0 +1,875 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
AMiner 开放平台 API 客户端
|
|
4
|
+
支持 6 大学术数据查询工作流及全部 28 个独立 API
|
|
5
|
+
|
|
6
|
+
使用方法:
|
|
7
|
+
python aminer_client.py --token <TOKEN> --action <ACTION> [选项]
|
|
8
|
+
|
|
9
|
+
工作流:
|
|
10
|
+
scholar_profile 学者全景分析(搜索→详情+画像+论文+专利+项目)
|
|
11
|
+
paper_deep_dive 论文深度挖掘(搜索→详情+引用链)
|
|
12
|
+
org_analysis 机构研究力分析(消歧→详情+学者+论文+专利)
|
|
13
|
+
venue_papers 期刊论文监控(搜索→详情+按年份论文)
|
|
14
|
+
paper_qa 学术智能问答(AI驱动关键词搜索)
|
|
15
|
+
patent_search 专利搜索与详情
|
|
16
|
+
scholar_patents 通过学者名获取其所有专利详情
|
|
17
|
+
|
|
18
|
+
直接调用单个 API:
|
|
19
|
+
raw 直接调用任意 API,需指定 --api 和 --params
|
|
20
|
+
|
|
21
|
+
控制台(生成Token):https://open.aminer.cn/open/board?tab=control
|
|
22
|
+
文档:https://open.aminer.cn/open/doc
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
import argparse
|
|
26
|
+
import json
|
|
27
|
+
import sys
|
|
28
|
+
import time
|
|
29
|
+
import random
|
|
30
|
+
import urllib.request
|
|
31
|
+
import urllib.error
|
|
32
|
+
import urllib.parse
|
|
33
|
+
from typing import Any, Optional
|
|
34
|
+
|
|
35
|
+
BASE_URL = "https://datacenter.aminer.cn/gateway/open_platform"
|
|
36
|
+
|
|
37
|
+
TEST_TOKEN = "" # 请前往 https://open.aminer.cn/open/board?tab=control 生成你自己的 Token
|
|
38
|
+
|
|
39
|
+
REQUEST_TIMEOUT_SECONDS = 30
|
|
40
|
+
MAX_RETRIES = 3
|
|
41
|
+
RETRYABLE_HTTP_STATUS = {408, 429, 500, 502, 503, 504}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
45
|
+
# 核心 HTTP 工具
|
|
46
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
47
|
+
|
|
48
|
+
def _request(token: str, method: str, path: str,
|
|
49
|
+
params: Optional[dict] = None,
|
|
50
|
+
body: Optional[dict] = None) -> Any:
|
|
51
|
+
"""发送 HTTP 请求并返回解析后的 JSON 数据(含重试)。"""
|
|
52
|
+
url = BASE_URL + path
|
|
53
|
+
headers = {
|
|
54
|
+
"Authorization": token,
|
|
55
|
+
"Content-Type": "application/json;charset=utf-8",
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if method.upper() == "GET" and params:
|
|
59
|
+
query = urllib.parse.urlencode(
|
|
60
|
+
{k: (json.dumps(v) if isinstance(v, (list, dict)) else v)
|
|
61
|
+
for k, v in params.items() if v is not None}
|
|
62
|
+
)
|
|
63
|
+
url = f"{url}?{query}"
|
|
64
|
+
|
|
65
|
+
data = json.dumps(body).encode("utf-8") if body else None
|
|
66
|
+
req = urllib.request.Request(url, data=data, headers=headers, method=method.upper())
|
|
67
|
+
|
|
68
|
+
for attempt in range(1, MAX_RETRIES + 1):
|
|
69
|
+
try:
|
|
70
|
+
with urllib.request.urlopen(req, timeout=REQUEST_TIMEOUT_SECONDS) as resp:
|
|
71
|
+
raw = resp.read().decode("utf-8")
|
|
72
|
+
return json.loads(raw)
|
|
73
|
+
except urllib.error.HTTPError as e:
|
|
74
|
+
body_bytes = e.read()
|
|
75
|
+
try:
|
|
76
|
+
err = json.loads(body_bytes)
|
|
77
|
+
except Exception:
|
|
78
|
+
err = body_bytes.decode("utf-8", errors="replace")
|
|
79
|
+
retryable = e.code in RETRYABLE_HTTP_STATUS
|
|
80
|
+
print(f"[HTTP {e.code}] {e.reason}: {err}", file=sys.stderr)
|
|
81
|
+
if retryable and attempt < MAX_RETRIES:
|
|
82
|
+
backoff = (2 ** (attempt - 1)) + random.uniform(0, 0.3)
|
|
83
|
+
print(f"[重试] attempt={attempt}/{MAX_RETRIES} wait={backoff:.2f}s", file=sys.stderr)
|
|
84
|
+
time.sleep(backoff)
|
|
85
|
+
continue
|
|
86
|
+
return {
|
|
87
|
+
"code": e.code,
|
|
88
|
+
"success": False,
|
|
89
|
+
"msg": str(e.reason),
|
|
90
|
+
"error": err,
|
|
91
|
+
"retryable": retryable,
|
|
92
|
+
}
|
|
93
|
+
except urllib.error.URLError as e:
|
|
94
|
+
reason = str(getattr(e, "reason", e))
|
|
95
|
+
print(f"[请求失败] {reason}", file=sys.stderr)
|
|
96
|
+
if attempt < MAX_RETRIES:
|
|
97
|
+
backoff = (2 ** (attempt - 1)) + random.uniform(0, 0.3)
|
|
98
|
+
print(f"[重试] attempt={attempt}/{MAX_RETRIES} wait={backoff:.2f}s", file=sys.stderr)
|
|
99
|
+
time.sleep(backoff)
|
|
100
|
+
continue
|
|
101
|
+
return {
|
|
102
|
+
"code": -1,
|
|
103
|
+
"success": False,
|
|
104
|
+
"msg": "network_error",
|
|
105
|
+
"error": reason,
|
|
106
|
+
"retryable": True,
|
|
107
|
+
}
|
|
108
|
+
except TimeoutError as e:
|
|
109
|
+
print(f"[请求超时] {e}", file=sys.stderr)
|
|
110
|
+
if attempt < MAX_RETRIES:
|
|
111
|
+
backoff = (2 ** (attempt - 1)) + random.uniform(0, 0.3)
|
|
112
|
+
print(f"[重试] attempt={attempt}/{MAX_RETRIES} wait={backoff:.2f}s", file=sys.stderr)
|
|
113
|
+
time.sleep(backoff)
|
|
114
|
+
continue
|
|
115
|
+
return {
|
|
116
|
+
"code": -1,
|
|
117
|
+
"success": False,
|
|
118
|
+
"msg": "timeout",
|
|
119
|
+
"error": str(e),
|
|
120
|
+
"retryable": True,
|
|
121
|
+
}
|
|
122
|
+
except Exception as e:
|
|
123
|
+
print(f"[请求失败] {e}", file=sys.stderr)
|
|
124
|
+
return {
|
|
125
|
+
"code": -1,
|
|
126
|
+
"success": False,
|
|
127
|
+
"msg": "unknown_error",
|
|
128
|
+
"error": str(e),
|
|
129
|
+
"retryable": False,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
"code": -1,
|
|
134
|
+
"success": False,
|
|
135
|
+
"msg": "request_failed",
|
|
136
|
+
"error": "max retries exceeded",
|
|
137
|
+
"retryable": True,
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _print(data: Any) -> None:
|
|
142
|
+
"""格式化打印 JSON 结果。"""
|
|
143
|
+
print(json.dumps(data, ensure_ascii=False, indent=2))
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
147
|
+
# 论文类 API
|
|
148
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
149
|
+
|
|
150
|
+
def paper_search(token: str, title: str, page: int = 0, size: int = 10) -> Any:
|
|
151
|
+
"""论文搜索(免费):根据标题搜索,返回 ID/标题/DOI。"""
|
|
152
|
+
return _request(token, "GET", "/api/paper/search",
|
|
153
|
+
params={"title": title, "page": page, "size": size})
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def paper_search_pro(token: str, title: str = None, keyword: str = None,
|
|
157
|
+
abstract: str = None, author: str = None,
|
|
158
|
+
org: str = None, venue: str = None,
|
|
159
|
+
order: str = None, page: int = 0, size: int = 10) -> Any:
|
|
160
|
+
"""论文搜索 pro(¥0.01/次):多条件搜索。"""
|
|
161
|
+
params = {"page": page, "size": size}
|
|
162
|
+
for k, v in [("title", title), ("keyword", keyword), ("abstract", abstract),
|
|
163
|
+
("author", author), ("org", org), ("venue", venue), ("order", order)]:
|
|
164
|
+
if v is not None:
|
|
165
|
+
params[k] = v
|
|
166
|
+
return _request(token, "GET", "/api/paper/search/pro", params=params)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def paper_qa_search(token: str, query: str = None,
|
|
170
|
+
use_topic: bool = False,
|
|
171
|
+
topic_high: str = None, topic_middle: str = None, topic_low: str = None,
|
|
172
|
+
title: list = None, doi: str = None, year: list = None,
|
|
173
|
+
sci_flag: bool = False, n_citation_flag: bool = False,
|
|
174
|
+
force_citation_sort: bool = False, force_year_sort: bool = False,
|
|
175
|
+
author_terms: list = None, org_terms: list = None,
|
|
176
|
+
size: int = 10, offset: int = 0) -> Any:
|
|
177
|
+
"""论文问答搜索(¥0.05/次):AI 智能问答,支持自然语言和结构化关键词。"""
|
|
178
|
+
body: dict = {"use_topic": use_topic, "size": size, "offset": offset}
|
|
179
|
+
if query:
|
|
180
|
+
body["query"] = query
|
|
181
|
+
if topic_high:
|
|
182
|
+
body["topic_high"] = topic_high
|
|
183
|
+
if topic_middle:
|
|
184
|
+
body["topic_middle"] = topic_middle
|
|
185
|
+
if topic_low:
|
|
186
|
+
body["topic_low"] = topic_low
|
|
187
|
+
if title:
|
|
188
|
+
body["title"] = title
|
|
189
|
+
if doi:
|
|
190
|
+
body["doi"] = doi
|
|
191
|
+
if year:
|
|
192
|
+
body["year"] = year
|
|
193
|
+
if sci_flag:
|
|
194
|
+
body["sci_flag"] = True
|
|
195
|
+
if n_citation_flag:
|
|
196
|
+
body["n_citation_flag"] = True
|
|
197
|
+
if force_citation_sort:
|
|
198
|
+
body["force_citation_sort"] = True
|
|
199
|
+
if force_year_sort:
|
|
200
|
+
body["force_year_sort"] = True
|
|
201
|
+
if author_terms:
|
|
202
|
+
body["author_terms"] = author_terms
|
|
203
|
+
if org_terms:
|
|
204
|
+
body["org_terms"] = org_terms
|
|
205
|
+
return _request(token, "POST", "/api/paper/qa/search", body=body)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def paper_info(token: str, ids: list) -> Any:
|
|
209
|
+
"""论文信息(免费):批量根据 ID 获取基础信息。"""
|
|
210
|
+
return _request(token, "POST", "/api/paper/info", body={"ids": ids})
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def paper_detail(token: str, paper_id: str) -> Any:
|
|
214
|
+
"""论文详情(¥0.01/次):获取完整论文信息。"""
|
|
215
|
+
return _request(token, "GET", "/api/paper/detail", params={"id": paper_id})
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def paper_relation(token: str, paper_id: str) -> Any:
|
|
219
|
+
"""论文引用(¥0.10/次):获取该论文引用的其他论文。"""
|
|
220
|
+
return _request(token, "GET", "/api/paper/relation", params={"id": paper_id})
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def paper_list_by_search_venue(token: str, keyword: str = None, venue: str = None,
|
|
224
|
+
author: str = None, order: str = None,
|
|
225
|
+
page: int = 0, size: int = 10) -> Any:
|
|
226
|
+
"""论文综合搜索(¥0.30/次):通过关键词/期刊/作者获取完整论文信息。"""
|
|
227
|
+
params = {"page": page, "size": size}
|
|
228
|
+
for k, v in [("keyword", keyword), ("venue", venue), ("author", author), ("order", order)]:
|
|
229
|
+
if v is not None:
|
|
230
|
+
params[k] = v
|
|
231
|
+
return _request(token, "GET", "/api/paper/list/by/search/venue", params=params)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def paper_list_by_keywords(token: str, keywords: list, page: int = 0, size: int = 10) -> Any:
|
|
235
|
+
"""论文批量查询(¥0.10/次):多关键词获取论文摘要等信息。"""
|
|
236
|
+
params = {"page": page, "size": size, "keywords": json.dumps(keywords, ensure_ascii=False)}
|
|
237
|
+
return _request(token, "GET", "/api/paper/list/citation/by/keywords", params=params)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def paper_detail_by_condition(token: str, year: int, venue_id: str = None) -> Any:
|
|
241
|
+
"""按年份与期刊获取论文详情(¥0.20/次):year 与 venue_id 须同时传入,仅传 year 返回 null。"""
|
|
242
|
+
params: dict = {"year": year}
|
|
243
|
+
if venue_id:
|
|
244
|
+
params["venue_id"] = venue_id
|
|
245
|
+
return _request(token, "GET",
|
|
246
|
+
"/api/paper/platform/allpubs/more/detail/by/ts/org/venue",
|
|
247
|
+
params=params)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
251
|
+
# 学者类 API
|
|
252
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
253
|
+
|
|
254
|
+
def person_search(token: str, name: str = None, org: str = None,
|
|
255
|
+
org_id: list = None, offset: int = 0, size: int = 5) -> Any:
|
|
256
|
+
"""学者搜索(免费):根据姓名/机构搜索学者。"""
|
|
257
|
+
body: dict = {"offset": offset, "size": size}
|
|
258
|
+
if name:
|
|
259
|
+
body["name"] = name
|
|
260
|
+
if org:
|
|
261
|
+
body["org"] = org
|
|
262
|
+
if org_id:
|
|
263
|
+
body["org_id"] = org_id
|
|
264
|
+
return _request(token, "POST", "/api/person/search", body=body)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def person_detail(token: str, person_id: str) -> Any:
|
|
268
|
+
"""学者详情(¥1.00/次):获取完整个人信息。"""
|
|
269
|
+
return _request(token, "GET", "/api/person/detail", params={"id": person_id})
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def person_figure(token: str, person_id: str) -> Any:
|
|
273
|
+
"""学者画像(¥0.50/次):获取研究兴趣、领域及结构化经历。"""
|
|
274
|
+
return _request(token, "GET", "/api/person/figure", params={"id": person_id})
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def person_paper_relation(token: str, person_id: str) -> Any:
|
|
278
|
+
"""学者论文(¥1.50/次):获取学者发表的论文列表。"""
|
|
279
|
+
return _request(token, "GET", "/api/person/paper/relation", params={"id": person_id})
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def person_patent_relation(token: str, person_id: str) -> Any:
|
|
283
|
+
"""学者专利(¥1.50/次):获取学者的专利列表。"""
|
|
284
|
+
return _request(token, "GET", "/api/person/patent/relation", params={"id": person_id})
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def person_project(token: str, person_id: str) -> Any:
|
|
288
|
+
"""学者项目(¥3.00/次):获取科研项目(资助金额/时间/来源)。"""
|
|
289
|
+
return _request(token, "GET", "/api/project/person/v3/open", params={"id": person_id})
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
293
|
+
# 机构类 API
|
|
294
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
295
|
+
|
|
296
|
+
def org_search(token: str, orgs: list) -> Any:
|
|
297
|
+
"""机构搜索(免费):根据名称关键词搜索机构。"""
|
|
298
|
+
return _request(token, "POST", "/api/organization/search", body={"orgs": orgs})
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def org_detail(token: str, ids: list) -> Any:
|
|
302
|
+
"""机构详情(¥0.01/次):根据机构 ID 获取详情。"""
|
|
303
|
+
return _request(token, "POST", "/api/organization/detail", body={"ids": ids})
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def org_person_relation(token: str, org_id: str, offset: int = 0) -> Any:
|
|
307
|
+
"""机构学者(¥0.50/次):获取机构下的学者列表(每次 10 条)。"""
|
|
308
|
+
return _request(token, "GET", "/api/organization/person/relation",
|
|
309
|
+
params={"org_id": org_id, "offset": offset})
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def org_paper_relation(token: str, org_id: str, offset: int = 0) -> Any:
|
|
313
|
+
"""机构论文(¥0.10/次):获取机构学者发表的论文列表(每次 10 条)。"""
|
|
314
|
+
return _request(token, "GET", "/api/organization/paper/relation",
|
|
315
|
+
params={"org_id": org_id, "offset": offset})
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def org_patent_relation(token: str, org_id: str,
|
|
319
|
+
page: int = 1, page_size: int = 100) -> Any:
|
|
320
|
+
"""机构专利(¥0.10/次):获取机构拥有的专利列表,支持分页(page_size 最大 10000)。"""
|
|
321
|
+
return _request(token, "GET", "/api/organization/patent/relation",
|
|
322
|
+
params={"id": org_id, "page": page, "page_size": page_size})
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def org_disambiguate(token: str, org: str) -> Any:
|
|
326
|
+
"""机构消歧(¥0.01/次):获取机构标准化名称。"""
|
|
327
|
+
return _request(token, "POST", "/api/organization/na", body={"org": org})
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
def org_disambiguate_pro(token: str, org: str) -> Any:
|
|
331
|
+
"""机构消歧 pro(¥0.05/次):提取一级和二级机构 ID。"""
|
|
332
|
+
return _request(token, "POST", "/api/organization/na/pro", body={"org": org})
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
336
|
+
# 期刊类 API
|
|
337
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
338
|
+
|
|
339
|
+
def venue_search(token: str, name: str) -> Any:
|
|
340
|
+
"""期刊搜索(免费):根据名称搜索期刊 ID 和标准名称。"""
|
|
341
|
+
return _request(token, "POST", "/api/venue/search", body={"name": name})
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def venue_detail(token: str, venue_id: str) -> Any:
|
|
345
|
+
"""期刊详情(¥0.20/次):获取 ISSN、简称、类型等。"""
|
|
346
|
+
return _request(token, "POST", "/api/venue/detail", body={"id": venue_id})
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
def venue_paper_relation(token: str, venue_id: str, offset: int = 0,
|
|
350
|
+
limit: int = 20, year: Optional[int] = None) -> Any:
|
|
351
|
+
"""期刊论文(¥0.10/次):获取期刊论文列表(支持按年份筛选)。"""
|
|
352
|
+
body: dict = {"id": venue_id, "offset": offset, "limit": limit}
|
|
353
|
+
if year is not None:
|
|
354
|
+
body["year"] = year
|
|
355
|
+
return _request(token, "POST", "/api/venue/paper/relation", body=body)
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
359
|
+
# 专利类 API
|
|
360
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
361
|
+
|
|
362
|
+
def patent_search(token: str, query: str, page: int = 0, size: int = 10) -> Any:
|
|
363
|
+
"""专利搜索(免费):根据名称/关键词搜索专利。"""
|
|
364
|
+
return _request(token, "POST", "/api/patent/search",
|
|
365
|
+
body={"query": query, "page": page, "size": size})
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
def patent_info(token: str, patent_id: str) -> Any:
|
|
369
|
+
"""专利信息(免费):获取专利基础信息(标题/专利号/发明人)。"""
|
|
370
|
+
return _request(token, "GET", "/api/patent/info", params={"id": patent_id})
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
def patent_detail(token: str, patent_id: str) -> Any:
|
|
374
|
+
"""专利详情(¥0.01/次):获取完整专利信息(摘要/申请日/IPC等)。"""
|
|
375
|
+
return _request(token, "GET", "/api/patent/detail", params={"id": patent_id})
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
379
|
+
# 组合工作流
|
|
380
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
381
|
+
|
|
382
|
+
def workflow_scholar_profile(token: str, name: str) -> dict:
|
|
383
|
+
"""
|
|
384
|
+
工作流 1:学者全景分析
|
|
385
|
+
搜索学者 → 详情 + 画像 + 论文 + 专利 + 项目
|
|
386
|
+
"""
|
|
387
|
+
print(f"[1/6] 搜索学者:{name}", file=sys.stderr)
|
|
388
|
+
search_result = person_search(token, name=name, size=5)
|
|
389
|
+
if not search_result or not search_result.get("data"):
|
|
390
|
+
return {"error": f"未找到学者:{name}"}
|
|
391
|
+
|
|
392
|
+
candidates = search_result["data"]
|
|
393
|
+
scholar = candidates[0]
|
|
394
|
+
person_id = scholar.get("id") or scholar.get("_id")
|
|
395
|
+
print(f" 找到:{scholar.get('name')} ({scholar.get('org')}),ID={person_id}", file=sys.stderr)
|
|
396
|
+
|
|
397
|
+
result = {
|
|
398
|
+
"source_api_chain": [
|
|
399
|
+
"person_search",
|
|
400
|
+
"person_detail",
|
|
401
|
+
"person_figure",
|
|
402
|
+
"person_paper_relation",
|
|
403
|
+
"person_patent_relation",
|
|
404
|
+
"person_project",
|
|
405
|
+
],
|
|
406
|
+
"search_candidates": candidates[:3],
|
|
407
|
+
"selected": {
|
|
408
|
+
"id": person_id,
|
|
409
|
+
"name": scholar.get("name"),
|
|
410
|
+
"name_zh": scholar.get("name_zh"),
|
|
411
|
+
"org": scholar.get("org"),
|
|
412
|
+
"interests": scholar.get("interests"),
|
|
413
|
+
"n_citation": scholar.get("n_citation"),
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
print("[2/6] 获取学者详情...", file=sys.stderr)
|
|
418
|
+
detail = person_detail(token, person_id)
|
|
419
|
+
if detail and detail.get("data"):
|
|
420
|
+
result["detail"] = detail["data"]
|
|
421
|
+
|
|
422
|
+
print("[3/6] 获取学者画像...", file=sys.stderr)
|
|
423
|
+
figure = person_figure(token, person_id)
|
|
424
|
+
if figure and figure.get("data"):
|
|
425
|
+
result["figure"] = figure["data"]
|
|
426
|
+
|
|
427
|
+
print("[4/6] 获取学者论文...", file=sys.stderr)
|
|
428
|
+
papers = person_paper_relation(token, person_id)
|
|
429
|
+
if papers and papers.get("data"):
|
|
430
|
+
result["papers"] = papers["data"][:20]
|
|
431
|
+
result["papers_total"] = papers.get("total", len(papers["data"]))
|
|
432
|
+
|
|
433
|
+
print("[5/6] 获取学者专利...", file=sys.stderr)
|
|
434
|
+
patents = person_patent_relation(token, person_id)
|
|
435
|
+
if patents and patents.get("data"):
|
|
436
|
+
result["patents"] = patents["data"][:10]
|
|
437
|
+
|
|
438
|
+
print("[6/6] 获取学者项目...", file=sys.stderr)
|
|
439
|
+
projects = person_project(token, person_id)
|
|
440
|
+
if projects and projects.get("data"):
|
|
441
|
+
result["projects"] = projects["data"][:10]
|
|
442
|
+
|
|
443
|
+
return result
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
def workflow_paper_deep_dive(token: str, title: str = None, keyword: str = None,
|
|
447
|
+
author: str = None, order: str = "n_citation") -> dict:
|
|
448
|
+
"""
|
|
449
|
+
工作流 2:论文深度挖掘
|
|
450
|
+
搜索论文 → 详情 + 引用链 + 引用论文基础信息
|
|
451
|
+
"""
|
|
452
|
+
print(f"[1/4] 搜索论文:title={title}, keyword={keyword}", file=sys.stderr)
|
|
453
|
+
if keyword or author:
|
|
454
|
+
search_result = paper_search_pro(token, title=title, keyword=keyword,
|
|
455
|
+
author=author, order=order, size=5)
|
|
456
|
+
search_api = "paper_search_pro"
|
|
457
|
+
else:
|
|
458
|
+
search_result = paper_search(token, title=title or keyword, size=5)
|
|
459
|
+
search_api = "paper_search"
|
|
460
|
+
if not search_result or not search_result.get("data"):
|
|
461
|
+
# 标题检索无结果时,降级到 pro 检索,提高召回率
|
|
462
|
+
print(" 标题检索无结果,降级到 paper_search_pro...", file=sys.stderr)
|
|
463
|
+
search_result = paper_search_pro(token, title=title, keyword=title,
|
|
464
|
+
author=author, order=order, size=5)
|
|
465
|
+
search_api = "paper_search_pro(fallback)"
|
|
466
|
+
|
|
467
|
+
if not search_result or not search_result.get("data"):
|
|
468
|
+
return {"error": "未找到相关论文"}
|
|
469
|
+
|
|
470
|
+
papers = search_result["data"]
|
|
471
|
+
top_paper = papers[0]
|
|
472
|
+
paper_id = top_paper.get("id") or top_paper.get("_id")
|
|
473
|
+
print(f" 找到:{top_paper.get('title')[:60]},ID={paper_id}", file=sys.stderr)
|
|
474
|
+
|
|
475
|
+
result = {
|
|
476
|
+
"source_api_chain": [
|
|
477
|
+
search_api,
|
|
478
|
+
"paper_detail",
|
|
479
|
+
"paper_relation",
|
|
480
|
+
"paper_info",
|
|
481
|
+
],
|
|
482
|
+
"search_candidates": papers[:5],
|
|
483
|
+
"selected_id": paper_id,
|
|
484
|
+
"selected_title": top_paper.get("title"),
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
print("[2/4] 获取论文详情...", file=sys.stderr)
|
|
488
|
+
detail = paper_detail(token, paper_id)
|
|
489
|
+
if detail and detail.get("data"):
|
|
490
|
+
result["detail"] = detail["data"]
|
|
491
|
+
|
|
492
|
+
print("[3/4] 获取引用关系...", file=sys.stderr)
|
|
493
|
+
relation = paper_relation(token, paper_id)
|
|
494
|
+
if relation and relation.get("data"):
|
|
495
|
+
# data 结构:[{"_id": "<paper_id>", "cited": [{...}, ...]}]
|
|
496
|
+
# 外层数组是以论文为单位的包装,真正的引用列表在 cited 字段里
|
|
497
|
+
all_cited = []
|
|
498
|
+
for item in relation["data"]:
|
|
499
|
+
all_cited.extend(item.get("cited") or [])
|
|
500
|
+
result["citations_count"] = len(all_cited)
|
|
501
|
+
result["citations_preview"] = all_cited[:10]
|
|
502
|
+
|
|
503
|
+
# 批量获取被引论文基础信息
|
|
504
|
+
cited_ids = [c.get("_id") or c.get("id") for c in all_cited[:20]
|
|
505
|
+
if c.get("_id") or c.get("id")]
|
|
506
|
+
if cited_ids:
|
|
507
|
+
print(f"[4/4] 批量获取 {len(cited_ids)} 篇被引论文信息...", file=sys.stderr)
|
|
508
|
+
info = paper_info(token, cited_ids)
|
|
509
|
+
if info and info.get("data"):
|
|
510
|
+
result["cited_papers_info"] = info["data"]
|
|
511
|
+
else:
|
|
512
|
+
print("[4/4] 跳过(无被引 ID)", file=sys.stderr)
|
|
513
|
+
else:
|
|
514
|
+
print("[4/4] 跳过(无引用数据)", file=sys.stderr)
|
|
515
|
+
|
|
516
|
+
return result
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
def workflow_org_analysis(token: str, org: str) -> dict:
|
|
520
|
+
"""
|
|
521
|
+
工作流 3:机构研究力分析
|
|
522
|
+
机构消歧 pro → 详情 + 学者 + 论文 + 专利
|
|
523
|
+
"""
|
|
524
|
+
print(f"[1/5] 机构消歧:{org}", file=sys.stderr)
|
|
525
|
+
disamb = org_disambiguate_pro(token, org)
|
|
526
|
+
org_id = None
|
|
527
|
+
|
|
528
|
+
if disamb and disamb.get("data"):
|
|
529
|
+
data = disamb["data"]
|
|
530
|
+
if isinstance(data, list) and data:
|
|
531
|
+
first = data[0]
|
|
532
|
+
org_id = first.get("一级ID") or first.get("二级ID")
|
|
533
|
+
elif isinstance(data, dict):
|
|
534
|
+
org_id = data.get("一级ID") or data.get("二级ID")
|
|
535
|
+
|
|
536
|
+
if not org_id:
|
|
537
|
+
print(" 消歧 pro 未返回 ID,尝试机构搜索...", file=sys.stderr)
|
|
538
|
+
search_r = org_search(token, [org])
|
|
539
|
+
if search_r and search_r.get("data"):
|
|
540
|
+
orgs = search_r["data"]
|
|
541
|
+
org_id = orgs[0].get("org_id") if orgs else None
|
|
542
|
+
|
|
543
|
+
if not org_id:
|
|
544
|
+
return {"error": f"无法找到机构 ID:{org}"}
|
|
545
|
+
|
|
546
|
+
print(f" 机构 ID:{org_id}", file=sys.stderr)
|
|
547
|
+
result = {
|
|
548
|
+
"source_api_chain": [
|
|
549
|
+
"org_disambiguate_pro",
|
|
550
|
+
"org_detail",
|
|
551
|
+
"org_person_relation",
|
|
552
|
+
"org_paper_relation",
|
|
553
|
+
"org_patent_relation",
|
|
554
|
+
],
|
|
555
|
+
"org_query": org,
|
|
556
|
+
"org_id": org_id,
|
|
557
|
+
"disambiguate": disamb,
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
print("[2/5] 获取机构详情...", file=sys.stderr)
|
|
561
|
+
detail = org_detail(token, [org_id])
|
|
562
|
+
if detail and detail.get("data"):
|
|
563
|
+
result["detail"] = detail["data"]
|
|
564
|
+
|
|
565
|
+
print("[3/5] 获取机构学者(前10位)...", file=sys.stderr)
|
|
566
|
+
scholars = org_person_relation(token, org_id, offset=0)
|
|
567
|
+
if scholars and scholars.get("data"):
|
|
568
|
+
result["scholars"] = scholars["data"]
|
|
569
|
+
result["scholars_total"] = scholars.get("total", len(scholars["data"]))
|
|
570
|
+
|
|
571
|
+
print("[4/5] 获取机构论文(前10篇)...", file=sys.stderr)
|
|
572
|
+
papers = org_paper_relation(token, org_id, offset=0)
|
|
573
|
+
if papers and papers.get("data"):
|
|
574
|
+
result["papers"] = papers["data"]
|
|
575
|
+
result["papers_total"] = papers.get("total", len(papers["data"]))
|
|
576
|
+
|
|
577
|
+
print("[5/5] 获取机构专利(最多100条)...", file=sys.stderr)
|
|
578
|
+
patents = org_patent_relation(token, org_id, page=1, page_size=100)
|
|
579
|
+
if patents and patents.get("data"):
|
|
580
|
+
result["patents"] = patents["data"]
|
|
581
|
+
result["patents_total"] = patents.get("total", len(patents["data"]))
|
|
582
|
+
|
|
583
|
+
return result
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
def workflow_venue_papers(token: str, venue: str, year: Optional[int] = None,
|
|
587
|
+
limit: int = 20) -> dict:
|
|
588
|
+
"""
|
|
589
|
+
工作流 4:期刊论文监控
|
|
590
|
+
期刊搜索 → 期刊详情 + 按年份获取论文列表
|
|
591
|
+
"""
|
|
592
|
+
print(f"[1/3] 搜索期刊:{venue}", file=sys.stderr)
|
|
593
|
+
search_result = venue_search(token, venue)
|
|
594
|
+
if not search_result or not search_result.get("data"):
|
|
595
|
+
return {"error": f"未找到期刊:{venue}"}
|
|
596
|
+
|
|
597
|
+
venues = search_result["data"]
|
|
598
|
+
top_venue = venues[0]
|
|
599
|
+
venue_id = top_venue.get("id")
|
|
600
|
+
print(f" 找到:{top_venue.get('name_en')},ID={venue_id}", file=sys.stderr)
|
|
601
|
+
result = {
|
|
602
|
+
"source_api_chain": [
|
|
603
|
+
"venue_search",
|
|
604
|
+
"venue_detail",
|
|
605
|
+
"venue_paper_relation",
|
|
606
|
+
],
|
|
607
|
+
"search_candidates": venues[:3],
|
|
608
|
+
"venue_id": venue_id,
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
print("[2/3] 获取期刊详情...", file=sys.stderr)
|
|
612
|
+
detail = venue_detail(token, venue_id)
|
|
613
|
+
if detail and detail.get("data"):
|
|
614
|
+
result["venue_detail"] = detail["data"]
|
|
615
|
+
|
|
616
|
+
print(f"[3/3] 获取期刊论文(year={year}, limit={limit})...", file=sys.stderr)
|
|
617
|
+
papers = venue_paper_relation(token, venue_id, year=year, limit=limit)
|
|
618
|
+
if papers and papers.get("data"):
|
|
619
|
+
result["papers"] = papers["data"]
|
|
620
|
+
result["papers_total"] = papers.get("total", len(papers["data"]))
|
|
621
|
+
|
|
622
|
+
return result
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
def workflow_paper_qa(token: str, query: str = None,
|
|
626
|
+
topic_high: str = None, topic_middle: str = None,
|
|
627
|
+
sci_flag: bool = False, sort_citation: bool = False,
|
|
628
|
+
size: int = 10) -> dict:
|
|
629
|
+
"""
|
|
630
|
+
工作流 5:学术智能问答
|
|
631
|
+
使用 AI 驱动的论文问答搜索接口
|
|
632
|
+
"""
|
|
633
|
+
use_topic = topic_high is not None
|
|
634
|
+
print(f"[1/1] 学术问答搜索:query={query}, use_topic={use_topic}", file=sys.stderr)
|
|
635
|
+
qa_result = paper_qa_search(
|
|
636
|
+
token, query=query, use_topic=use_topic,
|
|
637
|
+
topic_high=topic_high, topic_middle=topic_middle,
|
|
638
|
+
sci_flag=sci_flag, force_citation_sort=sort_citation,
|
|
639
|
+
size=size
|
|
640
|
+
)
|
|
641
|
+
if qa_result and qa_result.get("code") == 200 and qa_result.get("data"):
|
|
642
|
+
qa_result["source_api_chain"] = ["paper_qa_search"]
|
|
643
|
+
qa_result["route"] = "paper_qa_search"
|
|
644
|
+
return qa_result
|
|
645
|
+
|
|
646
|
+
# query 模式无结果时,回退到 pro 检索
|
|
647
|
+
if query:
|
|
648
|
+
print(" paper_qa_search 无结果,降级到 paper_search_pro...", file=sys.stderr)
|
|
649
|
+
fallback = paper_search_pro(token, keyword=query, order="n_citation", size=size)
|
|
650
|
+
data = (fallback or {}).get("data") or []
|
|
651
|
+
return {
|
|
652
|
+
"code": 200 if data else (qa_result or {}).get("code", -1),
|
|
653
|
+
"success": bool(data),
|
|
654
|
+
"msg": "" if data else "no data",
|
|
655
|
+
"data": data,
|
|
656
|
+
"total": (fallback or {}).get("total", len(data)),
|
|
657
|
+
"route": "paper_qa_search -> paper_search_pro",
|
|
658
|
+
"source_api_chain": ["paper_qa_search", "paper_search_pro"],
|
|
659
|
+
"primary_result": qa_result,
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
if isinstance(qa_result, dict):
|
|
663
|
+
qa_result["source_api_chain"] = ["paper_qa_search"]
|
|
664
|
+
qa_result["route"] = "paper_qa_search"
|
|
665
|
+
return qa_result
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
def workflow_patent_search(token: str, query: str, page: int = 0, size: int = 10) -> dict:
|
|
669
|
+
"""
|
|
670
|
+
工作流 6:专利搜索与详情
|
|
671
|
+
专利搜索 → 获取每条专利的详情
|
|
672
|
+
"""
|
|
673
|
+
print(f"[1/2] 搜索专利:{query}", file=sys.stderr)
|
|
674
|
+
search_result = patent_search(token, query, page=page, size=size)
|
|
675
|
+
if not search_result or not search_result.get("data"):
|
|
676
|
+
return {"error": f"未找到专利:{query}"}
|
|
677
|
+
|
|
678
|
+
patents = search_result["data"]
|
|
679
|
+
result = {
|
|
680
|
+
"source_api_chain": ["patent_search", "patent_detail"],
|
|
681
|
+
"search_results": patents,
|
|
682
|
+
"total": len(patents),
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
print(f"[2/2] 获取前 {min(3, len(patents))} 条专利详情...", file=sys.stderr)
|
|
686
|
+
details = []
|
|
687
|
+
for p in patents[:3]:
|
|
688
|
+
pid = p.get("id")
|
|
689
|
+
if pid:
|
|
690
|
+
d = patent_detail(token, pid)
|
|
691
|
+
if d and d.get("data"):
|
|
692
|
+
details.append(d["data"])
|
|
693
|
+
result["details"] = details
|
|
694
|
+
return result
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
def workflow_scholar_patents(token: str, name: str) -> dict:
|
|
698
|
+
"""
|
|
699
|
+
通过学者名获取其专利列表 + 每条专利详情
|
|
700
|
+
"""
|
|
701
|
+
print(f"[1/3] 搜索学者:{name}", file=sys.stderr)
|
|
702
|
+
search_result = person_search(token, name=name, size=3)
|
|
703
|
+
if not search_result or not search_result.get("data"):
|
|
704
|
+
return {"error": f"未找到学者:{name}"}
|
|
705
|
+
|
|
706
|
+
scholar = search_result["data"][0]
|
|
707
|
+
person_id = scholar.get("id")
|
|
708
|
+
print(f" 找到:{scholar.get('name')},ID={person_id}", file=sys.stderr)
|
|
709
|
+
result = {"scholar": scholar}
|
|
710
|
+
|
|
711
|
+
print("[2/3] 获取学者专利列表...", file=sys.stderr)
|
|
712
|
+
patents = person_patent_relation(token, person_id)
|
|
713
|
+
if not patents or not patents.get("data"):
|
|
714
|
+
return {**result, "patents": [], "error": "该学者无专利数据"}
|
|
715
|
+
patent_list = patents["data"]
|
|
716
|
+
result["patents_list"] = patent_list
|
|
717
|
+
|
|
718
|
+
print(f"[3/3] 获取前 {min(3, len(patent_list))} 条专利详情...", file=sys.stderr)
|
|
719
|
+
details = []
|
|
720
|
+
for p in patent_list[:3]:
|
|
721
|
+
pid = p.get("patent_id")
|
|
722
|
+
if pid:
|
|
723
|
+
d = patent_detail(token, pid)
|
|
724
|
+
if d and d.get("data"):
|
|
725
|
+
details.append(d["data"])
|
|
726
|
+
result["patent_details"] = details
|
|
727
|
+
return result
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
731
|
+
# 命令行入口
|
|
732
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
733
|
+
|
|
734
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
735
|
+
p = argparse.ArgumentParser(
|
|
736
|
+
description="AMiner 开放平台学术数据查询客户端",
|
|
737
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
738
|
+
epilog="""
|
|
739
|
+
示例:
|
|
740
|
+
# 学者全景分析
|
|
741
|
+
python aminer_client.py --token <TOKEN> --action scholar_profile --name "Andrew Ng"
|
|
742
|
+
|
|
743
|
+
# 论文深度挖掘
|
|
744
|
+
python aminer_client.py --token <TOKEN> --action paper_deep_dive --title "BERT"
|
|
745
|
+
python aminer_client.py --token <TOKEN> --action paper_deep_dive --keyword "large language model" --author "Hinton"
|
|
746
|
+
|
|
747
|
+
# 机构研究力分析
|
|
748
|
+
python aminer_client.py --token <TOKEN> --action org_analysis --org "Tsinghua University"
|
|
749
|
+
|
|
750
|
+
# 期刊论文监控
|
|
751
|
+
python aminer_client.py --token <TOKEN> --action venue_papers --venue "NeurIPS" --year 2023
|
|
752
|
+
|
|
753
|
+
# 学术智能问答
|
|
754
|
+
python aminer_client.py --token <TOKEN> --action paper_qa --query "蛋白质结构深度学习"
|
|
755
|
+
python aminer_client.py --token <TOKEN> --action paper_qa \\
|
|
756
|
+
--topic_high '[["transformer","self-attention"],["protein folding"]]' \\
|
|
757
|
+
--sci_flag --sort_citation
|
|
758
|
+
|
|
759
|
+
# 专利搜索
|
|
760
|
+
python aminer_client.py --token <TOKEN> --action patent_search --query "量子计算芯片"
|
|
761
|
+
|
|
762
|
+
# 学者专利
|
|
763
|
+
python aminer_client.py --token <TOKEN> --action scholar_patents --name "张首晟"
|
|
764
|
+
|
|
765
|
+
# 直接调用单个 API
|
|
766
|
+
python aminer_client.py --token <TOKEN> --action raw \\
|
|
767
|
+
--api paper_search --params '{"title":"BERT","page":0,"size":5}'
|
|
768
|
+
|
|
769
|
+
控制台(生成Token):https://open.aminer.cn/open/board?tab=control
|
|
770
|
+
文档:https://open.aminer.cn/open/doc
|
|
771
|
+
"""
|
|
772
|
+
)
|
|
773
|
+
p.add_argument("--token", default=TEST_TOKEN,
|
|
774
|
+
help="AMiner API Token(前往 https://open.aminer.cn/open/board?tab=control 生成)")
|
|
775
|
+
p.add_argument("--action", required=True,
|
|
776
|
+
choices=["scholar_profile", "paper_deep_dive", "org_analysis",
|
|
777
|
+
"venue_papers", "paper_qa", "patent_search",
|
|
778
|
+
"scholar_patents", "raw"],
|
|
779
|
+
help="执行的操作")
|
|
780
|
+
|
|
781
|
+
# 通用参数
|
|
782
|
+
p.add_argument("--name", help="学者姓名")
|
|
783
|
+
p.add_argument("--title", help="论文标题")
|
|
784
|
+
p.add_argument("--keyword", help="关键词")
|
|
785
|
+
p.add_argument("--author", help="作者名")
|
|
786
|
+
p.add_argument("--org", help="机构名称")
|
|
787
|
+
p.add_argument("--venue", help="期刊名称")
|
|
788
|
+
p.add_argument("--query", help="查询字符串(自然语言问答或专利搜索)")
|
|
789
|
+
p.add_argument("--year", type=int, help="年份筛选")
|
|
790
|
+
p.add_argument("--size", type=int, default=10, help="返回条数")
|
|
791
|
+
p.add_argument("--page", type=int, default=0, help="页码")
|
|
792
|
+
p.add_argument("--page_size", type=int, default=100,
|
|
793
|
+
help="机构专利分页条数(最大 10000)")
|
|
794
|
+
p.add_argument("--order", default="n_citation",
|
|
795
|
+
choices=["n_citation", "year"], help="排序方式")
|
|
796
|
+
|
|
797
|
+
# 论文问答专用
|
|
798
|
+
p.add_argument("--topic_high", help="必须匹配的关键词数组(JSON字符串,外层AND内层OR)")
|
|
799
|
+
p.add_argument("--topic_middle", help="大幅加分关键词(格式同 topic_high)")
|
|
800
|
+
p.add_argument("--sci_flag", action="store_true", help="只返回 SCI 论文")
|
|
801
|
+
p.add_argument("--sort_citation", action="store_true", help="按引用量排序")
|
|
802
|
+
|
|
803
|
+
# raw 模式
|
|
804
|
+
p.add_argument("--api", help="[raw模式] API 函数名,如 paper_search")
|
|
805
|
+
p.add_argument("--params", help="[raw模式] JSON 格式的参数字典")
|
|
806
|
+
|
|
807
|
+
return p
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
def main():
|
|
811
|
+
parser = build_parser()
|
|
812
|
+
args = parser.parse_args()
|
|
813
|
+
token = args.token
|
|
814
|
+
|
|
815
|
+
if args.action == "scholar_profile":
|
|
816
|
+
if not args.name:
|
|
817
|
+
parser.error("--action scholar_profile 需要 --name 参数")
|
|
818
|
+
result = workflow_scholar_profile(token, args.name)
|
|
819
|
+
|
|
820
|
+
elif args.action == "paper_deep_dive":
|
|
821
|
+
if not args.title and not args.keyword:
|
|
822
|
+
parser.error("--action paper_deep_dive 需要 --title 或 --keyword 参数")
|
|
823
|
+
result = workflow_paper_deep_dive(
|
|
824
|
+
token, title=args.title, keyword=args.keyword,
|
|
825
|
+
author=args.author, order=args.order
|
|
826
|
+
)
|
|
827
|
+
|
|
828
|
+
elif args.action == "org_analysis":
|
|
829
|
+
if not args.org:
|
|
830
|
+
parser.error("--action org_analysis 需要 --org 参数")
|
|
831
|
+
result = workflow_org_analysis(token, args.org)
|
|
832
|
+
|
|
833
|
+
elif args.action == "venue_papers":
|
|
834
|
+
if not args.venue:
|
|
835
|
+
parser.error("--action venue_papers 需要 --venue 参数")
|
|
836
|
+
result = workflow_venue_papers(token, args.venue, year=args.year, limit=args.size)
|
|
837
|
+
|
|
838
|
+
elif args.action == "paper_qa":
|
|
839
|
+
if not args.query and not args.topic_high:
|
|
840
|
+
parser.error("--action paper_qa 需要 --query 或 --topic_high 参数")
|
|
841
|
+
result = workflow_paper_qa(
|
|
842
|
+
token, query=args.query,
|
|
843
|
+
topic_high=args.topic_high, topic_middle=args.topic_middle,
|
|
844
|
+
sci_flag=args.sci_flag, sort_citation=args.sort_citation,
|
|
845
|
+
size=args.size
|
|
846
|
+
)
|
|
847
|
+
|
|
848
|
+
elif args.action == "patent_search":
|
|
849
|
+
if not args.query:
|
|
850
|
+
parser.error("--action patent_search 需要 --query 参数")
|
|
851
|
+
result = workflow_patent_search(token, args.query, page=args.page, size=args.size)
|
|
852
|
+
|
|
853
|
+
elif args.action == "scholar_patents":
|
|
854
|
+
if not args.name:
|
|
855
|
+
parser.error("--action scholar_patents 需要 --name 参数")
|
|
856
|
+
result = workflow_scholar_patents(token, args.name)
|
|
857
|
+
|
|
858
|
+
elif args.action == "raw":
|
|
859
|
+
if not args.api:
|
|
860
|
+
parser.error("--action raw 需要 --api 参数(API 函数名)")
|
|
861
|
+
fn = globals().get(args.api)
|
|
862
|
+
if fn is None or not callable(fn):
|
|
863
|
+
parser.error(f"未找到 API 函数:{args.api}。可用函数请查看源码。")
|
|
864
|
+
kwargs = json.loads(args.params) if args.params else {}
|
|
865
|
+
result = fn(token, **kwargs)
|
|
866
|
+
|
|
867
|
+
else:
|
|
868
|
+
parser.print_help()
|
|
869
|
+
sys.exit(1)
|
|
870
|
+
|
|
871
|
+
_print(result)
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
if __name__ == "__main__":
|
|
875
|
+
main()
|