Commit Graph

259 Commits

Author SHA1 Message Date
c8f70dc2cf refactor: Centralizacja COMPANY_COUNT_MARKETING = 150
- Dodano stałą globalną COMPANY_COUNT_MARKETING w app.py
- Dodano do context_processor jako COMPANY_COUNT
- Zaktualizowano szablony: index.html, chat.html, landing.html, release_notes
- Jedno miejsce do zmiany gdy Izba zaktualizuje cel

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 00:27:04 +01:00
79c1b2ddd9 feat(health): Nowe endpointy + połączenie release notes v1.19.0
Health monitoring:
- Dodano: /settings/privacy, /settings/blocks, /settings/2fa
- Dodano: /wiadomosci, /wiadomosci/wyslane, /wiadomosci/nowa
- Dodano: /edukacja, /admin/insights

Release notes:
- Połączono v1.18.0 i v1.19.0 w jeden wpis (28 stycznia 2026)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 00:21:43 +01:00
6b8840cf92 feat(categories): Reorganizacja kategorii + release notes v1.19.0
Zmiany w kategoriach:
- Utworzono "Budownictwo ogólne" (9 firm) i "Produkcja ogólna" (13 firm)
- Utworzono "Usługi finansowe" (banki, kantory, ubezpieczenia)
- Rozdzielono "Księgowość" od "Usługi finansowe"
- Przeniesiono INPI i SEO PARTNER do "IT i Technologie"
- Dodano kategorię "Do uzupełnienia" (żółta, 27 firm bez opisu)

Zmiany UI:
- Sortowanie podkategorii malejąco po liczbie firm
- Poprawka podświetlania aktywnej kategorii
- Dropdown blokowania: domena emaila przy duplikatach nazw

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 00:19:22 +01:00
6c1059f133 docs(release): Dodanie v1.18.0 do release notes
Nowe funkcje w v1.18.0 (28 stycznia 2026):
- Prywatność: ukrywanie telefonu/emaila, preferencje kontaktu
- Blokowanie kontaktów (bidirectional)
- Hierarchiczne kategorie firm
- Platforma Edukacyjna
- Panel Insights dla adminów
- RODO: sanityzacja danych wrażliwych w czacie
- Security: izolacja sesji czata

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 23:19:39 +01:00
b19dfa7227 feat(insights): Baza wiedzy i insights dla rozwoju portalu
System zbierania feedbacku z interakcji użytkowników:
1. Źródła wiedzy:
   - Forum (tematy, odpowiedzi)
   - Chat AI (tylko odpowiedzi asystenta - fakty publiczne)
   - Analiza wzorców pytań (zanonimizowana)

2. Kategorie insights:
   - feature_request (propozycje funkcji)
   - bug_report (zgłoszenia błędów)
   - company_search (wyszukiwania firm)
   - question (częste pytania)

3. Panel admina: /admin/insights
   - Przeglądanie insights
   - Zmiana statusów (new → planned → implemented)
   - Synchronizacja z forum/chat

PRIVACY: Pytania użytkowników są analizowane wzorcowo (anonimizacja),
treść pytań NIE trafia do bazy wiedzy.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:09:05 +01:00
ca03cb0b3b feat(security): Silnik sanityzacji danych wrażliwych (RODO)
Automatyczne wykrywanie i maskowanie danych wrażliwych w czacie:
- PESEL (walidacja sumy kontrolnej)
- Numery kart kredytowych (algorytm Luhn)
- IBAN (konta bankowe)
- Hasła (detekcja kontekstowa)
- Dowody osobiste i paszporty

NIE wykrywa (zgodnie z wymogami):
- NIP (publiczne dane biznesowe)
- Adresy email (celowo podawane)

API dla adminów: POST /api/admin/test-sanitization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:00:18 +01:00
e7483269a0 security(chat): Izolacja sesji czata i anonimizacja danych
ZMIANY BEZPIECZEŃSTWA:

1. Defense in depth w NordaBizChatEngine:
   - send_message() - wymaga user_id i weryfikuje właściciela rozmowy
   - get_conversation_history() - opcjonalna walidacja user_id
   - Logowanie prób nieautoryzowanego dostępu

2. Anonimizacja w panelu admina:
   - Usunięto wyświetlanie treści zapytań użytkowników
   - Zastąpiono statystykami: długość, kategoria tematyczna
   - Zachowano AI responses (publiczne dane firm)

3. Ochrona prywatności:
   - Użytkownicy NIE mogą zobaczyć zapytań innych użytkowników
   - Admini widzą tylko zanonimizowane statystyki
   - Audit logging dla prób nieautoryzowanego dostępu

Odblokowuje zadanie #10 (Baza wiedzy Norda GPT).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 21:56:35 +01:00
e2ceba4310 feat(privacy): Dodanie preferencji kanałów kontaktu
Użytkownicy mogą teraz wskazać preferowane kanały komunikacji:
- Email, telefon, wiadomości w portalu (toggle)
- Dodatkowa notatka (np. najlepsze godziny kontaktu)

Migracja: 031_add_contact_preferences.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 21:06:15 +01:00
c09a622463 feat(categories): Hierarchiczny filtr kategorii w UI
- Główne kategorie jako wyróżnione przyciski
- Podkategorie z mniejszym fontem
- filterCategoryGroup() - filtruje po grupie (główna + podkategorie)
- Nowe style: category-main, category-sub, category-group
- Zachowano kompatybilność wsteczną z płaską strukturą

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 21:02:04 +01:00
1fb938feb3 feat(blocks): System blokowania użytkowników
- Nowa tabela user_blocks do przechowywania blokad
- Model UserBlock w database.py
- Sprawdzanie blokad przed wysłaniem wiadomości (messages_send, messages_reply)
- UI zarządzania blokadami w /settings/blocks
- Nawigacja między ustawieniami (prywatność, blokady, 2FA)
- Blokada działa w obie strony

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:44:38 +01:00
66f6c1d60e feat(privacy): Ustawienia prywatności użytkownika
- Nowe pola: privacy_show_phone, privacy_show_email w tabeli users
- Nowy route /settings/privacy z UI do zarządzania prywatnością
- Link "Ustawienia" w menu użytkownika
- Toggle switches do włączania/wyłączania widoczności danych
- Migracja SQL: 028_add_user_privacy_settings.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:35:50 +01:00
ce7c78bda9 feat(notifications): Add notifications for releases and announcements
- notify_all_users_release(): Notify all users about new system version
- notify_all_users_announcement(): Notify all users about new announcement
- Auto-send notifications when admin publishes an announcement
- New admin endpoint POST /admin/notify-release for manual release notifications
- Category-specific icons for announcement notifications

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 14:22:44 +01:00
827a4df1e2 feat: Endpoint testowy /test-error-500 dla weryfikacji powiadomień
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 13:00:39 +01:00
acae42869c refactor: Powiadomienia email przez Microsoft Graph zamiast SMTP
- Używa istniejącego email_service.py z Microsoft Graph API
- Ładniejszy HTML email z dark theme
- Usunięto niepotrzebne importy smtplib/MIMEText

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 12:59:55 +01:00
3584bba717 feat: Powiadomienia email o błędach 500
- Dodano send_error_notification() - wysyła email przy błędzie 500
- Szczegóły: URL, ścieżka, user, IP, traceback
- Konfiguracja: ERROR_NOTIFY_EMAIL, SMTP_HOST, SMTP_PORT
- Domyślnie: maciej.pienczyn@inpi.pl

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 12:55:41 +01:00
daf24256fc fix(health): Dodaj trailing slash do /raporty w health check
Naprawia ostrzeżenie HTTP 308 w Health Check Dashboard.
Flask blueprint z url_prefix='/raporty' wymaga trailing slash.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 10:50:30 +01:00
66856a697d refactor(phase1): Extract blueprints for reports, contacts, classifieds, calendar
Phase 1 of app.py refactoring - reducing from ~14,455 to ~13,699 lines.

