feat(reader): add async article summary jobs
This commit is contained in:
@@ -20,6 +20,11 @@ from summary_mcp.runtime import get_run_status as load_run_status
|
||||
from summary_mcp.runtime import get_run_report as load_run_report
|
||||
from summary_mcp.runtime import list_run_artifacts as load_run_artifacts
|
||||
from summary_mcp.runtime import list_runs as load_runs
|
||||
from summary_mcp.runtime.article_summary_jobs import (
|
||||
get_article_summary_job_result as load_article_summary_job_result,
|
||||
get_article_summary_job_status as load_article_summary_job_status,
|
||||
start_article_summary_job as launch_article_summary_job,
|
||||
)
|
||||
from summary_mcp.runtime.resume_service import resume_run as resume_existing_run
|
||||
from summary_mcp.workflows import run_freshrss_pipeline
|
||||
from summary_mcp.workflows.article_summary import ArticleSummaryConfig, summarize_selected_articles
|
||||
@@ -164,6 +169,42 @@ def resume_run(run_id: str) -> dict:
|
||||
"""Resume a failed or interrupted FreshRSS workflow run from its latest supported recovery point."""
|
||||
return resume_existing_run(run_id=run_id)
|
||||
|
||||
@mcp.tool()
|
||||
def start_article_summary_job(
|
||||
*,
|
||||
extracted_path: str,
|
||||
selected_ids: list[str],
|
||||
output_dir: str | None = None,
|
||||
max_retries: int = 2,
|
||||
timeout_seconds: float = 120.0,
|
||||
llm_api_key: str | None = None,
|
||||
llm_model: str | None = None,
|
||||
llm_api_url: str | None = None,
|
||||
) -> dict:
|
||||
"""Start an asynchronous article-summary job and return a job_id immediately."""
|
||||
return launch_article_summary_job(
|
||||
extracted_path=Path(extracted_path),
|
||||
selected_ids=selected_ids,
|
||||
output_dir=Path(output_dir) if output_dir else None,
|
||||
max_retries=max_retries,
|
||||
timeout_seconds=timeout_seconds,
|
||||
llm_api_key=llm_api_key,
|
||||
llm_model=llm_model,
|
||||
llm_api_url=llm_api_url,
|
||||
)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def get_article_summary_job_status(job_id: str) -> dict:
|
||||
"""Get the current status of an asynchronous article-summary job."""
|
||||
return load_article_summary_job_status(job_id=job_id)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def get_article_summary_job_result(job_id: str) -> dict:
|
||||
"""Get the final result of an asynchronous article-summary job."""
|
||||
return load_article_summary_job_result(job_id=job_id)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def generate_article_summaries(
|
||||
|
||||
Reference in New Issue
Block a user