Commit Graph

16 Commits

Author SHA1 Message Date
ea3d26282f feat(seo): Display all collected SEO data in audit dashboard
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Route passes 16 new fields from DB (technical SEO, meta tags, structured
data, performance) plus CrUX/security/image metrics. Template shows new
sections: Meta Tags & Content, CrUX Field Data, Security Headers (score
X/4), Image Optimization (% modern formats), and 9 new Technical SEO
checklist items. Migration 059 adds 16 columns for persisting live data.
AI service now saves CrUX/security/image data to DB during analysis.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 12:53:07 +01:00
1f6938eef4 feat(audit): Phase 4 - AI sentiment analysis + competitor benchmarking
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Sentiment analysis:
- New analyze_review_sentiment_ai() method in GBPAuditService
- Uses Gemini to analyze review text content (not just ratings)
- Extracts themes, strengths, weaknesses, sentiment score (-1 to 1)
- Review sentiment data passed to GBP AI prompt

Competitor benchmarking:
- New benchmark_service.py with BenchmarkService class
- Calculates category averages across all 150 firms (GBP, SEO, Social)
- Metrics: completeness scores, ratings, reviews, photos, PageSpeed,
  load time, follower counts, platform coverage
- Benchmark data injected into all 3 AI prompts (SEO, GBP, Social)
- Excluded from cache hash to avoid unnecessary invalidation

All 4 phases of audit completeness plan now implemented.
Estimated completeness: 52% → ~93%

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 11:53:59 +01:00
279947d4aa feat(audit): Phase 2 - Migrate GBP to Places API (New) + enrich AI prompt
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
GBP data fetching migration:
- Replace legacy maps.googleapis.com/maps/api/place/ with GooglePlacesService
- Use Places API (New): places.googleapis.com/v1/places
- Extract 20+ new fields: primaryType, editorialSummary, priceLevel,
  paymentOptions, parkingOptions, accessibilityOptions, service options,
  amenities, food & drink, detailed photos metadata, review statistics
- Location bias for Wejherowo area in place search
- Backward-compatible return format for existing callers

GBP AI prompt enrichment:
- Add primaryType, editorialSummary, priceLevel to company info section
- Add business attributes section (payment, parking, accessibility,
  services, amenities, food & drink) with dynamic rendering
- Use getattr with fallbacks for new DB columns not yet migrated

Completeness: GBP 55% → ~90% (estimated)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 11:39:17 +01:00
ce6aa53c78 feat(audit): Phase 1 - YouTube API, CrUX field data, security headers, image formats
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
New services:
- youtube_service.py: YouTube Data API v3 integration for channel stats
  (subscriber count, view count, video count)
- crux_service.py: Chrome UX Report API for real user field data
  (INP, LCP, CLS, FCP, TTFB from actual Chrome users)

SEO audit enrichment:
- Security headers check: HSTS, CSP, X-Frame-Options, X-Content-Type-Options
  via live requests.head() during data collection
- Image format analysis: WebP/AVIF/SVG vs legacy JPEG/PNG ratio
- CrUX field data complements existing PageSpeed lab data in AI prompt
- All new metrics passed to Gemini for richer analysis

Social media audit enrichment:
- YouTube API data (video count, views, subscribers) integrated into
  social media AI prompt when YouTube profile exists

All APIs use existing GOOGLE_PLACES_API_KEY (free tier, $0 cost).
Completeness: ~68% → ~78% (estimated)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 11:32:03 +01:00
b1438dd514 feat(audit): Phase 0 quick wins - fix bugs, enrich AI prompts, add metrics
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
GBP audit:
- Fix review_response_rate bug: check ownerResponse instead of authorAttribution.displayName
- Mark has_posts/has_products/has_qa as OAuth-dependent in AI prompt
- Add review_keywords and description_keywords to AI prompt

SEO audit:
- Replace deprecated FID with INP (Core Web Vital since March 2024)
- Pass 10 additional metrics to AI prompt: FCP, TTFB, TBT, Speed Index,
  meta title/desc length, html lang, Schema.org field details
- Update templates with INP thresholds (200ms/500ms)

