Skip to content

Commit 87f0663

Browse files
authored
Merge pull request #14 from rasulkireev/fix-status-error
Fix generation error
2 parents 9508a44 + 6361b8c commit 87f0663

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

core/schemas.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ class TitleSuggestion(BaseModel):
6969
title: str = Field(description="SEO-optimized blog post title")
7070
category: str = Field(description="Primary content category")
7171
target_keywords: list[str] = Field(description="Strategic SEO keywords to target")
72-
description: str = Field(description="Brief overview of the blog post's main points as comma-separated keywords")
72+
description: str = Field(
73+
description="Brief overview of why this title is a good fit for the project and why it might work well for the target audience"
74+
)
7375
suggested_meta_description: str = Field(description="SEO-optimized meta description (150-160 characters)")
7476

7577

frontend/src/controllers/title_suggestions_controller.js

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,9 @@ export default class extends Controller {
6969
if (Array.isArray(suggestion.target_keywords)) {
7070
keywordsHTML = `
7171
<div class="mt-4">
72-
<h5 class="text-sm font-medium text-gray-700">Target Keywords:</h5>
73-
<div class="flex flex-wrap gap-2 mt-2">
72+
<div class="flex flex-wrap gap-2">
7473
${suggestion.target_keywords.map(keyword => `
75-
<span class="inline-flex items-center px-2.5 py-0.5 text-xs font-medium text-gray-800 bg-gray-100 rounded-full">
74+
<span class="inline-flex items-center px-3 py-1 text-xs font-medium text-gray-700 bg-gray-100 rounded-full transition-colors duration-200 hover:bg-gray-200">
7675
${keyword.trim()}
7776
</span>
7877
`).join("")}
@@ -84,10 +83,9 @@ export default class extends Controller {
8483
else if (typeof suggestion.target_keywords === 'string') {
8584
keywordsHTML = `
8685
<div class="mt-4">
87-
<h5 class="text-sm font-medium text-gray-700">Target Keywords:</h5>
88-
<div class="flex flex-wrap gap-2 mt-2">
86+
<div class="flex flex-wrap gap-2">
8987
${suggestion.target_keywords.split(",").map(keyword => `
90-
<span class="inline-flex items-center px-2.5 py-0.5 text-xs font-medium text-gray-800 bg-gray-100 rounded-full">
88+
<span class="inline-flex items-center px-3 py-1 text-xs font-medium text-gray-700 bg-gray-100 rounded-full transition-colors duration-200 hover:bg-gray-200">
9189
${keyword.trim()}
9290
</span>
9391
`).join("")}
@@ -104,50 +102,60 @@ export default class extends Controller {
104102
data-generate-content-suggestion-id-value="${suggestion.id}"
105103
data-suggestion-type="${contentType}"
106104
>
105+
<!-- Header section with toggle and actions -->
107106
<div class="flex gap-x-4 justify-between items-start">
108-
<div class="flex-1 p-6 bg-white rounded-lg shadow-sm">
107+
<div class="flex-1 p-6">
108+
<!-- Title and voting section -->
109109
<div class="space-y-4">
110110
<h4 class="text-xl font-bold tracking-tight text-gray-900">
111111
${suggestion.title}
112112
</h4>
113113
114-
<div class="flex items-center space-x-2"
114+
<!-- Like/Dislike Buttons -->
115+
<div class="flex items-center space-x-4"
116+
data-controller="title-score"
115117
data-title-score-suggestion-id-value="${suggestion.id}"
116118
data-current-score="0">
117119
118120
<button data-title-score-target="likeButton"
119121
data-action="title-score#updateScore"
120-
class="inline-flex gap-x-1 items-center px-2 py-1.5 text-sm font-medium rounded-md transition-colors duration-200 like hover:bg-green-50">
121-
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
122+
class="inline-flex gap-x-2 items-center px-4 py-2 text-sm font-medium rounded-md border-2 border border-gray-900 transition-colors duration-200 like hover:bg-green-50">
123+
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
122124
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 10h4.764a2 2 0 011.789 2.894l-3.5 7A2 2 0 0115.263 21h-4.017c-.163 0-.326-.02-.485-.06L7 20m7-10V5a2 2 0 00-2-2h-.095c-.5 0-.905.405-.905.905 0 .714-.211 1.412-.608 2.006L7 11v9m7-10h-2M7 20H5a2 2 0 01-2-2v-6a2 2 0 012-2h2.5" />
123125
</svg>
124126
<span>Like</span>
125127
</button>
126128
127129
<button data-title-score-target="dislikeButton"
128130
data-action="title-score#updateScore"
129-
class="inline-flex gap-x-1 items-center px-2 py-1.5 text-sm font-medium rounded-md transition-colors duration-200 dislike hover:bg-red-50">
130-
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
131+
class="inline-flex gap-x-2 items-center px-4 py-2 text-sm font-medium rounded-md border-2 border border-gray-900 transition-colors duration-200 dislike hover:bg-red-50">
132+
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
131133
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14H5.236a2 2 0 01-1.789-2.894l3.5-7A2 2 0 018.736 3h4.018c.163 0 .326.02.485.06L17 4m-7 10v2a2 2 0 002 2h.095c.5 0 .905-.405.905-.905 0-.714.211-1.412.608-2.006L17 13V4m-7 10h2m5-10h2a2 2 0 012 2v6a2 2 0 01-2 2h-2.5" />
132134
</svg>
133135
<span>Dislike</span>
134136
</button>
135137
</div>
136138
</div>
137139
140+
<!-- Main Description -->
138141
<p class="mt-3 leading-relaxed text-gray-700">
139142
${suggestion.description}
140143
</p>
141144
145+
<!-- Category Badge -->
142146
<div class="mt-4">
143147
<span class="inline-flex items-center px-3 py-1 text-sm font-medium text-blue-800 bg-blue-100 rounded-full">
144148
Category: ${suggestion.category}
145149
</span>
146150
</div>
147151
148152
${keywordsHTML}
153+
</div>
149154
150-
<div data-generate-content-target="buttonContainer" class="mt-4">
155+
<div class="flex gap-x-3 items-center">
156+
<!-- Status target element - this was missing and causing the error -->
157+
<div data-generate-content-target="status"></div>
158+
<div data-generate-content-target="buttonContainer">
151159
<button
152160
data-action="generate-content#generate"
153161
class="px-3 py-1 text-sm font-semibold text-white bg-pink-600 rounded-md hover:bg-pink-700">
@@ -156,6 +164,11 @@ export default class extends Controller {
156164
</div>
157165
</div>
158166
</div>
167+
168+
<!-- Dropdown content -->
169+
<div data-generate-content-target="dropdown" class="hidden mt-4">
170+
<div data-generate-content-target="content"></div>
171+
</div>
159172
</div>
160173
`;
161174
}

0 commit comments

Comments
 (0)