You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
# backend/app/agents/scripted.py
|
|
# tool-capable 모델 미가용/오프라인/CI 용 결정적 파이프라인.
|
|
from sqlmodel import Session
|
|
|
|
from ..models import ResearchReport
|
|
from .base import AgentResult
|
|
|
|
|
|
def report_to_dict(rp: ResearchReport) -> dict:
|
|
return {
|
|
"id": rp.id,
|
|
"title": rp.title,
|
|
"asked": rp.asked,
|
|
"meta": rp.meta,
|
|
"counts": rp.counts,
|
|
"synthesis": rp.synthesis,
|
|
"cross": rp.cross,
|
|
"note": rp.note,
|
|
}
|
|
|
|
|
|
def research_pipeline(s: Session, query: str) -> AgentResult:
|
|
rp = s.get(ResearchReport, "rp1")
|
|
q = (query or "").strip()
|
|
if rp and q.startswith("최신 AI 반도체"):
|
|
return AgentResult(
|
|
ok=True,
|
|
fallback=True,
|
|
model="scripted",
|
|
output={"ready": True, "report_id": "rp1", "report": report_to_dict(rp)},
|
|
)
|
|
# 그 외 — 결정적으로 'queued'(데모: 끝나면 알림)
|
|
return AgentResult(ok=True, fallback=True, model="scripted", output={"ready": False})
|