Social media audit:
- Calculate engagement_rate from industry base rates × activity multiplier
- Calculate posting_frequency_score (0-10 based on posts_count_30d)
- Enrich AI prompt with page_name, freq_score, engagement, last_post_date
- Add avg engagement rate and brand name consistency check to prompt

Completeness: 52% → ~68% (estimated)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 11:24:03 +01:00
81fea37666 feat(audit): Add Gemini Structured Output API + JSON parse failure tracking
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
1. Switch to Gemini Structured Output (response_schema) for audit AI analysis
   - Enforces valid JSON from API, ~95% → ~99% reliability
   - Fallback to manual cleaning if structured output fails
2. Add JSON parse failure rate metric - logs to AIUsageLog for monitoring
3. Add Gemini 3 Pro preview model monitoring warning at service init

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 10:55:35 +01:00
09ae03dcec fix(audit): Fix false photo/logo detection in GBP audits
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Replace hardcoded logo_present=False with heuristic (photo_count>=1)
- Replace hardcoded cover_photo_present=False with heuristic (>=2)
- Fix has_photos to use photo_count>0 instead of score threshold
- Add descriptive photo_status string for AI context
- Add UWAGA section in Gemini prompt for cautious recommendations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 10:36:15 +01:00
7197af3933 feat(audit): Add previous vs current AI analysis comparison
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Store previous analysis before regeneration and show comparison table
with priority breakdown, new/removed actions diff.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:05:17 +01:00
a6d7fc343e feat(ai): Use Gemini 3 Pro for audit analyses (GBP, SEO, social media)
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Add per-call model override parameter to generate_text()
- GBP audit, SEO/social audit analysis, and audit content generation
  now use gemini-3-pro-preview for highest quality reasoning
- Chat and other features remain on 3-flash (cheaper, faster)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 17:39:44 +01:00
c99c4ac8dd fix(cache): Serialize Category object to .name for stable hash
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
company.category is a SQLAlchemy Category object. json.dumps(default=str)
converted it to '<database.Category object at 0x...>' with a different
memory address on each request, causing cache hash to always differ.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:58:35 +01:00
4ff386fa7d debug(cache): Log per-field hashes to identify unstable field
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:54:03 +01:00
1d6dfa0da8 debug: add cache hash comparison log
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
2026-02-07 13:48:00 +01:00
0c6cd09d18 feat(audit-ai): 9 UX improvements for AI audit actions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Cache: exclude volatile citations fields from hash for better hit rate
- Thinking level: reduce from 'high' to 'low' for faster responses (13-24s → ~5-10s)
- UTF-8: html.unescape() on meta_title, meta_description, h1_text
- SEO score: add "(Google Lighthouse)" label and explanatory note
- Spinner: update text to "15-30 seconds" with live timer counter
- Auto-scroll: smooth scroll to results after AI analysis and content generation
- Cache info: show generation date with "Wygeneruj ponownie" link
- Markdown: render non-code AI content with basic markdown formatting
- Error feedback: inline error display with retry button instead of modal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:42:24 +01:00
8ad6299381 fix(audit-ai): Add dynamic fallback for unknown action_types in content generation
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
AI analysis generates action_types dynamically (e.g. add_sitemap, add_nap)
that don't always match predefined CONTENT_PROMPTS. Added fallback that
builds a generic prompt using the action title/description from the DB.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 12:57:46 +01:00
44e7e1cb07 fix(audit-ai): Fix CompanyService.name AttributeError in content generation
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
company.services returns CompanyService join table objects, not Service
objects. Access service name via s.service.name relationship.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 12:51:06 +01:00
7383ec74a5 feat(audit): Add AI-powered audit analysis and action generation
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Add Gemini AI integration to SEO, GBP, and Social Media audits that
generates contextual analysis summaries and prioritized action items
with ready-to-use content (Schema.org, meta descriptions, social posts,
GBP descriptions, review responses, content calendars).

New files:
- audit_ai_service.py: Central AI service with caching (7-day TTL)
- blueprints/api/routes_audit_actions.py: 4 API endpoints
- database/migrations/056_audit_actions.sql: 3 new tables
- templates/partials/audit_ai_actions.html: Reusable UI component

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 12:41:26 +01:00