New structure:
- blueprints/reports/ - 4 routes (/raporty/*)
- blueprints/community/contacts/ - 6 routes (/kontakty/*)
- blueprints/community/classifieds/ - 4 routes (/tablica/*)
- blueprints/community/calendar/ - 3 routes (/kalendarz/*)
- utils/ - decorators, helpers, notifications, analytics
- extensions.py - Flask extensions (csrf, login_manager, limiter)
- config.py - environment configurations

Updated templates with blueprint-prefixed url_for() calls.

⚠️ DO NOT DEPLOY before presentation on 2026-01-30 19:00

Tested on DEV: all endpoints working correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 10:10:45 +01:00
1fe927dc17 fix(contacts): Naprawa API ai-parse - kompatybilność pól z frontend
- Obsługa pola 'text' z frontendu (oprócz 'content')
- Zmiana nazw pól odpowiedzi: ai_response→analysis, proposed_contacts→contacts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 08:57:03 +01:00
ffc766d034 feat(contacts): Modal "Dodaj z AI" + widoki grupowanie/tabela
- Dodano modal "Dodaj z AI" z parsowaniem tekstu/obrazów przez Gemini
- API endpoints: /api/contacts/ai-parse, /api/contacts/bulk-create
- Nowy widok grupowania kontaktów po organizacji (domyślny)
- Widok tabeli dla kompaktowego przeglądu
- Przełącznik widoków z zapamiętywaniem preferencji
- Drag & drop dla zdjęć wizytówek
- Docker: PostgreSQL 16 (zgodność z produkcją)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 08:52:35 +01:00
21a78befad feat(contacts): Baza kontaktów zewnętrznych dla członków Norda
- Nowy model ExternalContact z pełnymi danymi kontaktowymi, social media, related_links (JSONB)
- Migracja SQL 020_external_contacts.sql z full-text search
- Routes: /kontakty (lista), /kontakty/dodaj, /kontakty/<id>, /kontakty/<id>/edytuj
- Szablony: lista z filtrami, karta szczegółów, formularz CRUD
- Nawigacja: link "Kontakty zewnętrzne" w dropdown Społeczność
- Poprawka: aktualizacja liczby firm z 80 na 111

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 08:35:06 +01:00
a172f7af49 feat(announcements): Śledzenie odczytów ogłoszeń (seen by)
- Nowa tabela announcement_reads do śledzenia kto przeczytał
- Avatary użytkowników z inicjałami (tooltip z nazwiskiem)
- Statystyki: liczba i procent użytkowników którzy przeczytali
- Progress bar wizualizujący zasięg ogłoszenia
- Automatyczny zapis odczytu przy otwarciu ogłoszenia

Autor: Maciej Pienczyn
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 08:19:39 +01:00
d443fe312e docs: Release notes v1.17.0 - System ogłoszeń i aktualności
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 22:31:42 +01:00
e14d95394d feat(announcements): System ogłoszeń i aktualności dla członków
- Model Announcement z kategoriami, statusami, slugami URL
- Panel admina /admin/announcements (CRUD, filtry, AJAX)
- Strona /ogloszenia tylko dla zalogowanych członków
- Szczegóły ogłoszenia /ogloszenia/<slug>
- Migracja SQL rozszerzająca istniejącą tabelę
- Testowe ogłoszenia: ARP baza noclegowa, Tytani Przedsiębiorczości
- Pliki PDF regulaminu i harmonogramu konkursu Tytani

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 22:10:54 +01:00
40116d3321 feat(zopk): Timeline auto-populate + fix /zopk 500 + rozszerzony health check
- Dodano funkcje automatycznego uzupełniania Timeline z bazy wiedzy:
  - get_timeline_suggestions() - pobiera milestone facts jako sugestie
  - create_milestone_from_suggestion() - tworzy milestone z faktu
  - categorize_milestones_with_ai() - kategoryzacja AI (nuclear/offshore/etc)
  - Auto-detekcja kategorii, dat i statusu z tekstu polskiego

- API endpoints:
  - GET /api/zopk/timeline/suggestions - lista sugestii z bazy wiedzy
  - POST /api/zopk/timeline/suggestions/approve - zatwierdź sugestię

- Fix: /zopk zwracał 500 (nieistniejąca kolumna is_verified)
  - Dodano kolumnę is_verified do modelu ZOPKMilestone
  - Usunięto filtr is_verified z query (do migracji)

- Health check rozszerzony z 15 do 55+ endpointów:
  - Public pages, Raporty, ZOPK, Chat, IT Audit
  - API publiczne, Admin Core, Admin Audits, Admin ZOPK

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 17:32:54 +01:00
009cd09492 fix: Poprawka składni @limiter.request_filter dla Flask-Limiter 4.0 2026-01-17 16:24:28 +01:00
d785b5094f fix(security): Wyłączenie rate limiting dla adminów
Zalogowani użytkownicy z is_admin=True są teraz wyłączeni z limitów
requestów (request_filter=is_admin_exempt). Rozwiązuje problem
"Too Many Requests" w panelu admina ZOPK.

Limity dla zwykłych użytkowników pozostają bez zmian:
- 200/dzień
- 50/godzinę

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 16:23:05 +01:00
818ddd96eb feat(zopk-knowledge): Dodanie funkcji uczenia się z weryfikacji
- Nowa funkcja find_similar_to_verified_facts() w zopk_knowledge_service.py
  używa pg_trgm do wyszukiwania podobnych faktów
- Nowa funkcja auto_verify_similar_to_verified() automatycznie weryfikuje
  fakty podobne do już zweryfikowanych (próg 80% podobieństwa)
- Nowy endpoint POST /api/zopk/knowledge/auto-verify/similar
- Nowy endpoint GET /api/zopk/knowledge/suggest-similar-facts
- Przycisk "Ucz się z weryfikacji" na dashboardzie bazy wiedzy ZOPK

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 16:21:08 +01:00
96fa0058c2 feat(zopk): Rozbudowa bazy wiedzy ZOPK
- Dodano skrypt cron do automatycznej ekstrakcji wiedzy (scripts/cron_extract_knowledge.py)
- Dodano panel deduplikacji faktów (/admin/zopk/knowledge/fact-duplicates)
- Dodano API i funkcje auto-weryfikacji encji i faktów
- Dodano panel Timeline ZOPK (/admin/zopk/timeline) z CRUD
- Rozszerzono dashboard bazy wiedzy o statystyki weryfikacji i przyciski auto-weryfikacji
- Dodano migrację 016_zopk_milestones.sql dla tabeli kamieni milowych
- Naprawiono duplikat modelu ZOPKMilestone w database.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 10:57:11 +01:00
b69882bbb2 perf(zopk): Cache dla grafu relacji (TTL 5 min)
- Dodano in-memory cache dla API /api/zopk/knowledge/graph/data
- Cache key oparty o parametry: entity_type, min_cooccurrence, limit
- TTL = 300 sekund (5 minut)
- Flaga 'cached' w odpowiedzi informuje czy dane z cache

Korzyść: Drugie i kolejne ładowania grafu są natychmiastowe.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 09:34:52 +01:00
85c3f75e9b feat(zopk): Graf relacji encji (Priorytet 5)
- Dodano endpoint /admin/zopk/knowledge/graph z wizualizacją D3.js
- Dodano API endpoint /api/zopk/knowledge/graph/data
- Graf współwystępowania encji z kolorami według typu
- Rozmiar węzłów proporcjonalny do liczby wzmianek
- Filtry: typ encji, minimalna liczba współwystąpień
- Tooltips z informacjami o encjach
- Zoom i drag-and-drop interakcje

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 09:14:30 +01:00
143f5c674a feat(zopk): Implementacja łączenia duplikatów encji (Priorytet 4)
Nowe funkcje w zopk_knowledge_service.py:
- find_duplicate_entities() - wyszukiwanie podobnych encji (pg_trgm)
- merge_entities() - łączenie encji z transferem relacji
- get_entity_merge_preview() - podgląd przed połączeniem

Nowe endpointy w app.py:
- GET /admin/zopk/knowledge/duplicates - panel zarządzania duplikatami
- POST /api/zopk/knowledge/duplicates/preview - podgląd merge
- POST /api/zopk/knowledge/duplicates/merge - wykonanie merge

Nowy szablon:
- templates/admin/zopk_knowledge_duplicates.html - UI z kartami encji

Dodatkowo:
- Aktualizacja CLAUDE.md z procedurą wdrażania
- Skrypt scripts/run_migration.py do uruchamiania migracji SQL

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 09:09:22 +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
900a3b4ed9 fix(admin): Naprawiono błąd importu w SSE scraping endpoint
Problem: Podwójny import ZOPKContentScraper powodował błąd 'cannot access local variable'
Rozwiązanie: Przeniesiono import na początek funkcji generate()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 23:28:16 +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
498f273aba fix(admin): Naprawiono strukturę danych w przyciskach ZOPK
- Naprawiono showKnowledgeStats - używa prawidłowej zagnieżdżonej struktury
- Naprawiono endpoint embeddings - renamed 'success' count to 'generated'
- Naprawiono endpoint extract - renamed 'success' count to 'processed'
- Unikamy nadpisywania flagi 'success: True' przez spread operator

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:27:02 +01:00
1b4cd31c41 feat(zopk): Knowledge Base + NordaGPT integration (FAZY 0-3)
FAZA 0 - Web Scraping:
- Migracja 015: pola full_content, scrape_status w zopk_news
- zopk_content_scraper.py: scraper z rate limiting i selektorami

FAZA 1 - Knowledge Extraction:
- zopk_knowledge_service.py: chunking, facts, entities extraction
- Endpointy /admin/zopk/knowledge/extract

FAZA 2 - Embeddings:
- gemini_service.py: generate_embedding(), generate_embeddings_batch()
- Model text-embedding-004 (768 dimensions)

FAZA 3 - NordaGPT Integration:
- nordabiz_chat.py: _is_zopk_query(), _get_zopk_knowledge_context()
- System prompt z bazą wiedzy ZOPK
- Semantic search w kontekście chatu

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:15:30 +01:00
0f1cf6176a fix(health): Usunięcie nieistniejącego endpointu /admin/news
Endpoint /admin/news był planowany (dokumentacja CLAUDE.md) ale nigdy
nie zaimplementowany. Tylko /admin/zopk/news istnieje.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 21:31:10 +01:00
0a5f40879b fix(admin): Naprawa błędu 500 na /admin/fees + rozszerzenie health check
1. Context processor bug: datetime.now → datetime.now()
   - Szablon fees.html używa now.strftime(), potrzebuje wartości nie metody
   - Powodowało jinja2.UndefinedError na /admin/fees

2. Health check: dodano brakujące endpointy admina
   - /admin/fees (Składki/FIS)
   - /admin/news (News moderacja)
   - /admin/zopk/news (ZOPK News)
   - /admin/recommendations (Rekomendacje)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 21:27:18 +01:00
819192bdad feat(zopk): Rozszerzony widok aktualności ze statystykami czasowymi
- Dodano pasek statystyk newsów (łącznie, dzień, tydzień, miesiąc)
- Zwiększono limit wyświetlanych newsów z 10 do 25
- Usunięto przycisk "Zobacz wszystkie" - pełny widok od razu
- Przycisk "Starsze aktualności" pojawia się gdy jest więcej niż 25

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:56:00 +01:00
489f04d04d fix(zopk): Newsy auto_approved teraz widoczne na stronie publicznej
BUG: Strona publiczna pokazywała tylko status='approved',
     ale AI ustawia status='auto_approved' dla newsów 3+★.

Wynik: Newsy zatwierdzone przez AI NIE pojawiały się publicznie!

Naprawione miejsca:
- /zopk (strona główna ZOPK)
- /zopk/projekt/<slug> (szczegóły projektu)
- /zopk/aktualnosci (lista newsów)

Teraz wszystkie 3 miejsca pokazują obie wartości:
status IN ('approved', 'auto_approved')

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:50:35 +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
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
90da6b9c64 fix: Treat HTTP 429 as OK in health check
429 (Too Many Requests) means the endpoint is working correctly
and is protected by rate limiting - this is expected behavior
for /register endpoint.

- Add 429 to acceptable status codes (200, 302, 304, 429)
- Update legend to explain 429 means protection is working
- Apply to all health check endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 04:15:39 +01:00
3acbc53b87 fix: Health check - INPI, Waterm + 3 random companies
- Always check INPI and Waterm profiles (fixed)
- Add 3 random company profiles each refresh
- Total 5 company profiles tested for better coverage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 04:12:22 +01:00
54b3b94482 feat: Add graphical Health Check dashboard
- Add /admin/health route with visual status indicators
- Create health_dashboard.html with category-based endpoint cards
- Color-coded status: green (OK), yellow (warning), red (error)
- Show response times with color indicators (fast/medium/slow)
- Add HTTP status code legend
- Auto-refresh every 2 minutes
- Add link in admin navigation menu
- Categories: public pages, auth, API, admin panel, company profiles

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:56:43 +01:00
23f109db2c fix: Update technology stack with verified versions only
- Verify all software versions via SSH (NORDABIZ-01, R11-REVPROXY-01, Proxmox)
- Remove Redis (not used), Gunicorn (app runs directly via python)
- Add PostgreSQL version dynamic fetch from database
- Add Docker version for R11-REVPROXY-01
- Update all package versions to verified values
- Handle unknown versions (Fortigate) with yellow "nieznana" badge
- Add comment with verification date (2026-01-14)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:48:21 +01:00
38682bf808 fix: Correct admin calendar path in health check (/admin/kalendarz)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:39:03 +01:00
03bd90f33b feat: Add system status dashboard with tech stack visualization
- Add /admin/status route with real-time system metrics (CPU, RAM, disk)
- Add /api/admin/status API endpoint for auto-refresh
- Add technology stack section showing all platform technologies
- Add auto-refresh (5 min) to GeoIP stats in security dashboard
- Add "Status systemu" link to admin navigation menu
- Fix /health/full endpoint list (remove non-existent endpoints)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:35:25 +01:00
8ed3724970 feat: Add extended health check endpoint /health/full
- Checks 14 critical endpoints (public + admin pages)
- Returns JSON with pass/fail status for each endpoint
- HTTP 200 if all OK, HTTP 503 if any failures
- Useful for deployment verification and monitoring

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:25:13 +01:00
6402ff7f0e docs: Update release notes and CLAUDE.md with security features
- Add GeoIP blocking, security panel, and stats to v1.16.0 release notes
- Add comprehensive security mechanisms table to CLAUDE.md
- Document GeoIP configuration and MaxMind setup
- List all 12 security mechanisms with star ratings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:20:32 +01:00
e9e37796c7 feat: Add security mechanisms list and GeoIP stats to admin dashboard
- New 'Mechanisms' tab listing all security features with star ratings (5★=critical)
- New 'GeoIP' tab with blocking statistics (daily/monthly/yearly/total)
- Country breakdown with flags for blocked connections
- Status indicators for each security mechanism

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:16:33 +01:00
cb574851cf feat: Add GeoIP blocking for high-risk countries (RU, CN, KP, IR, BY, SY, VE, CU)
- Update security_service.py with BLOCKED_COUNTRIES list
- Add check_geoip() middleware in app.py
- Log blocked attempts with security alerts
- Uses MaxMind GeoLite2-Country database

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:11:53 +01:00
0dba52e9c4 feat: Add security features - 2FA, audit log, alerting
Security enhancements:
- Two-Factor Authentication (TOTP) for all users
  - Enable/disable 2FA in settings
  - Backup codes for recovery
  - Login flow with 2FA verification
- Audit log for admin actions
  - Track all sensitive operations
  - IP address and user agent logging
- Security alerts system
  - Alert types: brute_force, honeypot_hit, account_locked, geo_blocked
  - Email notifications for high/critical alerts
  - Dashboard for alert management
- Admin security dashboard (/admin/security)
  - View/acknowledge/resolve alerts
  - Unlock locked accounts
  - 2FA status overview

New files:
- security_service.py: Security utilities
- templates/auth/verify_2fa.html
- templates/auth/2fa_settings.html
- templates/auth/2fa_setup.html
- templates/auth/2fa_backup_codes.html
- templates/admin/security_dashboard.html

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 21:23:27 +01:00
7226e098f6 feat: Honeypot endpoints for malicious bot detection
- Trap URLs: /wp-admin, /phpmyadmin, /.env, /.git/config, etc.
- Log to security.log for fail2ban integration
- Instant 24h ban via fail2ban after 1 hit
2026-01-14 21:13:05 +01:00
10dcbde7a8 feat: Account lockout after 5 failed login attempts
- Lock account for 30 minutes after 5 failed attempts
- Reset counter on successful login
- Log ACCOUNT_LOCKED events to security log
2026-01-14 21:11:33 +01:00
2efad9ba82 feat: Use Redis for rate limiter storage (persistent limits) 2026-01-14 21:08:48 +01:00
b6c58c9312 feat: Add security logger for fail2ban integration
- Security events logged to /var/log/nordabiznes/security.log
- Failed login attempts include IP address
- Format compatible with fail2ban filter
2026-01-14 21:07:09 +01:00
af3ba43c89 feat: Dynamic stats in release notes (companies, categories from DB) 2026-01-14 17:31:10 +01:00
1147e7e27c chore: Merge duplicate release notes (11 Jan, 10 Jan)
- v1.12.0 + v1.13.0 → v1.13.0 (11 stycznia 2026)
- v1.10.0 + v1.11.0 → v1.11.0 (10 stycznia 2026)

One version per day rule applied.
2026-01-14 15:10:53 +01:00
0b1dc49298 chore: Merge release notes from Jan 14 into single v1.16.0 entry
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 15:07:39 +01:00
22e73e4f80 feat: Email DKIM/SPF/DMARC config + year_established data fill
- Added release notes v1.19.0 with today's changes
- Email: DKIM, SPF, DMARC configured for nordabiznes.pl
- Data: year_established filled for 71/111 companies (64%)
- Script: fix_year_established.py for KRS date migration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 15:01:01 +01:00
749abfa018 fix: Use category_id instead of category relationship in report
- Company.category is a relationship, not a column
- Use Company.category_id for grouping and filtering
- Load category names via separate query to Category table

Fixes 500 error on /raporty/struktura-branzowa

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 08:30:35 +01:00
14e969bc6d fix: Fix AttributeError in report_categories
- Add .label('category') to SQLAlchemy query for proper Row attribute access
- Change filter_by to filter() for better NULL handling

Fixes 500 error on /raporty/struktura-branzowa

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 08:29:00 +01:00
c06df1f69a feat: Upgrade NordaGPT to Gemini 2.5 Flash-Lite + add model info modal
- Changed AI model from Gemini 2.0 Flash to Gemini 2.5 Flash-Lite
- Added info button next to model badge in chat header
- Created modal with technical specs and development history timeline
- Benefits: 8x longer responses (65k tokens), 4x daily limit (1000 RPD)
- Model remains FREE (Free Tier)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 08:09:04 +01:00
c16fe79724 fix: Dodano @csrf.exempt do API endpointów chatu
Endpointy /api/chat/start i /api/chat/{id}/message
wymagały tokenu CSRF, co blokowało żądania z JavaScript.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 07:55:36 +01:00
26e17ba1e3 fix: Naprawiono błąd w API konwersacji (started_at zamiast created_at)
Model AIChatConversation używa started_at, nie created_at.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 07:42:19 +01:00
80c0b0005c feat: Historia konwersacji NordaGPT z sidebare'em
- Dodano API /api/chat/conversations (lista konwersacji użytkownika)
- Dodano API DELETE /api/chat/<id>/delete (usuwanie konwersacji)
- Przebudowano chat.html z sidebarem historii (styl ChatGPT)
- Sidebar z listą konwersacji, przyciski "Nowa rozmowa" i usuwania
- Responsywny design dla mobile (toggle sidebar)
- Integracja ze stylem NordaGPT (purple gradient header)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 07:39:36 +01:00
1b6e698d87 feat: Nowa sekcja Raporty w menu głównym
- Dodano link Raporty w menu nawigacyjnym (dla zalogowanych)
- Utworzono 3 raporty generowane w czasie rzeczywistym:
  - Staż członkostwa w Izbie NORDA
  - Pokrycie Social Media (6 platform)
  - Struktura branżowa (kategorie firm)
- Dodano dokumentację strategii monetyzacji 3-tier pricing
- Release notes v1.18.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 07:25:57 +01:00
8f1a7d6706 feat: Add release notes v1.17.0 for member_since feature
- Data przystąpienia do Izby NORDA (member_since)
- Karta "Członek Izby NORDA od" z datą i stażem w latach
- Import 57 firm z historią od 1997 roku

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 06:59:52 +01:00
3221740502 feat: Dodanie daty przystąpienia do Izby NORDA na profilu firmy
- Nowa kolumna member_since w tabeli companies
- Karta "Członek Izby NORDA od" na profilu firmy (niebieski kolor #3b82f6)
- Wyświetlanie liczby lat w Izbie
- Import 57 dat przystąpienia z pliku Excel od Artura
- Skrypt import_member_since.py do importu dat

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 06:57:00 +01:00
c1e770f806 fix: Rozdzielenie release notes na v1.15.0 (13.01) i v1.16.0 (14.01) 2026-01-14 06:38:48 +01:00
95b7aedcf3 fix: Poprawiono wyświetlanie pełnych nazw użytkowników w Analytics (word-wrap) 2026-01-14 06:26:04 +01:00
d82dc0caec feat: Add user edit functionality in admin panel
- Add /admin/users/<id>/update endpoint to update name, email, phone
- Add edit button with pencil icon to users table
- Add edit modal with form fields
- Add JavaScript functions for edit modal handling
2026-01-13 21:17:34 +01:00
f3433d28f5 fix: Add CSRF exempt for analytics API endpoints 2026-01-13 19:46:29 +01:00
986fa457cc fix: Correct redirect endpoint in analytics error handler 2026-01-13 19:43:26 +01:00
a148d464af feat: Add user analytics panel (/admin/analytics)
- Track user sessions, page views, clicks
- Measure engagement score and session duration
- Device breakdown (desktop/mobile/tablet)
- User rankings by activity
- Popular pages statistics
- Recent sessions feed
- SQL migration for analytics tables
- JavaScript tracker for frontend events

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 19:40:37 +01:00
ab668acf84 fix: Increase SEO audit rate limit from 10/hour to 200/hour
Batch SEO audit was stopping after 10 companies due to
restrictive rate limit. Increased to 200/hour to allow
full batch processing of all companies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 19:00:53 +01:00
feb57e001b fix: Increase login rate limit from 5/hour to 30/minute - critical fix for user access 2026-01-13 18:52:35 +01:00
153b0489d8 debug: Add permission check logging for AI enrichment 2026-01-13 18:48:01 +01:00
cf31842287 feat: Add web search to AI enrichment
- Search Brave API for company news and web results
- Fetch company website content with BeautifulSoup
- Combine all sources (database, Brave, website) in AI prompt
- Return source usage info in API response
2026-01-13 18:36:52 +01:00
fdbe2d461b fix: Add missing time module import for AI enrichment 2026-01-13 18:32:41 +01:00
be57f1ba04 fix: Remove non-existent Company attributes (keywords, usp, values)
- keywords, usp fields don't exist in Company model
- values -> core_values
2026-01-13 18:30:36 +01:00
a4515aca74 fix: Correct Company model attribute names in AI enrichment endpoint
- services_text -> services relationship or services_offered
- competencies_text -> competencies relationship
- pkd_text -> pkd_description
- certifications field properly handled as relationship
2026-01-13 18:28:48 +01:00
35d53665e3 feat: Add AI enrichment button on company profile
- Add "Wzbogac dane AI" button visible to all users
- Button enabled only for admins and company owners
- New API endpoint POST /api/company/<id>/enrich-ai
- Integrates with Gemini AI to generate:
  - Business summary
  - Services list
  - Target market
  - Unique selling points
  - Company values
  - Certifications
  - Industry tags
- Rate limited to 5 requests/hour per user
- Results saved to CompanyAIInsights table

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 18:07:52 +01:00
5ded53a2c0 feat: Display all PKD codes on company detail page
- Show all PKD codes from KRS audit (not just main one)
- Primary PKD highlighted with 'GŁÓWNY' badge
- Secondary PKDs listed below with descriptions
- Fallback to CEIDG data if no KRS audit data
- Shows source (eKRS or CEIDG) and total count

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 17:46:35 +01:00
4e4b3f4ef0 feat: Add sortable columns and PKD display in KRS Audit panel
- All columns now sortable (click header to sort asc/desc)
- PKD codes displayed with primary code highlighted (★)
- Show first 2 PKD codes, click '+N more' for tooltip with all
- Backend returns full PKD codes list instead of just count

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 17:28:09 +01:00
bd23238c1a fix: Increase rate limit and add missing fields to KRS audit API
- Increase rate limit from 20/hour to 200/hour for batch operations
- Add nip, regon, liczba_udzialow, prokurenci_count to API response

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 17:16:16 +01:00
fa8645dc26 fix: Handle date objects in JSON serialization for KRS audit
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 17:05:14 +01:00
3069a232ca fix: Convert Decimal to float for JSONB serialization in KRS audit
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 17:01:02 +01:00
a909af4754 fix: Add missing Path import for KRS audit
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 16:57:58 +01:00
de52e6991c feat: Add KRS Audit panel with full PDF parsing
- New admin panel /admin/krs-audit for KRS data extraction
- Full PDF parser extracting: company data, capital, shares, PKD codes,
  management board, shareholders, procurators, financial reports
- API endpoints for single/batch audits and PDF download
- Company profile shows "Odpis PDF" button and last audit date
- Database migration for krs_audits, company_pkd, company_financial_reports

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 16:46:54 +01:00
7340337ec5 feat: Add event banner on homepage - "Kto weźmie udział?"
- Show next upcoming event banner on main page (after login)
- Display event title, date, time, location
- Show attendee count with Polish grammar
- Button changes to "Jesteś zapisany/a" when registered
- Orange gradient design to attract attention
- Responsive layout for mobile

Replaces WhatsApp polls for event attendance tracking.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 10:40:04 +01:00
2a4408327b feat: Add monthly grid view for calendar
- Add view toggle (List/Calendar) to calendar toolbar
- Implement monthly grid view with CSS Grid layout
- Add month navigation (previous/next)
- Color-coded event types (meeting, networking, webinar, other)
- Highlight today's date and weekends
- Polish month names
- Responsive design for mobile

URL params: ?view=grid&year=2026&month=1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 10:28:15 +01:00
6688b717cf docs: Update release notes - 80 companies audited
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 12:20:56 +01:00
22ff4d901a docs: Add Polish category translation to release notes v1.14.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 11:46:03 +01:00
66fe43081e fix: Add Polish characters to release notes v1.11.0-v1.14.0
- Fix missing Polish diacritics (ą, ę, ó, ś, ć, ł, ż, ź)
- Affected versions: v1.11.0, v1.12.0, v1.13.0, v1.14.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 11:40:38 +01:00
f28ea804d2 docs: Add release notes v1.14.0 - Audit improvements
New features:
- GBP audit: Educational section explaining Google Business Profile
- GBP audit: Direct link to Google Maps business listing
- GBP audit: Full audit with Places API for 40 companies
- Clickable audit banners linking to detail pages
- Inline audit sections on company profile

Improvements:
- Unified 5-level color scale for all audits
- Social Media score as percentage
- URL normalization for company websites

Fixes:
- ZOPK stakeholder duplicates removed
- Unique constraint to prevent future duplicates
- SEO score consistency between views

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 10:05:49 +01:00
337994ed3a fix: Social Media score as percentage, SEO score consistency
- Changed Social Media audit banner to show percentage score (e.g., 16%)
  instead of platform count, matching the detailed audit page
- Fixed SEO score inconsistency by sorting website_analysis query by
  seo_audited_at desc (same as seo_audit_dashboard)
- Both audit sections on company profile now show same values as
  their detailed pages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 23:18:50 +01:00
986360f7d5 feat: Add URL normalization and inline audit sections
- Add normalize_social_url() function to database.py to prevent
  www vs non-www duplicates in social media records
- Update update_social_media.py to normalize URLs before insert
- Update social_media_audit.py to normalize URLs before insert
- Add inline GBP Audit section to company profile
- Add inline Social Media Audit section to company profile
- Add inline IT Audit section to company profile

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 23:07:03 +01:00
91fea3ba2c security: Fix critical vulnerabilities in ZOP Kaszubia module
- Fix XSS: innerHTML → textContent for modal messages
- Fix XSS: Safe DOM element creation for toast notifications
- Add project_id validation in admin_zopk_news_add
- Add URL protocol validation (allow only http/https)
- Hide exception details from API responses (log instead)
- Add rate limiting (60/min) on public ZOPK routes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 21:07:13 +01:00
c9bde4f67d docs: Update release notes - ZOP Kaszubia rename 2026-01-11 15:45:18 +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
c67b6dcab3 docs: Update release notes v1.13.0 - logos and hidden events
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:34:24 +01:00
3e8700f98f docs: Add v1.13.0 release notes - Mapa Powiazan and person profiles
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:24:43 +01:00
3052f8dd5b fix: Import or_ and func from sqlalchemy in person search 2026-01-11 15:19:01 +01:00
6e133686b7 feat: Add person search to main search - partial name matching
- Search people by imiona/nazwisko with partial match (ILIKE)
- Display person cards with avatar, name, company count
- Show "Znaleziono X firm i Y osób"
- People section appears above companies if matches found

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:17:50 +01:00
b70477553f fix: Use User.name instead of User.full_name in person detail
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:17:09 +01:00
807e554832 feat: Person profile page and improved tooltip
- New /osoba/<id> route for person detail page
- Shows company roles with links to company pages
- Displays portal data (email, phone) if user has account
- Tooltip shows all company connections (no "4 wiecej" limit)
- Click on person node navigates to profile instead of filtering

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:16:05 +01:00
b29071ab84 fix: Correct company count in connections map - count unique companies not roles
- API: Count unique company_ids instead of all roles
- Tooltip: Show "X firmami (Y ról)" to distinguish companies from roles
- Bogdan Łaga has 6 unique companies with 9 roles (was showing 9 companies)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:13:56 +01:00
c7a46c5ada feat: Add /api/connections endpoint and people in company detail
- API endpoint for connections graph visualization
- Include Person/CompanyPerson data in company profile
- Support for Zarząd, Wspólnicy, Prokurenci, JDG relationships

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:10:04 +01:00
13ee367509 feat: AI learning from feedback + v1.12.0
AI Learning System:
- Add FeedbackLearningService for few-shot learning from user feedback
- Integrate learning context into chat prompts (nordabiz_chat.py)
- Add seed examples for cold start (when insufficient real feedback)
- Add /api/admin/ai-learning-status endpoint
- Add learning status section to chat analytics panel

Other Changes:
- Update release notes to v1.12.0
- Remove old password references from documentation (CLAUDE.md)
- Fix password masking in run_migration.py (use regex for any password)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 10:51:08 +01:00
6e00291a88 feat: AI usage user details + styled modals across app
- Add /admin/ai-usage/user/<id> route for detailed AI usage per user
- Add ai_usage_user.html template with stats, usage breakdown, logs
- Make user names clickable in AI usage dashboard ranking
- Replace all native browser dialogs (alert, confirm) with styled modals/toasts:
  - admin/fees.html, forum.html, recommendations.html, announcements.html, debug.html
  - calendar/admin.html, event.html
  - company_detail.html, company/recommend.html
  - forum/new_topic.html, topic.html
  - classifieds/view.html
  - auth/reset_password.html

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 10:30:35 +01:00
538957875d fix: Use User.name instead of first_name/last_name
User model has single 'name' field, not separate first/last name fields.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:57:31 +01:00
684235ad2a fix: AI monitoring dashboard bug fixes
- Fix type_labels keys to match actual feature names (ai_chat, zopk_news_evaluation)
- Fix SQLAlchemy query syntax (remove invalid .options())
- Add null safety for daily_history values in template

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:55:59 +01:00
3e77ffd206 feat: Add user/company rankings and period filters to AI dashboard
- Add period filter buttons (day/week/month/all)
- Add user ranking table with name, company, requests, tokens, cost
- Add company ranking table with unique users and costs
- Show user names in recent logs
- Add all-time statistics
- Rankings filtered by selected period

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:35:00 +01:00
bfe1cd897c feat: Add AI usage monitoring dashboard
- Add AIUsageLog, AIUsageDaily, AIRateLimit models to database.py
- Update gemini_service.py to log to new AIUsageLog table
- Create /admin/ai-usage dashboard with stats and charts
- Show daily/weekly/monthly requests, tokens, costs
- Track usage by type (chat, news_evaluation, etc.)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:21:07 +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
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
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
46ef40950f feat: Add multi-source news search with cross-verification for ZOPK
- Add ZOPKNewsService with multiple RSS sources (12 feeds)
- Implement cross-verification logic (3+ sources = auto_approved)
- Add title hash normalization for fuzzy deduplication
- Include government sources: MON, Ministerstwo Rozwoju
- Include Google News searches for key topics and people
- Add confidence scoring (1-5 based on source count)
- Update SQL migration with cross-verification columns

Sources: Brave API, trojmiasto.pl, Dziennik Bałtycki, Google News,
gov.pl/obrona-narodowa, gov.pl/rozwoj-technologia

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 06:41:31 +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
8ee5945ccd fix: Handle NULL views_count in forum and classifieds
- Forum topics and classifieds now handle NULL views_count gracefully
- Prevents TypeError when incrementing view counter
2026-01-11 06:03:13 +01:00
1b15a578e2 docs: Add release notes v1.11.0 - forum categories, statuses, attachments
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 21:28:07 +01:00
61e70ad67c feat: Forum categories, statuses, and multi-file attachments
- Add category selection (feature_request, bug, question, announcement)
- Add status tracking (new, in_progress, resolved, rejected) with admin controls
- Add file attachments support (JPG, PNG, GIF up to 5MB)
- Multi-file upload (up to 10 files per reply) with drag & drop and paste
- New FileUploadService with EXIF stripping for privacy
- Admin panel with status statistics and change modal
- Grid display for multiple attachments

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 21:26:20 +01:00
cdc53d9ff3 docs: Add release notes v1.10.0 - architecture docs and security improvements
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 14:57:43 +01:00
b3d039bbe3 docs: Add admin bar to release notes v1.9.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:23:09 +01:00
118c604579 docs: Add AI user creation to release notes v1.9.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:02:53 +01:00
809e573ff7 feat: AI-assisted user creation with Gemini integration
- Add POST /api/admin/users/ai-parse endpoint for text/image parsing
- Add POST /api/admin/users/bulk-create for batch user creation
- Add "Dodaj z AI" button with purple gradient in admin users panel
- Add 3-step modal flow (Input → Review → Results)
- Support text paste from any source (email, Excel, CRM, Slack)
- Support screenshot upload and clipboard paste (Ctrl+V / Cmd+V)
- AI extracts emails, names, matches companies, detects admin roles
- Display generated passwords with copy functionality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:01:30 +01:00
69460b05fe docs: Aktualizacja release notes v1.9.0
- Dodawanie użytkowników w panelu admina
- Wyświetlanie przypisanych firm
- Poprawki nazw użytkowników

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 19:04:13 +01:00
c1d033a9e2 feat: Panel użytkowników - dodawanie użytkowników i wyświetlanie firm
- Dodano endpoint POST /admin/users/add z generowaniem hasła
- Naprawiono wyświetlanie przypisanych firm (relationship Company)
- Dodano przycisk "Dodaj użytkownika" z modalem
- Naprawiono obcinanie nazw użytkowników w tabeli
- UI: modal z formularzem, wyświetlanie wygenerowanego hasła

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 18:31:50 +01:00
7455151c02 feat: Add admin user management panel with improved UI
- Add /admin/users panel for managing users (toggle admin, toggle verified, assign company, reset password, delete)
- Add link to admin menu in base.html
- Replace native confirm()/alert() with styled modals and toast notifications
- Add confirmation modal for password reset with warning icon
- Add styled reset URL modal with copy functionality
- Add danger-styled confirmation modal for user deletion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 17:27:23 +01:00
5af216c5e0 security: Fix critical vulnerabilities from security audit
- Remove sensitive tokens from logs (show only 8-char preview)
- Enforce SECRET_KEY minimum 32 characters (no default value)
- Reduce login rate limit from 100/hour to 5/hour
- Remove exposed PageSpeed API key from CLAUDE.md

BREAKING: Application requires SECRET_KEY >= 32 chars in .env

Author: Maciej Pienczyn z wykorzystaniem AI i Claude Opus
2026-01-09 15:50:40 +01:00
39a91b709a feat: Add release notes page with version history
- Add /release-notes route with changelog from v1.0.0 to v1.9.0
- Document all major features added since platform launch

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 14:32:33 +01:00
41f7b1d01f feat: Add GBP Audit and Social Audit admin dashboards
- Add /admin/gbp-audit panel with completeness stats, field coverage, company table
- Add /admin/social-audit panel with platform coverage, top followers, company table
- Update admin menu with new dashboard links

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 14:14:56 +01:00
c65f1605b1 fix: IT Audit fixes and improvements
- Add api_it_audit_export endpoint for CSV export
- Fix url_for references (company_detail -> company_detail_by_slug)
- Fix form action (save_it_audit -> it_audit_save)
- Add "Audyt IT" button to company profile contact bar

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 13:19:53 +01:00
b405fdd810 auto-claude: subtask-7-3 - Handle edge cases for IT audit
Edge cases handled:
1. Partial submission:
   - Added is_partial flag to save response
   - Dynamic success message based on completeness score
   - Completeness threshold messages (< 30%, 30-70%, > 70%)

2. Company without audit:
   - Fixed template to show "Brak audytu" for companies without audit
   - Added "Utwórz audyt" button (+ icon) for companies without audit
   - Fixed data structure mismatch between route and template

3. Multiple audit history:
   - Added get_company_audit_history() convenience function
   - Added has_company_audit() helper function
   - Added /api/it-audit/history/<company_id> API endpoint
   - Returns history_count in save response

Other fixes:
- Fixed stats variable naming in admin_it_audit route
- Fixed collaboration_matches data structure for template
- Fixed url_for to use slug instead of company_id
- Fixed match_type filter (shared_licensing not shared_m365_licensing)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 09:30:50 +01:00
6a38f31ebb auto-claude: subtask-6-5 - Add /audit/it/<slug> route for user-facing IT audi
Add user-facing IT audit dashboard route following the pattern of existing
SEO and GBP audit dashboards:
- Route: /audit/it/<slug>
- Access control: admin can view any company, members only their own
- Returns latest IT audit data with scores, technology flags, and recommendations
- Renders it_audit.html template

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 09:15:47 +01:00
36272307fb auto-claude: subtask-6-4 - Add /api/it-audit/matches/<company_id> endpoint fo
Add API endpoint for getting IT audit collaboration matches for a company.
- Admin-only access (matches are not visible to regular users per spec)
- Returns all matches where company is either party A or B
- Includes partner company info, match type/score/reason, status
- Follows existing API patterns (login_required, try/finally, jsonify)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 09:12:59 +01:00
b6a3411e43 auto-claude: subtask-6-3 - Add /it-audit/save POST route for saving form data
Implemented POST endpoint at /it-audit/save that:
- Accepts JSON or form data with IT audit fields
- Validates company access (admin for any, users for their own)
- Parses boolean, array, and string fields with proper type handling
- Uses ITAuditService to save audit with scoring calculation
- Returns JSON with audit scores and redirect URL
- Includes rate limiting (30 per hour)
- Handles errors with rollback and logging

Added helper function _parse_it_audit_form_data() to properly parse:
- Boolean fields (checkboxes)
- Array fields (multi-select)
- String fields
- JSON fields (zabbix_integration)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 09:11:24 +01:00
10ae221c26 auto-claude: subtask-6-2 - Add /it-audit/form GET route for displaying the form
Add Flask route for IT audit form display:
- GET /it-audit/form with optional company_id query parameter
- Access control: admin can access any company, users only their own
- Defaults to current user's company if no company_id provided
- Pre-fills form with existing audit data if available
- Renders it_audit_form.html template

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 09:09:00 +01:00
7370ce78fa auto-claude: subtask-6-1 - Add /admin/it-audit route for admin dashboard
Implemented the IT audit admin dashboard route at /admin/it-audit that:
- Checks for admin authentication (is_admin flag)
- Queries all active companies with their latest IT audit data
- Calculates statistics (audit count, avg scores, maturity distribution)
- Provides technology adoption stats (Azure AD, M365, PBS, Zabbix, EDR, DR)
- Queries collaboration flags from IT audits
- Retrieves and organizes collaboration matches by type
- Renders admin/it_audit_dashboard.html template

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 09:07:07 +01:00
deed279521 fix(social-audit): Use SocialMediaAuditor for comprehensive audit
- Import and use SocialMediaAuditor from scripts/social_media_audit.py
- Audit now scans website HTML for social media links
- Discovers profiles via Brave Search API (if configured)
- Fetches Google Business Profile data via Google Places API
- Saves discovered profiles to database

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 05:12:25 +01:00
cadf91b481 feat(social-audit): Add ability to run Social Media audit
- Add "Uruchom audyt" button to social_audit.html
- Create POST /api/social/audit endpoint to verify profile URLs
- Add loading overlay and modal for audit progress/results
- Audit verifies each social media URL and updates check_status

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 05:07:58 +01:00
505800381e feat(social-audit): Add Social Media audit dashboard
- Create /audit/social/<slug> route with platform presence analysis
- Create social_audit.html template with 6 platforms (FB, IG, LinkedIn, YT, X, TikTok)
- Add purple "Audyt Social" button on company profile next to GBP and SEO audits
- Show score based on platforms count, profile details and recommendations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 05:03:57 +01:00
c7b57100ad fix(seo-audit): Use correct attribute website_url instead of url
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 04:54:51 +01:00
3da1501872 feat(seo-audit): Add dedicated SEO audit page for individual companies
- Create /audit/seo/<slug> route with access control (admin or company owner)
- Create seo_audit.html template with score visualization
- Add green "Audyt SEO" button next to GBP audit button on company profile
- Match styling and UX patterns from GBP audit feature

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 04:53:21 +01:00
6758e208d4 GBP Audit: fetch Google data + detailed progress overlay
- Add fetch_google_business_data() to fetch fresh data from Google Places API
- Progress overlay shows all 10 data fields with actual values:
  * Place search, Rating, Reviews, Photos, Hours, Phone, Website, Status
- 5-second delay after completion for user to read results
- Fix opening hours display (show formatted weekday_text)
- Fix reviews scoring (integer-based: 3 base + 1/review + 1 bonus)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 04:19:44 +01:00
8fa23bc77e auto-claude: subtask-3-3 - Add GBP audit route accessible to logged-in users
Add user-facing GBP audit dashboard route at /audit/gbp/<company_slug>:
- Requires login (@login_required)
- Admin users can view audit for any company
- Regular users can only view audit for their own company
- Passes can_audit flag to template for run audit button visibility
- Gracefully handles missing audit data (template shows "no audit" state)
- Logs audit dashboard views for monitoring

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 19:17:32 +01:00