Commit Graph

1998 Commits

Author SHA1 Message Date
7761dcbaf3 fix: Add missing Polish diacritics in forum templates
Fixed missing Polish characters (ą, ć, ę, ł, ń, ó, ś, ź, ż) in:
- index.html: tematów, Przypięty, Zamknięty, wyświetleń, Bądź, Utwórz
- new_topic.html: Utwórz, dyskusję, członkami, zwięźle, znaków, szczegółów, Treść, Załącznik, Przeciągnij, Możesz, wkleić, Usuń
- topic.html: Przypięty, Zamknięty, wyświetleń, Bądź, zamknięty, można, dodawać, odpowiedź, Wyślij, Przeciągnij, plików, możesz, wkleić, Usuń, duży

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 11:14:14 +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
421d7c8e89 fix: Pass user_id to Gemini for AI cost tracking
ZOPK news evaluation now properly attributes AI token usage
to the user who triggered the evaluation. This enables:
- Per-user cost tracking in AI monitoring dashboard
- User rankings by AI token consumption
- Company-level cost aggregation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 09:41:34 +01:00
b21b3739d7 fix: Strip HTML tags from news description display
Use Jinja2 striptags filter to remove HTML from news.description
before displaying in ZOPK news cards. Prevents raw HTML like
<a href="..."> from showing as text.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 09:17:45 +01:00
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
3bbe2a36dd feat: Add Monitoring AI link to admin menu
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:25:36 +01:00
18ac0218d0 fix: Correct dashboard endpoint name in AI usage template
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:22:25 +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
340e39515f feat: Add AI usage tracking migration
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:17:06 +01:00
3934cdf0ee fix: Improve AI evaluation UX - auto-reload and clear messaging
- Add auto-reload after successful evaluation (2s delay)
- Show 'Odświeżam stronę za 2 sekundy...' message
- Change button text to 'AI pracuje...' during processing
- Update progress text to 'AI dodaje gwiazdki...'
- Fix error state button labels to include AI prefix
- Ensures user knows what's happening at all times

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

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

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

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 07:53:58 +01:00
33bb43caec feat: Add star ratings and sorting to ZOPK news management
- Add AI relevance score column with star display (1-5)
- Add sortable column headers (title, score, date)
- Add dropdown sort selector in filters
- Preserve sort params in pagination links
- Color-coded score badges based on relevance

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

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

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

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

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

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

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

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

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 06:49:13 +01:00
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
e8714ac6b0 feat: Add AI-generated content indicators
- Add is_ai_generated column to ForumTopic, ForumReply, NordaEvent, Classified
- Display AI badge next to author name for AI-generated content
- Purple gradient badge with tooltip 'Wygenerowano przez AI'
2026-01-11 06:16:35 +01:00
ffadcb16e8 feat: Add colored category badges to B2B classifieds
- Usługi: blue
- Produkty: amber
- Współpraca: green
- Praca: pink
- Inne: gray
- Nieruchomości: indigo
2026-01-11 06:10:45 +01:00
80db7dd84a feat: Change forum filters to clickable buttons (like B2B)
- Replace dropdown selects with filter buttons
- Consistent UI between Forum and B2B classifieds
- Better mobile responsiveness
2026-01-11 06:05:37 +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
957fff3f2f fix: Use absolute paths in file_upload_service for PROD compatibility
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 21:30:03 +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
539b6f40bc docs: Add Auto Claude configuration and merge conflict resolution guide
- Document Auto Claude state files that should never be committed
- Add pre-commit hook that automatically unstages Auto Claude files
- Include troubleshooting steps for merge conflicts
- Document worktree management commands

This prevents future merge conflicts caused by .auto-claude-* files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 14:44:41 +01:00
7d1df82d76 Merge branch 'auto-claude/004-remove-hardcoded-database-credentials-from-shell-s'
Security fix: Remove hardcoded database credentials from shell scripts and source code.

Changes:
- Scripts now use environment variables ($DATABASE_URL, $PGPASSWORD)
- Safe fallback values with CHANGE_ME placeholder
- Added .env.example template
- Added docs/SECURITY.md documentation
- Updated CLAUDE.md with credential management guidelines

Resolves conflict by removing Auto Claude state files (already in .gitignore).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 14:42:05 +01:00
841f2b266a chore: Stop tracking Auto Claude state files (already in .gitignore)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 14:41:25 +01:00
e806746141 auto-claude: 5.3 - Verify no credentials remain in codebase
- Created CREDENTIAL_VERIFICATION_REPORT.md with comprehensive grep audit
- Verified NO hardcoded production passwords in executable code (.py, .sh)
- Only safe occurrences found: password redaction in logging, env var refs, docs
- Updated implementation_plan.json: subtask 5.3 status -> completed
- Updated build-progress.txt: Phase 5 and entire task COMPLETE
- CWE-798 vulnerability successfully remediated
- All 5 phases completed: Analysis, Python updates, Shell updates, Documentation, Testing
2026-01-10 13:16:10 +01:00
5dbf9ca51d auto-claude: 5.2 - Test that view_maturity_results.sh provides clear error message when PGPASSWORD is not set
- Created TEST_RESULTS_SHELL_SCRIPTS.md with comprehensive test verification
- Verified script properly validates PGPASSWORD environment variable
- Confirmed clear error message and exit code 1 when PGPASSWORD not set
- All validation checks pass successfully
2026-01-10 13:13:13 +01:00
9552845aee auto-claude: 5.1 - Test that all updated Python scripts provide clear error messages when DATABASE_URL is not set
- Created test_database_url_validation.py for static code analysis
- Created test_runtime_errors.py for runtime error verification
- Created TEST_RESULTS.md with comprehensive test documentation
- All 7 Python scripts verified to use safe 'CHANGE_ME' fallback
- Confirmed no hardcoded production credentials remain in code
- Scripts properly fail with clear authentication errors
- Test coverage: 7/7 scripts passed (100%)

Security validation complete for CWE-798 remediation.
2026-01-10 13:10:09 +01:00
f85b3261ab auto-claude: 4.3 - Create security documentation explaining credential management
Created comprehensive docs/SECURITY.md with:
- Database credentials management guide (CWE-798 security)
- Complete environment variables reference
- Development and production setup instructions
- Shell script configuration (.pgpass, PGPASSWORD)
- Security best practices (never hardcode credentials)
- Verification and testing procedures
- Troubleshooting guide for common issues
- Incident response procedures for compromised credentials
- Links to official documentation and security standards

This completes Phase 4 (Documentation) of the credential security cleanup task.
2026-01-10 13:06:00 +01:00
1a2edef536 auto-claude: 4.2 - Add section to CLAUDE.md about proper credential management
- Added comprehensive 'Zarządzanie danymi uwierzytelniającymi' subsection
- Documented CWE-798 security vulnerability and prevention measures
- Included code examples of proper vs improper credential handling
- Added table of required environment variables (DATABASE_URL, PGPASSWORD, API keys)
- Documented shell script validation patterns
- Added Git safety practices and accidental commit remediation steps
- Included pre-deployment verification commands
2026-01-10 13:02:37 +01:00
76f6ac19dc auto-claude: 4.1 - Add clear comments in .env.example explaining DATABASE_URL and PGPASSWORD
- Added comprehensive DATABASE_URL documentation with examples for dev/prod
- Added PGPASSWORD documentation for shell scripts (psql, pg_dump)
- Included security warnings about CWE-798 and hardcoded credentials
- Added usage examples: export, inline, and .pgpass file method
- Documented that shell scripts cannot read .env files automatically
2026-01-10 13:00:47 +01:00
3e3c3cb18c auto-claude: 3.1 - Replace hardcoded PGPASSWORD with environment variable
- Added PGPASSWORD environment variable check at script start
- Replaced 3 instances of hardcoded 'NordaBiz2025Secure' with $PGPASSWORD
- Added usage instructions and security warning (CWE-798)
- Script now exits with error if PGPASSWORD is not set
2026-01-10 12:58:57 +01:00
33a48894d7 auto-claude: 2.7 - Replace hardcoded password in update_social_media.py with environment variable
- Removed hardcoded DATABASE_URL assignment with 'NordaBiz2025Secure' password
- Added comprehensive warning comment about CWE-798 security vulnerability
- Script now relies on DATABASE_URL environment variable or safe fallback from database.py
- Follows same security pattern as other updated scripts (run_migration.py, etc.)
2026-01-10 12:56:56 +01:00
f29987f635 auto-claude: 2.6 - Remove hardcoded password from docstring usage example 2026-01-10 12:55:34 +01:00
c228716c0f auto-claude: 2.6 - Replace hardcoded password in scripts/test_collaboration_matching.py with safe fallback 2026-01-10 12:54:39 +01:00