Include report artifacts in chat context
Browse files
research/fastmcp_server.py
CHANGED
|
@@ -100,11 +100,17 @@ def register_research_app(
|
|
| 100 |
) -> dict[str, str]:
|
| 101 |
auth = request_auth()
|
| 102 |
job = await jobs.get(job_id, owner_id(auth, ctx.session_id))
|
| 103 |
-
if job is None or
|
| 104 |
raise RuntimeError("Research job is not available or complete")
|
| 105 |
markdown = await asyncio.to_thread(read_bucket_markdown, job, auth)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
return {
|
| 107 |
-
"markdown":
|
| 108 |
"message": (
|
| 109 |
"The research report is complete and has been added to context. "
|
| 110 |
"Please summarize the main findings and include links to the "
|
|
|
|
| 100 |
) -> dict[str, str]:
|
| 101 |
auth = request_auth()
|
| 102 |
job = await jobs.get(job_id, owner_id(auth, ctx.session_id))
|
| 103 |
+
if job is None or job.status != "completed":
|
| 104 |
raise RuntimeError("Research job is not available or complete")
|
| 105 |
markdown = await asyncio.to_thread(read_bucket_markdown, job, auth)
|
| 106 |
+
context_markdown = (
|
| 107 |
+
f"{markdown.rstrip()}\n\n---\n\n"
|
| 108 |
+
f"## Research run metadata\n\n"
|
| 109 |
+
f"- App build: `{build_id}`\n\n"
|
| 110 |
+
f"{job.result or ''}"
|
| 111 |
+
)
|
| 112 |
return {
|
| 113 |
+
"markdown": context_markdown,
|
| 114 |
"message": (
|
| 115 |
"The research report is complete and has been added to context. "
|
| 116 |
"Please summarize the main findings and include links to the "
|