Commit Graph

20 Commits

Author SHA1 Message Date
30729ef83e feat(ai): Thinking Mode dla NordaGPT
- Nowy SDK google-genai z obsługą thinking mode
- Przełącznik poziomu rozumowania w UI chatu (3 poziomy)
- Błyskawiczny (minimal) - szybkie odpowiedzi
- Szybki (low) - zrównoważony
- Głęboki (high) - maksymalna analiza
- Endpoint /api/chat/settings do zapisywania preferencji
- Dokumentacja dla NotebookLM (prezentacja)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:20:58 +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
2a749e09d3 fix(chat): Normalize person names to Title Case for link matching
- DB stores names in UPPERCASE (e.g. 'MICHAŁ BOGDAN ROSZMAN')
- AI generates Title Case (e.g. 'Michał Bogdan Roszman')
- Post-processing now converts to title() before matching

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 14:10:53 +01:00
05d8e3f6ec feat(chat): Add post-processing for automatic markdown links
- Call _postprocess_links() on AI response before returning
- Ensures companies and people are linked even when AI doesn't format them
- Fixes inconsistent link generation by Gemini AI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 14:04:53 +01:00
09084aa18a feat(chat): Klikalne linki do osób + wzmocnione instrukcje AI
- Dodano person_id i profile URL do kontekstu osób w chatbocie
- Zaktualizowano system prompt: OBOWIĄZKOWE linki dla firm i osób
- Dodano CSS dla linków do osób (zielony badge)
- Rozszerzono JavaScript o wykrywanie linków /osoba/

Kolory badge:
- 🏢 Firmy: pomarańczowy (#c2410c)
- 👤 Osoby: zielony (#047857)
- 🔗 Zewnętrzne: niebieski (#1d4ed8)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 12:34:19 +01:00
f7c86e6f1a feat(chat): Klikalne linki do firm i osób w odpowiedziach AI
Backend (nordabiz_chat.py):
- Dodano instrukcję w system prompt wymagającą linków markdown
- Nazwy firm: [Firma](URL) - klikalne linki do profilu
- Nazwy osób: **Imię Nazwisko** (link do firmy)

Frontend (chat.html):
- Nowe style dla linków w wiadomościach
- Fioletowy kolor (#7c3aed) dla linków AI
- Hover effect z podkreśleniem
- Oddzielne style dla linków w wiadomościach użytkownika

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 12:11:33 +01:00
6156277629 fix(chat): Dodanie słów kluczowych ZOPK dla NordaGPT
Dodano brakujące słowa kluczowe do _is_zopk_query():
- "kaszubia", "kaszub", "projekt kaszubia"
- "kamienie milowe", "roadmapa", "timeline", "harmonogram"
- "inwestycje pomorze", "inwestycje pomorskie", "rozwój pomorza"

Dzięki temu pytania takie jak "co wiesz o projekcie Kaszubia?"
będą rozpoznawane jako pytania ZOPK i chat będzie używał
bazy wiedzy.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 16:35:49 +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
21586f6b91 fix(chat): Rozszerzone słowa kluczowe ZOPK - polskie odmiany przypadków
Dodano:
- Odmiany 'jądrowa/jądrowej/jądrowe/jądrowy'
- 'atomowa' i odmiany
- Konkretne nazwy: westinghouse, bechtel, arabelle, turbiny
- Więcej form offshore wind
- Rozszerzono infrastructure i energy keywords

Dzięki temu pytania jak 'turbiny dla elektrowni jądrowej'
będą poprawnie rozpoznawane jako ZOPK

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:48: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
709c20c48e fix: AI response precision and list formatting
- Add explicit instruction to give EXACT number requested
- Change list format to single-line items (prevents numbering reset)
- Show correct vs incorrect format examples in prompt

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 14:55:06 +01:00
d3f773c403 feat: Improve AI response formatting and NordaGPT minimize
- Add comprehensive formatting instructions to AI system prompt
- Update linkifyText() and linkifyNordaGPT() to parse markdown:
  - **bold** to <strong>
  - Newlines to <br>
  - Numbered lists (1. 2. 3.) to <ol>
  - Bullet lists (- *) to <ul>
- Add CSS styles for AI response lists
- Fix NordaGPT minimize: banner now pulses and shows active state
- Banner button changes to "Wznów chat" when minimized

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 14:51:45 +01:00
3bcff9a2d3 feat: Add SEO audits (PageSpeed) to AI chat context
- Import CompanyWebsiteAnalysis model
- Query PageSpeed scores: SEO, performance, accessibility, best practices
- Add SEO audits description to system prompt
- Include website URLs and profile links
- AI can now answer questions about website SEO scores

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 14:33:12 +01:00
c0fa157c09 feat: Add links to AI chat context (GBP, social media, company profiles)
- GBP audits: added maps_url (Google Maps) and profile_url
- Social Media: added url field for each platform
- Companies: added profile link to nordabiznes.pl
- Updated AI instructions to always include links in responses

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 14:05:00 +01:00
0050cd1fdf feat(chat): Add KRS people, social media, and GBP audits to AI context (Stage 3)
- Import Person, CompanyPerson, CompanySocialMedia, GBPAudit models
- Add company people (zarząd, wspólnicy, prokurenci) grouped by company
- Add social media profiles (platform + followers) grouped by company
- Add latest GBP audit scores (completeness, reviews, rating)
- Update system prompt with Stage 3 data descriptions
- Add new prompts for people lookup and GBP audit queries
- Update suggestion chips: "Kto jest prezesem?", "Google opinie?", "Fanów FB?"

AI chat now has access to:
- 80 companies + services + competencies
- Recommendations, News (Stage 1)
- Calendar events, B2B classifieds, Forum topics (Stage 2)
- KRS people, Social Media, GBP audits (Stage 3)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 13:32:23 +01:00
44407cf32e feat(chat): Add calendar, B2B board, and forum to AI context (Stage 2)
- Import Classified, NordaEvent, ForumTopic models
- Add upcoming events (next 60 days) to AI context
- Add active B2B classifieds (non-test) to AI context
- Add recent forum topics (non-test) to AI context
- Update system prompt with new data source descriptions
- Add JSON serialization for all Stage 2 data
- Update suggestion chips: "Kiedy następne spotkanie?", "Kto szuka usług IT?"

AI chat now has access to:
- 80 companies + services + competencies
- Recommendations, News (Stage 1)
- Calendar events, B2B classifieds, Forum topics (Stage 2)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 13:25:47 +01:00
819273bb58 feat(chat): Add recommendations and news to AI chat context
- Add CompanyRecommendation and ZOPKNews imports to nordabiz_chat.py
- Fetch approved recommendations (last 20) in conversation context
- Fetch approved news from last 30 days (last 10) in context
- Serialize recommendations and news to JSON in AI prompt
- Update system prompt with data format descriptions
- Update chat template header description
- Add new suggestion chips: "Kto poleca firmę..." and "Co słychać..."

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 13:19:23 +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
02fc67bf40 Initial commit 2026-01-01 14:01:49 +01:00