diff --git a/app/Livewire/Pages/Ai/Insights.php b/app/Livewire/Pages/Ai/Insights.php index 4e8d7fd..6b5a599 100644 --- a/app/Livewire/Pages/Ai/Insights.php +++ b/app/Livewire/Pages/Ai/Insights.php @@ -54,21 +54,19 @@ class Insights extends Component $summary = $topLinks->map(fn ($l) => "- {$l->slug} ({$l->clicks_count} clicks) → {$l->target_url}")->implode("\n"); $prompt = <<name} -Total links analysed: {$linkCount} | Total clicks: {$totalClicks} +Links analysed: {$linkCount} | Total clicks: {$totalClicks} -Top links: +Data: {$summary} -Provide 3–4 short, specific insights: -- Which link types or destinations perform best and why -- Patterns across target domains (e.g. social, docs, pricing pages) -- What the low-click links have in common and how to improve them -- One concrete next action for this workspace - -No generic marketing advice. Base every insight on the data above. Be direct, no fluff. +Rules: +- If fewer than 3 links or fewer than 10 total clicks exist, say so upfront and explain that reliable patterns need more data. Give 1–2 observations possible from the limited data, then stop. +- Otherwise give 3–4 insights: best-performing destination types, domain patterns, what underperforming links share, one concrete next action. +- Every claim must reference a specific slug or URL from the data above. +- No generic marketing advice. No padding. Plain language, no excessive formatting. PROMPT; $result = app(AiService::class)->complete($prompt); diff --git a/resources/views/components/ui/button.blade.php b/resources/views/components/ui/button.blade.php index 915c44d..e1c3a85 100644 --- a/resources/views/components/ui/button.blade.php +++ b/resources/views/components/ui/button.blade.php @@ -21,14 +21,16 @@ $cls = $base . ' ' . ($variants[$variant] ?? $variants['primary']); {{ $attributes->merge(['type' => $type, 'class' => $cls]) }} @if($action) wire:loading.attr="disabled" wire:target="{{ $action }}" @endif > - + {{ $slot->isNotEmpty() ? $slot : $label }} @if($action) - - - - + + + + @endif