Commit Graph

25 Commits

Author SHA1 Message Date
cebe52f303 refactor: Rebranding i aktualizacja modelu AI
- Zmiana nazwy: "Norda Biznes Hub" → "Norda Biznes Partner"
- Aktualizacja modelu AI: Gemini 2.0 Flash → Gemini 3 Flash
- Zachowano historyczne odniesienia w timeline i dokumentacji

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:08:39 +01:00
d0dda10bd7 feat(zopk): Panel admina bazy wiedzy, poprawa odpowiedzi AI, timeline
Priorytet 1 - Panel admina bazy wiedzy ZOPK:
- /admin/zopk/knowledge - dashboard ze statystykami
- /admin/zopk/knowledge/chunks - lista chunks z filtrowaniem
- /admin/zopk/knowledge/facts - lista faktów z typami
- /admin/zopk/knowledge/entities - lista encji z mentions
- CRUD operacje: weryfikacja, usuwanie

Priorytet 2 - Poprawa jakości odpowiedzi NordaGPT:
- Linki markdown do źródeł w kontekście ZOPK
- Ulepszone formatowanie (bold, listy, nagłówki)
- Sekcja "Źródła" na końcu odpowiedzi
- Instrukcje w system prompt dla lepszej prezentacji

Priorytet 3 - Timeline ZOPK:
- Model ZOPKMilestone w database.py
- Migracja 016_zopk_milestones.sql z sample data
- Sekcja "Roadmapa ZOPK" na stronie /zopk
- Pionowa oś czasu z markerami lat
- Statusy: completed, in_progress, planned, delayed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:56:55 +01:00
37af8abc73 feat(admin): Paski postępu dla operacji AI w panelu ZOPK
Dodano Server-Sent Events (SSE) dla śledzenia postępu w czasie rzeczywistym:
- Scraping treści artykułów
- Ekstrakcja wiedzy przez Gemini AI
- Generowanie embeddingów

Funkcje:
- Modal z paskiem postępu i statystykami
- Live log operacji z kolorowaniem statusów
- Podsumowanie na zakończenie (sukces/błędy/czas)
- Możliwość zamknięcia modalu po zakończeniu

Zmiany techniczne:
- 3 nowe SSE endpointy (/stream)
- ProgressUpdate dataclass w scraperze
- Callback pattern w batch_scrape, batch_extract, generate_chunk_embeddings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 23:23:05 +01:00
31d5a112b8 feat(admin): Sekcja Baza Wiedzy AI w panelu ZOPK
- Dodano sekcję "🧠 Baza Wiedzy AI" do /admin/zopk
- Statystyki scrapingu: zatwierdzonych, zescrapowanych, oczekujących
- Statystyki wiedzy: chunks, fakty, encje
- Statystyki embeddingów: z/bez embeddingów
- Przyciski: Scrapuj treść, Ekstrakcja AI, Generuj embeddingi
- Top encje z kolorowymi pillami (firmy, osoby, miejsca, projekty)
- Rozszerzono get_extraction_statistics() o pending_scrape i embeddings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 22:17:44 +01:00
3beacd8806 fix(zopk): Naprawa duplikatu ID aiEvalResult w modalu
Były dwa elementy z tym samym ID - JavaScript znajdował pierwszy
(poza modalem) zamiast właściwego wewnątrz modala.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:46:39 +01:00
1193a2bf48 feat(zopk): Re-ewaluacja newsów z niską oceną zawierających kluczowe tematy
- Nowa funkcja reevaluate_low_score_news() szuka newsów z 1-2★
  zawierających Via Pomerania, NORDA, S6, Droga Czerwona, etc.
- Nowy endpoint POST /admin/zopk/news/reevaluate-low-scores
- Przycisk w UI "Re-ewaluuj niskie oceny" z szczegółowym raportem
- Automatyczne auto-approve jeśli nowa ocena >= 3★

Problem: Artykuły o Via Pomerania miały 1★ bo były ocenione
         przed dodaniem tego tematu do promptu AI.
