- New ChatLeadForm component: collects name, email, company before chat starts - GDPR consent checkbox with Privacy Policy link - Lead info passed to backend and injected as LLM context - Visitor name from form used in Rocket.Chat room - RC bot messages: added logging + fallback to livechat/message endpoint - RC room caching to avoid repeated API calls Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
810 B
Python
36 lines
810 B
Python
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ChatLead(BaseModel):
|
|
name: str = ""
|
|
email: str = ""
|
|
company: str = ""
|
|
|
|
|
|
class ChatRequest(BaseModel):
|
|
session_id: str = Field(..., min_length=1, max_length=64)
|
|
message: str = Field(..., min_length=1, max_length=500)
|
|
page_context: str = Field(default="/", max_length=200)
|
|
lead: ChatLead | None = None
|
|
|
|
|
|
class ChatResponse(BaseModel):
|
|
reply: str
|
|
sender: str = "bot" # "bot" | "human"
|
|
session_id: str
|
|
message_count: int
|
|
rate_limited: bool = False
|
|
|
|
|
|
class LeadData(BaseModel):
|
|
name: str = ""
|
|
email: str = ""
|
|
company: str = ""
|
|
need: str = ""
|
|
|
|
|
|
class RocketChatWebhook(BaseModel):
|
|
token: str = ""
|
|
channel_id: str = ""
|
|
user_name: str = ""
|
|
text: str = ""
|