refactor: 重构 schemas 结构,统一枚举定义
This commit is contained in:
@@ -84,7 +84,7 @@ class CalendarWriteOperation(BaseModel):
|
||||
le=10080,
|
||||
description="Reminder minutes before event start.",
|
||||
)
|
||||
status: Literal["active", "completed", "canceled", "archived"] | None = Field(
|
||||
status: Literal["active", "archived"] | None = Field(
|
||||
default=None,
|
||||
description="Optional status for update action.",
|
||||
)
|
||||
@@ -163,6 +163,10 @@ async def calendar_read(
|
||||
) -> ToolResponse:
|
||||
"""Read calendar events with optional keyword filtering and pagination.
|
||||
|
||||
Status semantics for returned events:
|
||||
- active: Event is actionable.
|
||||
- archived: Event is historical/expired and should not trigger reminders.
|
||||
|
||||
Args:
|
||||
query: Optional keyword used to filter events by text fields.
|
||||
page: Page number starting from 1.
|
||||
|
||||
@@ -15,9 +15,9 @@ from core.agentscope.tools.utils.tool_response_builder import (
|
||||
build_error_output,
|
||||
build_tool_response,
|
||||
)
|
||||
from models.memories import MemoryType
|
||||
from schemas.enums import MemoryType
|
||||
from schemas.agent.runtime_models import ErrorInfo, ToolAgentOutput, ToolStatus
|
||||
from schemas.memories.memory_content import UserMemoryContent, WorkProfileContent
|
||||
from schemas.domain.memory_content import UserMemoryContent, WorkProfileContent
|
||||
|
||||
|
||||
class MemoryWriteArgs(BaseModel):
|
||||
|
||||
@@ -46,6 +46,9 @@ def create_schedule_service(
|
||||
def schedule_event_to_dict(event: object) -> dict[str, Any]:
|
||||
event_id = str(getattr(event, "id"))
|
||||
metadata = getattr(event, "metadata", None)
|
||||
status_value = getattr(event, "status", None)
|
||||
if hasattr(status_value, "value"):
|
||||
status_value = getattr(status_value, "value")
|
||||
location_value = getattr(metadata, "location", None)
|
||||
color_value = getattr(metadata, "color", None) or "#4F46E5"
|
||||
reminder_minutes_value = getattr(metadata, "reminder_minutes", None)
|
||||
@@ -58,6 +61,7 @@ def schedule_event_to_dict(event: object) -> dict[str, Any]:
|
||||
if getattr(event, "end_at") is not None
|
||||
else None,
|
||||
"timezone": getattr(event, "timezone"),
|
||||
"status": status_value,
|
||||
"location": location_value,
|
||||
"color": color_value,
|
||||
"reminderMinutes": reminder_minutes_value,
|
||||
|
||||
Reference in New Issue
Block a user