feat: add ReferencePaperSelect node

This commit is contained in:
诺斯费拉图 2026-04-12 17:37:24 +08:00
parent 24d79c08e6
commit 6e94c13035
2 changed files with 61 additions and 1 deletions

View File

@ -11,7 +11,8 @@ class ResearchExtension(ComfyExtension):
from custom_nodes.research.claim_extract import PaperClaimExtract
from custom_nodes.research.evidence_assemble import ClaimEvidenceAssemble
from custom_nodes.research.style_profile import StyleProfileExtract
return [PaperSearch, PaperClaimExtract, ClaimEvidenceAssemble, StyleProfileExtract]
from custom_nodes.research.reference_paper_select import ReferencePaperSelect
return [PaperSearch, PaperClaimExtract, ClaimEvidenceAssemble, StyleProfileExtract, ReferencePaperSelect]
async def comfy_entrypoint() -> ComfyExtension:

View File

@ -0,0 +1,59 @@
"""ReferencePaperSelect node - select papers from project for canvas use."""
import json
from typing_extensions import override
from comfy_api.latest import ComfyNode, io
class ReferencePaperSelect(io.ComfyNode):
"""Select papers from a project to load onto the canvas for reference."""
@classmethod
def define_schema(cls) -> io.Schema:
return io.Schema(
node_id="ReferencePaperSelect",
display_name="Select Papers",
category="Research",
inputs=[
io.String.Input(
"project_id",
display_name="Project ID",
default="",
),
io.Int.Input(
"max_papers",
display_name="Max Papers",
default=5,
min=1,
max=20,
step=1,
),
],
outputs=[
io.String.Output(display_name="Selected Papers (JSON)"),
],
)
@classmethod
def execute(cls, project_id: str, max_papers: int) -> io.NodeOutput:
if not project_id.strip():
return io.NodeOutput(selected_papers=json.dumps([]))
# Phase 1: Returns mock data
# Phase 2+ would query the actual project papers from DB
return io.NodeOutput(selected_papers=json.dumps([
{
"paper_id": "mock-id-1",
"title": "Sample Paper 1",
"authors": ["Author A", "Author B"],
"abstract": "This is a sample abstract for demonstration.",
"year": "2024",
},
{
"paper_id": "mock-id-2",
"title": "Sample Paper 2",
"authors": ["Author C"],
"abstract": "Another sample abstract.",
"year": "2023",
}
][:max_papers], indent=2))