Skip to content

Commit c5af7c4

Browse files
authored
Align CMS schemas with frontend types and actual data (#593)
- ChatThemeColors: add header/headerText fields used by both frontends - JokeContent: replace setup/punchline schema with actual question_text/answers structure - InteractionCreate: add phone/url to input_type validation pattern - load_jokes.py: use type "joke" (not "question") for CMS content - huey-jokes-flow.json: source_config type "joke" to match content
1 parent eabbc83 commit c5af7c4

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

app/schemas/cms.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ class InteractionCreate(BaseModel):
465465
input: str
466466
input_type: str = Field(
467467
...,
468-
pattern="^(text|button|file|choice|number|email|date|slider|image_choice|carousel|multiple_choice|continue)$",
468+
pattern="^(text|button|file|choice|number|email|phone|url|date|slider|image_choice|carousel|multiple_choice|continue)$",
469469
)
470470

471471

@@ -613,11 +613,18 @@ class WebhookTestResponse(BaseModel):
613613

614614

615615
# Content Type Specific Schemas
616+
class JokeAnswer(BaseModel):
617+
text: str
618+
value: str
619+
punchline: Optional[str] = None
620+
reward_url: Optional[str] = None
621+
622+
616623
class JokeContent(BaseModel):
617-
setup: str
618-
punchline: str
619-
category: Optional[str] = None
620-
age_group: Optional[List[str]] = []
624+
question_text: str
625+
answers: List[JokeAnswer]
626+
min_age: Optional[int] = None
627+
max_age: Optional[int] = None
621628

622629

623630
class FactContent(BaseModel):
@@ -720,6 +727,8 @@ class QuestionNodeContent(BaseModel):
720727
- text: Free text input
721728
- number: Numeric input with optional min/max
722729
- email: Email address input
730+
- phone: Phone number input
731+
- url: URL input
723732
- date: Date picker
724733
- choice: Single selection from options (buttons/radio)
725734
- multiple_choice: Multiple selection from options (checkboxes)
@@ -761,6 +770,8 @@ class ChatThemeColors(BaseModel):
761770
secondary: str = Field(default="#52c41a", pattern=r"^#[0-9a-fA-F]{6}$")
762771
background: str = Field(default="#ffffff", pattern=r"^#[0-9a-fA-F]{6}$")
763772
backgroundAlt: str = Field(default="#f5f5f5", pattern=r"^#[0-9a-fA-F]{6}$")
773+
header: str = Field(default="#f5f5f5", pattern=r"^#[0-9a-fA-F]{6}$")
774+
headerText: str = Field(default="#262626", pattern=r"^#[0-9a-fA-F]{6}$")
764775
userBubble: str = Field(default="#e6f7ff", pattern=r"^#[0-9a-fA-F]{6}$")
765776
userBubbleText: str = Field(default="#000000", pattern=r"^#[0-9a-fA-F]{6}$")
766777
botBubble: str = Field(default="#f0f0f0", pattern=r"^#[0-9a-fA-F]{6}$")

scripts/fixtures/huey-jokes-flow.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"content": {
6969
"source": "random",
7070
"source_config": {
71-
"type": "question",
71+
"type": "joke",
7272
"tags": ["huey-joke"],
7373
"info_filters": {
7474
"min_age": "${user.age_number}",

scripts/load_jokes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def load_jokes(csv_path: Path) -> list[dict]:
5858
max_age = max(ages) if ages else 13
5959

6060
jokes.append({
61-
"type": "question",
61+
"type": "joke",
6262
"content": {
6363
"question_text": question.strip(),
6464
"min_age": min_age,

0 commit comments

Comments
 (0)