Rozwiązanie: Re-ewaluacja nowym promptem podniesie ich oceny.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:38:20 +01:00
0cbdcaaad6 feat(zopk): Szczegółowe statystyki wyników wyszukiwania newsów
- Zamiana auto-odświeżania na przycisk OK
- Dodanie sekcji szczegółowych statystyk (12 metryk)
- Dodanie listy artykułów odrzuconych przez AI
- Śledzenie czasu przetwarzania
- API zwraca nowe pola: sent_to_ai, ai_rejected_articles, processing_time

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:28:10 +01:00
61b8a8e797 feat(zopk): Add AI model info banner to dashboard
Shows:
- Current model: gemini-2.5-flash-lite
- Prompt version: v2 (2026-01-15)
- New topics: +7 infrastructure projects

Tooltip lists: Via Pomerania, S6, Droga Czerwona, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:19:12 +01:00
db02d3660f feat(zopk): Improve AI scoring and auto-approve threshold
Changes:
- Lower auto-approve threshold from 4★ to 3★ (verified 2026-01-15)
- Add detailed progress bar for ZOPK search process
- Add auto-approved articles list with star ratings
- Document ZOPK topics (ZOP Kaszubia) in CLAUDE.md
- Add 8-second countdown before auto-refresh

Technical:
- zopk_news_service.py: Changed score threshold from >=4 to >=3
- Templates: New CSS for progress phases and results display
- CLAUDE.md: Added "ZOP Kaszubia News" section with topic guidelines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:05:41 +01:00
200987b295 refactor: Rename ZOPK to ZOP Kaszubia in user-facing text
- Update navigation menu labels
- Update page titles and headings
- Update modal texts and notifications
- Keep internal class names (ZOPKNews, etc.) unchanged

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:41:18 +01:00
e8f479ff2f feat: Replace native dialogs with styled modals in ZOPK admin
- Add universal confirm/alert modal system with custom styling
- Add toast notifications for success/error feedback
- Replace all confirm(), alert(), prompt() with showConfirm/showToast
- Support for custom icons, titles, input fields
- Matches existing UI design patterns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 09:17:45 +01:00
3934cdf0ee fix: Improve AI evaluation UX - auto-reload and clear messaging
- Add auto-reload after successful evaluation (2s delay)
- Show 'Odświeżam stronę za 2 sekundy...' message
- Change button text to 'AI pracuje...' during processing
- Update progress text to 'AI dodaje gwiazdki...'
- Fix error state button labels to include AI prefix
- Ensures user knows what's happening at all times

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:10:15 +01:00
6ab71ea54b fix: Make AI usage explicit in button labels
- Change 'Oceń X nowych' to 'AI: Oceń X'
- Change 'Dodaj gwiazdki' to 'AI: Dodaj gwiazdki'
- Add 🤖 icon to both buttons
- Add tooltips explaining Gemini AI will be used
- Critical for transparency when AI is involved

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:04:17 +01:00
5924f4d298 fix: Clarify AI evaluation button - show count of unevaluated items
- Change label from 'Oceń przez AI' to 'Oceń X nowych'
- Add tooltip explaining what the button does
- Makes it clear that only unevaluated items will be processed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:03:20 +01:00
56da154442 fix: Make 'Nieocenione' filter clickable in ZOPK dashboard
- Change info-only div to clickable link with warning style
- Add ai_not_evaluated filter to show items where ai_relevant is NULL
- Consistent UX with other filter cards

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:01:39 +01:00
87d18b65ed feat: Add re-evaluation function for 1-5 star scores
- Add reevaluate_news_without_score() to upgrade old binary evals to stars
- Add /admin/zopk/news/reevaluate-scores endpoint
- Add ai_missing_score stat to dashboard
- Add 'Dodaj gwiazdki' button in dashboard UI
- JS function with progress modal and auto-reload

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:53:58 +01:00
e399022223 feat: Add 1-5 star rating to ZOPK news AI evaluation
- Add ai_relevance_score column (1-5) to zopk_news table
- Update AI prompt to return score with detailed criteria:
  * 1 star = very weak (loose connection to region/industry)
  * 2 stars = weak (general industry news)
  * 3 stars = medium (relates to ZOPK industry but not directly)
  * 4 stars = strong (directly about ZOPK investments/companies)
  * 5 stars = perfect (main topic is ZOPK, Kongsberg, offshore Baltic)
