init repo
This commit is contained in:
64
test_pipeline.py
Normal file
64
test_pipeline.py
Normal file
@@ -0,0 +1,64 @@
|
||||
"""Quick test — full domain-aware bilingual pipeline."""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from app.graph.state import ReportState
|
||||
from app.pipeline.orchestrator import PipelineOrchestrator
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s [%(name)s] %(levelname)s: %(message)s",
|
||||
)
|
||||
|
||||
|
||||
async def main():
|
||||
state = ReportState(
|
||||
requirement="分析全球半导体行业2025年发展趋势,重点关注:1)全球供应链重构(美日欧中各自布局),2)中国半导体自主化进展与瓶颈,3)AI芯片竞争格局,4)投资建议",
|
||||
report_type="行业分析报告",
|
||||
output_formats=["docx"],
|
||||
output_languages=["zh", "en"], # bilingual output
|
||||
)
|
||||
|
||||
print(f"[test] Task ID: {state.id}")
|
||||
print(f"[test] Requirement: {state.requirement[:80]}...")
|
||||
print(f"[test] Languages: {state.output_languages}")
|
||||
print()
|
||||
|
||||
orchestrator = PipelineOrchestrator()
|
||||
state = await orchestrator.run(state)
|
||||
|
||||
print()
|
||||
print(f"[test] Final node: {state.current_node}")
|
||||
print(f"[test] Error: {state.error or 'None'}")
|
||||
print(f"[test] Revisions: {state.revision_count}")
|
||||
print()
|
||||
|
||||
# Execution trace
|
||||
print("[test] Execution trace:")
|
||||
for entry in state.node_history:
|
||||
print(f" {entry['timestamp'][:19]} | {entry['node']:20s} | {entry['status']:10s} | {entry.get('detail', '')}")
|
||||
|
||||
# Parallel research — show domain/language/model allocation
|
||||
if state.research_results:
|
||||
print()
|
||||
print(f"[test] Research tracks: {len(state.research_results)}")
|
||||
for r in state.research_results:
|
||||
ms = f" ({r.duration_ms}ms)" if r.duration_ms else ""
|
||||
print(f" [{r.status.value:9s}] [{r.domain.value:6s}] [{r.native_language}] {r.description}{ms}")
|
||||
|
||||
# Output files
|
||||
if state.generated_files:
|
||||
print()
|
||||
print(f"[test] Generated files ({len(state.generated_files)}):")
|
||||
for f in state.generated_files:
|
||||
print(f" → {f}")
|
||||
|
||||
# Review verdict
|
||||
if state.review:
|
||||
print()
|
||||
print(f"[test] Review: score={state.review.get('overall_score')}, verdict={state.review.get('verdict')}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user