feat: add action_type and focal_node_id to AI chat message API

- Add VALID_ACTION_TYPES literal and action_type/focal_node_id fields to
  AIChatMessageRequest schema
- Add tree_id field to AIChatStartRequest schema for editor-embedded sessions
- Update send_message() signature with action_type and focal_node_id params
- Update start_chat_session() signature with tree_id param
- Pass new params through endpoints to service functions
- All new params have defaults so existing behavior is unchanged

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-06 23:23:11 -05:00
parent cfd6ebff63
commit 41b7cd86b8
3 changed files with 31 additions and 1 deletions

View File

@@ -14,12 +14,35 @@ class AIChatStartRequest(BaseModel):
flow_type: Literal["troubleshooting", "procedural"] = Field(
..., description="Type of flow to build"
)
tree_id: Optional[str] = Field(
default=None,
description="ID of existing tree for editor-embedded sessions",
)
VALID_ACTION_TYPES = Literal[
"generate_full",
"generate_branch",
"modify_node",
"add_steps",
"quick_action",
"open_chat",
"variable_inference",
]
class AIChatMessageRequest(BaseModel):
"""Send a user message in a chat session."""
content: str = Field(..., min_length=1, max_length=5000)
action_type: Optional[VALID_ACTION_TYPES] = Field(
default="open_chat",
description="Type of AI action to perform",
)
focal_node_id: Optional[str] = Field(
default=None,
description="ID of the node/step being acted on",
)
class AIChatImportRequest(BaseModel):