Add optional Tone field to Sites for AI content generation

- Add tone column to sites table (nullable string)
- Add TONES constant to Site model with predefined options:
  professional, casual, technical, friendly, formal, humorous,
  conversational, authoritative, inspirational, educational, minimal, detailed
- Update Sites Livewire component to edit tone
- Update Sites view with tone select dropdown in form
- Add tone column to sites table display
- Add tone to SiteResource API response

AI agents can now read the site's tone and use it when generating content.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
m105
2026-07-28 22:06:17 +03:00
parent cee9fdc290
commit efdec9eabd
5 changed files with 59 additions and 0 deletions
+7
View File
@@ -29,11 +29,14 @@ class Index extends Component
public ?string $apiInstructions = null;
public ?string $tone = null;
public function render()
{
return view('livewire.sites.index', [
'sites' => Site::orderBy('name')->get(),
'cmsTypes' => Site::CMS_TYPES,
'tones' => Site::TONES,
]);
}
@@ -54,6 +57,7 @@ class Index extends Component
$this->wpUsername = $site->wp_username ?? '';
$this->wpAppPassword = $site->wp_app_password ?? '';
$this->apiInstructions = $site->api_instructions;
$this->tone = $site->tone;
$this->showForm = true;
}
@@ -67,6 +71,7 @@ class Index extends Component
'wpUsername' => ['required_if:cmsType,wordpress', 'nullable', 'string', 'max:255'],
'wpAppPassword' => ['required_if:cmsType,wordpress', 'nullable', 'string', 'max:255'],
'apiInstructions' => ['nullable', 'string'],
'tone' => ['nullable', 'string'],
]);
Site::updateOrCreate(['id' => $this->editingId], [
@@ -77,6 +82,7 @@ class Index extends Component
'wp_username' => $validated['cmsType'] === 'wordpress' ? $validated['wpUsername'] : null,
'wp_app_password' => $validated['cmsType'] === 'wordpress' ? $validated['wpAppPassword'] : null,
'api_instructions' => $validated['apiInstructions'],
'tone' => $validated['tone'],
]);
$this->resetForm();
@@ -103,6 +109,7 @@ class Index extends Component
$this->wpUsername = '';
$this->wpAppPassword = '';
$this->apiInstructions = null;
$this->tone = null;
$this->resetValidation();
}
}