- Display star ratings in admin dashboard with color-coded badges
- Score >= 3 marks news as relevant, < 3 as not relevant

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:34:36 +01:00
8dda8e311f fix: Improve AI evaluation modal UX with better progress feedback
- Show elapsed time counter during AI evaluation
- Display encouraging messages based on time (30s, 60s thresholds)
- Add 3-minute timeout with AbortController
- Reduce default limit from 50 to 20 items for faster response
- Update modal text to show expected duration (30-60 seconds)
- Better error handling for timeout vs connection errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:28:50 +01:00
0b475ef1b6 feat: Replace browser confirm() with custom GUI modal for AI evaluation
- Add AI evaluation modal with three states (confirm, progress, result)
- Add progress bar with animated fill during API call
- Add result stats display (evaluated, relevant, not relevant)
- Style modal icons, animations (spin), and result stats grid

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:22:25 +01:00
a0db0af6c8 feat: AI-based news relevance evaluation using Gemini
- Add ai_relevant, ai_evaluation_reason, ai_evaluated_at columns to zopk_news
- Add evaluate_news_relevance() and evaluate_pending_news() functions
- Add /admin/zopk/news/evaluate-ai endpoint
- Add AI filter tiles (Pasuje wg AI, Nie pasuje wg AI)
- Add "Oceń przez AI" button with progress feedback
- Show AI evaluation badge on news items
- Add new sources: Norda FM, Twoja Telewizja Morska, Nadmorski24.pl, Facebook (Samsonowicz)

AI evaluates news against ZOPK topics: offshore wind, nuclear plant,
Kongsberg investment, data centers, hydrogen labs, key people.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:13:08 +01:00
61837c7f0a style: Separate ZOPK dashboard stats into info vs filter sections
- Add CSS for .stats-section, .stats-section-title, .stats-grid-small
- Clear visual separation: "Baza wiedzy ZOPK" (info only) and
  "Filtruj newsy" (clickable filters) with descriptive headers
- Improves UX by making clickable/non-clickable cards obvious

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:07:11 +01:00
72c303a04c fix: Make only news stat cards clickable filters
- Projektów, Interesariuszy, Materiałów are now info-only (not filters)
- Only Oczekujących, Zatwierdzonych, Odrzuconych filter the news list
- Added info-only CSS class with reduced opacity and no hover effect
- Added tooltips to explain card purpose

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:02:56 +01:00
b824f6d450 feat: Add pagination, filters and old news management to ZOPK dashboard
- Add clickable stat cards to filter news by status (pending/approved/rejected)
- Add pagination (20 items per page) with navigation controls
- Filter out old news by default (before 2024 - ZOPK didn't exist)
- Show warning about hidden old news with option to show or reject all
- Add endpoint to bulk reject old news (/admin/zopk/news/reject-old)
- Add old news badge (⚠️ Sprzed 2024) for visibility
- Add status badges for approved/rejected news
- Update news list to show all statuses with appropriate actions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 06:58:43 +01:00
6dbe280f2f feat: Add progress bar and source info to ZOPK news search
- Add animated progress bar showing search progress through sources
- Display source type badges (Brave, Media lokalne, Rząd, Agregator)
- Show confidence score and source count for each news item
- Auto-refresh page after successful search (3s delay)
- Display source statistics after search completion
- Consistent UI with SEO/GBP audit dashboards

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 06:49:13 +01:00
d51637a226 feat: Add ZOPK (Zielony Okręg Przemysłowy Kaszubia) knowledge base
- Add database models for ZOPK projects, stakeholders, news, resources
- Add migration with initial data (5 projects, 7 stakeholders)
- Implement admin dashboard with news moderation workflow
- Add Brave Search API integration for automated news discovery
- Create public knowledge base pages (index, project detail, news list)
- Add navigation links in main menu and admin bar

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 06:32:27 +01:00