feat: 增强日历功能并集成 AgentScope 代理服务
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
|
||||
|
||||
class IntentTask(BaseModel):
|
||||
task_id: str = Field(min_length=1)
|
||||
title: str = Field(min_length=1)
|
||||
objective: str = Field(min_length=1)
|
||||
|
||||
|
||||
class IntentOutput(BaseModel):
|
||||
route: Literal["DIRECT_RESPONSE", "TASK_EXECUTION"]
|
||||
intent_summary: str = Field(min_length=1)
|
||||
direct_response: str | None = None
|
||||
tasks: list[IntentTask] = Field(default_factory=list)
|
||||
complexity: Literal["simple", "complex"]
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_route(self) -> "IntentOutput":
|
||||
if self.route == "DIRECT_RESPONSE":
|
||||
if not self.direct_response:
|
||||
raise ValueError("direct_response is required for DIRECT_RESPONSE")
|
||||
if self.tasks:
|
||||
raise ValueError("tasks must be empty for DIRECT_RESPONSE")
|
||||
if self.route == "TASK_EXECUTION":
|
||||
if not self.tasks:
|
||||
raise ValueError("tasks is required for TASK_EXECUTION")
|
||||
return self
|
||||
Reference in New Issue
Block a user