mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-10 22:32:16 +02:00
feat: enhance report content schema and add resume generation output handling
This commit is contained in:
parent
39aaf92f0e
commit
ccf010175d
2 changed files with 28 additions and 1 deletions
|
|
@ -23,6 +23,7 @@ class ReportRead(BaseModel):
|
||||||
report_style: str | None = None
|
report_style: str | None = None
|
||||||
report_metadata: dict[str, Any] | None = None
|
report_metadata: dict[str, Any] | None = None
|
||||||
report_group_id: int | None = None
|
report_group_id: int | None = None
|
||||||
|
content_type: str = "markdown"
|
||||||
created_at: datetime
|
created_at: datetime
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
|
@ -40,11 +41,12 @@ class ReportVersionInfo(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
class ReportContentRead(BaseModel):
|
class ReportContentRead(BaseModel):
|
||||||
"""Schema for reading a report with full Markdown content."""
|
"""Schema for reading a report with full content (Markdown or Typst)."""
|
||||||
|
|
||||||
id: int
|
id: int
|
||||||
title: str
|
title: str
|
||||||
content: str | None = None
|
content: str | None = None
|
||||||
|
content_type: str = "markdown"
|
||||||
report_metadata: dict[str, Any] | None = None
|
report_metadata: dict[str, Any] | None = None
|
||||||
report_group_id: int | None = None
|
report_group_id: int | None = None
|
||||||
versions: list[ReportVersionInfo] = []
|
versions: list[ReportVersionInfo] = []
|
||||||
|
|
|
||||||
|
|
@ -953,6 +953,31 @@ async def _stream_agent_events(
|
||||||
f"Report generation failed: {error_msg}",
|
f"Report generation failed: {error_msg}",
|
||||||
"error",
|
"error",
|
||||||
)
|
)
|
||||||
|
elif tool_name == "generate_resume":
|
||||||
|
yield streaming_service.format_tool_output_available(
|
||||||
|
tool_call_id,
|
||||||
|
tool_output
|
||||||
|
if isinstance(tool_output, dict)
|
||||||
|
else {"result": tool_output},
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
isinstance(tool_output, dict)
|
||||||
|
and tool_output.get("status") == "ready"
|
||||||
|
):
|
||||||
|
yield streaming_service.format_terminal_info(
|
||||||
|
f"Resume generated: {tool_output.get('title', 'Resume')}",
|
||||||
|
"success",
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
error_msg = (
|
||||||
|
tool_output.get("error", "Unknown error")
|
||||||
|
if isinstance(tool_output, dict)
|
||||||
|
else "Unknown error"
|
||||||
|
)
|
||||||
|
yield streaming_service.format_terminal_info(
|
||||||
|
f"Resume generation failed: {error_msg}",
|
||||||
|
"error",
|
||||||
|
)
|
||||||
elif tool_name in (
|
elif tool_name in (
|
||||||
"create_notion_page",
|
"create_notion_page",
|
||||||
"update_notion_page",
|
"update_notion_page",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue