Commit Graph

52 Commits

Author SHA1 Message Date
8ee998b42f fix(nordagpt): empty matcher fallback, no-results prompt, hide costs for users, streaming timeout
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. When company_matcher returns [], keep full company list as fallback instead of leaving AI with zero data
2. Add explicit "no results" instruction in prompt to prevent hallucinated company names
3. Hide cost badge chip from non-admin users (IS_ADMIN gate)
4. Add 60s AbortController timeout on streaming fetch to prevent hung connections

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 13:08:44 +01:00
50d31c1b84 feat(chat): better markdown rendering, smart titles, follow-up chips, prompt fixes
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 (1M context) <noreply@anthropic.com>
2026-03-28 12:21:03 +01:00
929e0b919f feat(nordagpt): integrate company_matcher — AI sees only matched companies, eliminates hallucinations
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 (1M context) <noreply@anthropic.com>
2026-03-28 07:18:08 +01:00
365de18301 fix(nordagpt): add 'lub/czy' to hallucination prefix patterns
Some checks are pending
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
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
2026-03-28 07:02:04 +01:00
513d32ffb2 fix(nordagpt): catch bullet-point company hallucinations (* ProBud to...)
Some checks are pending
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
AI writes hallucinated company names at start of bullet points without
any prefix word. New pattern catches "* CompanyName to/–/specjalizuje"
and removes the fake name if it's not in the database.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 06:58:53 +01:00
a1a64730e3 fix(nordagpt): catch plain-text company hallucinations (firma X, również X)
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 bypasses link/bold validation by mentioning companies as plain text
like "firma Baumar" or "również Pro-Bud". New regex catches these patterns
and removes them if the company name isn't in the database.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 06:55:23 +01:00
87d4fde5c3 fix(nordagpt): catch full URL hallucinations + remove manual model selector
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
- Validator now catches https://nordabiznes.pl/company/slug (full URLs)
- Also catches /firma/ URLs as fallback
- Removed Flash/Pro model selector — Smart Router decides automatically
- Removed "Spróbuj Pro" hints from response badges

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 06:51:08 +01:00
337f229a05 fix(nordagpt): use /company/ URLs instead of /firma/ — fixes all 404 links
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
The actual Flask route is /company/<slug>, not /firma/<slug>.
All link generation, validation, and prompt instructions now use /company/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 06:45:34 +01:00
855856dc99 fix(nordagpt): nuclear anti-hallucination — whitelist + bold text validation
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
Three layers of defense:
1. PROMPT: explicit whitelist of allowed company names + slugs
2. VALIDATOR: link slug verification (existing)
3. VALIDATOR: bold text scan — removes **FakeName** if not in DB

AI can no longer mention companies as plain/bold text to bypass link validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 06:37:38 +01:00
464e456939 fix(nordagpt): smarter company validator — fix slugs instead of removing real companies
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 generates "inpi-sp-z-o-o" but real slug is "inpi" → now auto-corrected
- Fuzzy prefix matching on slugs (handles legal form suffixes)
- Name-based resolution as fallback (match link text to company name)
- Hallucinated companies: keep text, remove link (instead of deleting entirely)
- Better cleanup of artifacts ("oraz –", empty bullets)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 06:30:20 +01:00
c167794bb6 fix(nordagpt): structural anti-hallucination — validate ALL company links against DB
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
Prompt rules don't work — AI ignores them and invents company names.
Added _validate_company_references() post-processor that:
- Loads all valid company slugs from DB
- Scans every /firma/ link in AI response
- REMOVES links to companies that don't exist
- Cleans up empty list items left by removals
- Applied to BOTH send_message() and send_message_stream()

This is the ONLY reliable way to prevent hallucinated companies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 06:25:20 +01:00
0a7fe6389f feat(nordagpt): avatars in chat + anti-hallucination rule for companies
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
- NordaGPT icon (nordagpt-icon.svg) as AI avatar instead of "AI" text
- User profile photo as avatar (falls back to initial letter)
- CRITICAL: added strict rule to never hallucinate company names
- Only mention companies that exist in the provided database

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 06:12:49 +01:00
cc78711e17 fix(nordagpt): smart router complexity for long queries + show routing info in badge
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
- Long messages (>150 chars) with 2+ categories → complex (was medium)
- Badge shows actual model used, complexity icon, thinking level
- Done chunk includes complexity, thinking, routed_by metadata

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 06:08:43 +01:00
59f8db8213 feat(nordagpt): add memory service — fact extraction, summaries, CRUD, prompt injection
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 (1M context) <noreply@anthropic.com>
2026-03-28 05:47:44 +01:00
0640ffbb9d feat(nordagpt): streaming SSE responses — word-by-word output with thinking animation
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
- Extract _build_full_prompt() from _query_ai() for reuse in streaming
- Add send_message_stream() generator in NordaBizChatEngine using generate_content_stream
- Add /api/chat/<id>/message/stream SSE endpoint in blueprints/chat/routes.py
- Replace sendMessage() with streaming version: thinking dots → token-by-token rendering
- Add thinking animation CSS (.thinking-dots with thinkBounce keyframes)
- Fallback to non-streaming fetch if SSE fails

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 05:42:38 +01:00
0b2e210da6 feat(nordagpt): integrate smart router — selective context loading + adaptive model selection
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
Wire Smart Router and Context Builder into send_message(): queries are now classified,
only needed data is loaded via build_selective_context(), and model/thinking level
are determined by the router. Falls back to full context if router is unavailable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 05:37:00 +01:00
4ee4165f85 feat(nordagpt): inject user identity into AI system prompt — personalized greetings and context
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 Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 05:23:06 +01:00
5682e1622f feat(chat+edit): feed all profile fields to NordaGPT and add hints
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
Added description_full, core_values, services_offered, and
technologies_used to the AI context builder. Previously only
description_short and founding_history were used by NordaGPT.

Added "Wykorzystywany przez NordaGPT" hints to all relevant fields
in the company edit form so users know their content feeds the AI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 18:15:52 +01:00
917d686a10 fix: calendar year validation, rate limit exemption for polling, migrate old Gemini SDK
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 year range validation (2020-2100) on /kalendarz/ to prevent ValueError crash
- Exempt notification/message unread-count endpoints from rate limiting (shared IP via NAT)
- Replace deprecated google.generativeai SDK with google-genai in nordabiz_chat.py
- Remove dead news_service import that logged warnings on every worker startup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:24:46 +01:00
6df36f97e8 fix: Map portal role codes to Polish labels in chatbot context
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
MANAGER/EMPLOYEE/VIEWER are portal permission levels, not job titles.
Rename field to portal_role with labels: administrator profilu, pracownik,
obserwator — so chatbot doesn't misinterpret them as company positions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 12:41:54 +01:00
a89cec2779 fix: Show all users with company in chatbot, include verification status
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
Remove is_verified filter so chatbot sees all active users assigned to a
company. Add 'verified' field so AI can inform about account status.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 12:37:52 +01:00
7b64915700 fix: Add missing User import to chatbot context
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-18 12:34:31 +01:00
400d01c912 feat: Add registered users to NordaGPT chatbot context (Option C)
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
Extends chatbot to include verified portal users alongside KRS/CEIDG data,
so NordaGPT can answer questions about company representatives who registered
on the portal but aren't listed in official registries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 12:32:45 +01:00
ef08bebc8c feat(chat): Add Izba NORDA knowledge to NordaGPT system 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
- Mission, values, structure, board members (16 names)
- Regular activities (Chwila dla Biznesu, Akademia NORDA)
- Strategy 2026-2031 (3 directions, 30th anniversary goal)
- Regional context (Kaszubia 250B PLN, demographics)
- Member projects (Energo Velo / Żarnowiecki Ring)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 04:30:27 +01:00
57cb67fb25 refactor: Remove redundant contact data filtering from NordaGPT
Since NordaGPT access is now restricted to MEMBER role at the route
level (blueprints/chat/routes.py), the per-field filtering of phone
and email in nordabiz_chat.py is redundant.

Simplifies the code by removing:
- User import and loading in send_message()
- can_view_contacts parameter passing through the call chain
- Conditional phone/email inclusion in _company_to_compact_dict()
- Dynamic system prompt about contact data availability

Access control is now enforced at a single point (route decorator).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 21:42:57 +01:00
579b4636bc security: Hide contact data from non-members in NordaGPT
- Add role-based access control to AI chat context
- Phone/email only visible to users with MEMBER role or higher
- Load User object in send_message() to check can_view_contacts()
- Pass permission through _build_conversation_context() to _company_to_compact_dict()
- Update AI system prompt to inform about contact data availability
- Non-members are directed to company profiles for contact details

This fixes a security gap where contact data was exposed to all users
regardless of their membership status in the organization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 21:17:51 +01:00
228907ca90 security: Blokada odpowiedzi AI na pytania o PESEL i dane wrażliwe
- Dodano sekcję DANE WRAŻLIWE do system prompt
- AI odmówi odpowiedzi na pytania o PESEL, dowody, paszporty, karty
- Instrukcja: 'Przepraszam, nie mogę podawać informacji o numerach PESEL'
- Zapobiega halucynacjom AI łączącym zamaskowane dane z osobami z bazy

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:45:27 +01:00
23493f0b61 docs: Aktualizacja dokumentacji do Gemini 3 Flash
Zmiana domyślnego modelu w dokumentacji i kodzie:
- gemini-2.5-flash → gemini-3-flash-preview
- gemini-2.5-pro → gemini-3-pro-preview

Zaktualizowane pliki:
- README.md - opis technologii
- docs/architecture/*.md - diagramy i przepływy
- nordabiz_chat.py - fallback model name
- zopk_news_service.py - model dla AI evaluation
- templates/admin/zopk_dashboard.html - wyświetlany model

Zachowano mapowania legacy modeli dla kompatybilności wstecznej.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:19:05 +01:00
26db9a7cc9 feat(chat): Wybór modelu Flash/Pro zamiast Thinking Mode + koszt miesięczny
UI:
- Dropdown wyboru modelu: Flash (szybki, $0.05) vs Pro (analiza, $0.20)
- Wyświetlanie kosztu miesięcznego w headerze
- Badge odpowiedzi pokazuje: model, czas, koszt

Backend:
- Endpoint /api/chat/settings obsługuje model i monthly_cost
- NordaBizChatEngine przyjmuje parametr model
- Koszt zapisywany w tech_info odpowiedzi

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:04:29 +01:00
fa696b331f feat(chat): Różne instrukcje dla trybów thinking (high vs minimal)
- Tryb głęboki: wymaga rozbudowanej analizy, list, kontekstu
- Tryb szybki: zwięzłe odpowiedzi z linkami
- Dodano przykład odpowiedzi w trybie głębokim

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:56:29 +01:00
98b50b05c2 fix(chat): Poprawka URL forum /forum/{id} zamiast /forum/topic/{id}
- Naprawiono URL w kontekście (był /forum/topic/X, prawidłowy /forum/X)
- Dodano instrukcje o linkach do forum, B2B, news w system prompt
- Model MUSI używać URL z pola "url" przy odpowiedziach o forum

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:53:51 +01:00
08aee8864a feat(chat): Full forum, news and B2B content in NordaGPT context
- Forum: treść tematów, autorzy, odpowiedzi, linki, popularność
- B2B: pełne opisy ogłoszeń, budżet, autor
- News: opis, AI streszczenie, słowa kluczowe, linki
2026-01-29 10:40:43 +01:00
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