Workflow Copilot: backend side of the first version (#4401)
This commit is contained in:
committed by
GitHub
parent
1e314ce149
commit
e3dd75d7c1
58
skyvern/forge/sdk/schemas/workflow_copilot.py
Normal file
58
skyvern/forge/sdk/schemas/workflow_copilot.py
Normal file
@@ -0,0 +1,58 @@
|
||||
from datetime import datetime
|
||||
from enum import StrEnum
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class WorkflowCopilotChat(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
workflow_copilot_chat_id: str = Field(..., description="ID for the workflow copilot chat")
|
||||
organization_id: str = Field(..., description="Organization ID for the chat")
|
||||
workflow_permanent_id: str = Field(..., description="Workflow permanent ID for the chat")
|
||||
created_at: datetime = Field(..., description="When the chat was created")
|
||||
modified_at: datetime = Field(..., description="When the chat was last modified")
|
||||
|
||||
|
||||
class WorkflowCopilotChatSender(StrEnum):
|
||||
USER = "user"
|
||||
AI = "ai"
|
||||
|
||||
|
||||
class WorkflowCopilotChatMessage(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
workflow_copilot_chat_message_id: str = Field(..., description="ID for the workflow copilot chat message")
|
||||
workflow_copilot_chat_id: str = Field(..., description="ID of the parent workflow copilot chat")
|
||||
sender: WorkflowCopilotChatSender = Field(..., description="Message sender")
|
||||
content: str = Field(..., description="Message content")
|
||||
global_llm_context: str | None = Field(None, description="Optional global LLM context for the message")
|
||||
created_at: datetime = Field(..., description="When the message was created")
|
||||
modified_at: datetime = Field(..., description="When the message was last modified")
|
||||
|
||||
|
||||
class WorkflowCopilotChatRequest(BaseModel):
|
||||
workflow_permanent_id: str = Field(..., description="Workflow permanent ID for the chat")
|
||||
workflow_copilot_chat_id: str | None = Field(None, description="The chat ID to send the message to")
|
||||
workflow_run_id: str | None = Field(None, description="The workflow run ID to use for the context")
|
||||
message: str = Field(..., description="The message that user sends")
|
||||
workflow_yaml: str = Field(..., description="Current workflow YAML including unsaved changes")
|
||||
|
||||
|
||||
class WorkflowCopilotChatResponse(BaseModel):
|
||||
workflow_copilot_chat_id: str = Field(..., description="The chat ID")
|
||||
message: str = Field(..., description="The message sent to the user")
|
||||
updated_workflow_yaml: str | None = Field(None, description="The updated workflow yaml")
|
||||
request_time: datetime = Field(..., description="When the request was received")
|
||||
response_time: datetime = Field(..., description="When the assistant message was created")
|
||||
|
||||
|
||||
class WorkflowCopilotChatHistoryMessage(BaseModel):
|
||||
sender: WorkflowCopilotChatSender = Field(..., description="Message sender")
|
||||
content: str = Field(..., description="Message content")
|
||||
created_at: datetime = Field(..., description="When the message was created")
|
||||
|
||||
|
||||
class WorkflowCopilotChatHistoryResponse(BaseModel):
|
||||
workflow_copilot_chat_id: str | None = Field(None, description="Latest chat ID for the workflow")
|
||||
chat_history: list[WorkflowCopilotChatHistoryMessage] = Field(default_factory=list, description="Chat messages")
|
||||
Reference in New Issue
Block a user