mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-08 08:12:34 +08:00
feat: add ReferencePaperSelect node
This commit is contained in:
parent
24d79c08e6
commit
6e94c13035
@ -11,7 +11,8 @@ class ResearchExtension(ComfyExtension):
|
|||||||
from custom_nodes.research.claim_extract import PaperClaimExtract
|
from custom_nodes.research.claim_extract import PaperClaimExtract
|
||||||
from custom_nodes.research.evidence_assemble import ClaimEvidenceAssemble
|
from custom_nodes.research.evidence_assemble import ClaimEvidenceAssemble
|
||||||
from custom_nodes.research.style_profile import StyleProfileExtract
|
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:
|
async def comfy_entrypoint() -> ComfyExtension:
|
||||||
|
|||||||
59
custom_nodes/research/reference_paper_select.py
Normal file
59
custom_nodes/research/reference_paper_select.py
Normal 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))
|
||||||
Loading…
Reference in New Issue
Block a user