Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
252 commits
Select commit Hold shift + click to select a range
20d6f6d
test/dl: Add comprehensive demo testing infrastructure
d-ulker Sep 15, 2025
1303b33
fix/dl: Add API authentication handling and mock responses for demo
d-ulker Sep 15, 2025
fbb89c8
feat/dl: Add secure API key configuration for demo
d-ulker Sep 15, 2025
e942bf6
fix/dl: Update demo to use working API service
d-ulker Sep 15, 2025
171986a
fix/dl: Fix emotion detection error handling for rate-limited API
d-ulker Sep 15, 2025
3703f4b
feat/dl: Add unified API deployment configuration
d-ulker Sep 15, 2025
e6e4825
fix/dl: Fix Dockerfile requirements path for unified API
d-ulker Sep 15, 2025
baa5406
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 15, 2025
f621bab
refactor/dl: Address code review comments and improve demo architecture
d-ulker Sep 15, 2025
18fb267
fix/dl: Address three critical issues in demo and API
d-ulker Sep 15, 2025
21d2984
feat/dl: Update demo to use unified API endpoints
d-ulker Sep 15, 2025
dc93823
fix/dl: Fix emotion detection endpoint and error handling
d-ulker Sep 15, 2025
c4e5a68
fix/dl: Fix emotion detection error handling in modular demo
d-ulker Sep 15, 2025
3c269b4
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 15, 2025
6b205f5
Fix demo error handling and add comprehensive test suite
d-ulker Sep 15, 2025
93a4e06
Merge branch 'feat/dl-update-demo-website' of github.com:uelkerd/SAMO…
d-ulker Sep 15, 2025
9abddde
Fix unused variable warning in test file
d-ulker Sep 15, 2025
0eeb1f9
Address code review comments and improve code quality
d-ulker Sep 15, 2025
42ea6d6
Fix unused variable warnings in secure_api_server.py
d-ulker Sep 15, 2025
2f49c70
Address Gemini Code Assist review comments
d-ulker Sep 15, 2025
32338e5
Fix demo website display issues
d-ulker Sep 15, 2025
81229a8
Fix critical demo website issues
d-ulker Sep 15, 2025
b3e3e6e
Complete validation and fix all remaining model name references
d-ulker Sep 15, 2025
c718b1f
Fix critical result display issues
d-ulker Sep 15, 2025
849b13d
Fix critical demo website issues and enable real API integration
d-ulker Sep 15, 2025
2657288
Fix demo website issues: async tests, audio MIME types, href validati…
d-ulker Sep 15, 2025
5743646
Complete SAMO-DL demo website overhaul - FINAL VERSION
d-ulker Sep 15, 2025
cd9a5f3
Fix line length issues in secure_api_server.py - break long logger st…
d-ulker Sep 15, 2025
f3b58cf
FINAL FIX: Complete SAMO demo functionality restoration
d-ulker Sep 15, 2025
6c37cba
Fix JavaScript runtime errors: null checks, division by zero, field n…
d-ulker Sep 15, 2025
fd2d3c6
Remove trailing whitespace from secure_api_server.py logger statements
d-ulker Sep 15, 2025
8a34e72
Fix syntax error in chart-utils.js - add missing closing brace for op…
d-ulker Sep 15, 2025
4ae6eb9
Improve code quality: use set instead of list for membership check in…
d-ulker Sep 15, 2025
984c6c9
Refactor tests to avoid loops: use all() with generator expressions i…
d-ulker Sep 15, 2025
e2f5e09
Improve demo UX: format processing time and normalize emotion data st…
d-ulker Sep 15, 2025
be8326d
Refactor showSummarizationResults to reduce coupling and improve reus…
d-ulker Sep 15, 2025
da760dd
Add audio decoding dependencies (ffmpeg, libsndfile1) for Whisper sup…
d-ulker Sep 15, 2025
809b901
Implement secure API configuration system with environment detection
d-ulker Sep 15, 2025
1968710
Add timeout handling and improved error handling to API client methods
d-ulker Sep 15, 2025
a7077aa
Fix nitpick issues: add error logging, canvas validation, null checks…
d-ulker Sep 15, 2025
339a34e
Comprehensive code quality and accessibility improvements
d-ulker Sep 15, 2025
c15f85c
feat/dl-redesign-demo-layout: Implement horizontal layout with vertic…
d-ulker Sep 15, 2025
a8001c7
fix/dl-demo-layout-issues: Fix icons, spacing, and layout compression
d-ulker Sep 15, 2025
05de63d
fix/dl-demo-fundamental-issues: Fix icons, full-width layout, and spa…
d-ulker Sep 15, 2025
c57fa6b
fix/dl-demo-critical-issues: Fix icons, clear button, and summarization
d-ulker Sep 15, 2025
3773e2f
fix/dl-demo-summarization-and-icons: Fix intelligent summarization an…
d-ulker Sep 15, 2025
e15de5f
fix/dl-demo-paraphrase-summarization: Implement proper paraphrasing i…
d-ulker Sep 15, 2025
1d4a225
fix/dl-demo-third-person-summary: Convert summarization to proper thi…
d-ulker Sep 15, 2025
f3ee9c5
fix/dl-demo-api-and-icons: Use GCP Cloud Run API and fix Font Awesome…
d-ulker Sep 15, 2025
c8a3c2f
Fix demo website critical issues: icons, sizing, charts, API integration
d-ulker Sep 15, 2025
02e89ce
Fix API integration to use correct unified API endpoints
d-ulker Sep 15, 2025
ded3ea9
Replace Font Awesome with Google Material Icons
d-ulker Sep 15, 2025
a2f62f2
Fix remaining UI issues: icon sizing, text input, Chart.js loading
d-ulker Sep 15, 2025
bd9cbd6
Replace Chart.js with pure HTML/CSS charts - 100% reliable!
d-ulker Sep 15, 2025
ff05988
Make charts BEAUTIFUL with premium design!
d-ulker Sep 15, 2025
a8e6e2a
Add Highcharts as backup charting solution - 100% reliable!
d-ulker Sep 15, 2025
caa5bf7
Add debug tools to fix chart rendering issues
d-ulker Sep 15, 2025
4a3a248
Fix CSS conflicts preventing chart visibility
d-ulker Sep 15, 2025
e01aaad
Simplify charts with inline styles - GUARANTEED to work!
d-ulker Sep 15, 2025
0ba3b73
Fix main demo chart containers - charts now work!
d-ulker Sep 15, 2025
a1aeda3
Implement comprehensive UI improvements based on feedback
d-ulker Sep 15, 2025
53ec401
Fix chart restoration and detailed model analysis
d-ulker Sep 15, 2025
7864363
Fix chart layout and vertical flow icons
d-ulker Sep 15, 2025
de5f4f2
CRITICAL FIX: Restore purple chart and fix data display
d-ulker Sep 15, 2025
b5f8044
Implement working real API and simplified approach
d-ulker Sep 15, 2025
2b0a2f6
CRITICAL FIX: Apply working solution to main demo
d-ulker Sep 15, 2025
2c6163a
CRITICAL FIX: Make functions globally available
d-ulker Sep 15, 2025
664dc45
MAJOR FIX: Replace complex demo with simple working functions
d-ulker Sep 15, 2025
612b393
FIX: Add proper event listeners for Process and Clear buttons
d-ulker Sep 15, 2025
dc68dff
FIX: Update CSP to allow cdn.jsdelivr.net connections
d-ulker Sep 15, 2025
3d03957
CRITICAL FIX: Show results sections when processing
d-ulker Sep 15, 2025
91dbed7
🎉 FINALLY FIXED: Chart rendering working perfectly!
d-ulker Sep 15, 2025
ef2a886
Fix summarization results and processing info display
d-ulker Sep 15, 2025
5a104c6
Switch to REAL API calls instead of mock data
d-ulker Sep 15, 2025
fc3b75c
Add Generate button and improve flow design
d-ulker Sep 15, 2025
dce40b9
Add Hugging Face AI text generation integration
d-ulker Sep 15, 2025
7e456c6
🔒 SECURITY: Implement secure token management system
d-ulker Sep 15, 2025
107e2d9
Fix test page to work with config.js token system
d-ulker Sep 15, 2025
9de3588
Add fallback config and debugging to test page
d-ulker Sep 15, 2025
eb75e4c
Fix config loading and 404 API errors
d-ulker Sep 15, 2025
12bf5ec
🚨 CRITICAL FIX: Resolve TypeError and config loading issues
d-ulker Sep 15, 2025
24d9497
🔄 WORKAROUND: Use static samples due to HF API 404 errors
d-ulker Sep 15, 2025
7abdd29
Add debugging to Generate button and fix static text generation
d-ulker Sep 15, 2025
5d0506a
🤖 IMPLEMENT: Dynamic AI text generation system
d-ulker Sep 15, 2025
96481fe
Update website branding and remove company elements
d-ulker Sep 15, 2025
e3a2a05
Remove demo.html page and update all references
d-ulker Sep 15, 2025
c50d954
Implement real OpenAI API for text generation
d-ulker Sep 15, 2025
e3b8a18
Implement secure API key configuration
d-ulker Sep 15, 2025
bd6713f
Add debugging to diagnose OpenAI API configuration issue
d-ulker Sep 15, 2025
d2c458e
Fix CSP to allow OpenAI API calls
d-ulker Sep 15, 2025
8e178ef
Clean up debugging code after CSP fix
d-ulker Sep 15, 2025
3a9e65c
Add SAMO emotion API to CSP allowlist
d-ulker Sep 15, 2025
92ff992
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 15, 2025
554f045
Update website to use new unified SAMO API
d-ulker Sep 15, 2025
9c2de7b
Fix dynamic text encoding in API URL
d-ulker Sep 15, 2025
2e5eedd
Fix API call method and add cache-busting
d-ulker Sep 15, 2025
7e35427
Add comprehensive debugging for API response analysis
d-ulker Sep 15, 2025
7a3e875
Remove mock data fallback to debug real API issues
d-ulker Sep 15, 2025
4218522
Switch back to working emotion API
d-ulker Sep 15, 2025
b82df58
Add detailed response debugging
d-ulker Sep 15, 2025
6e67873
Add cache-busting and API URL logging
d-ulker Sep 15, 2025
5a4a985
Add CORS proxy to fix API access issues
d-ulker Sep 15, 2025
0f9fe28
Add debugging to identify root cause of same results
d-ulker Sep 15, 2025
34e7da5
Fix CSP and CORS proxy issues
d-ulker Sep 15, 2025
3399bf0
Fix API error handling and text truncation
d-ulker Sep 15, 2025
a1d7d0a
feat: Complete SAMO-DL demo website integration (100%)
d-ulker Sep 15, 2025
5bc79cf
fix: Update demo website to use unified API with DeBERTa-v3 model
d-ulker Sep 15, 2025
916c78f
fix: Update minimal unified API to use DeBERTa-v3 model
d-ulker Sep 15, 2025
785ed7c
fix: Add sentencepiece dependency for T5 summarization
d-ulker Sep 15, 2025
ecdbb6a
fix: resolve security vulnerabilities and improve robustness
d-ulker Sep 15, 2025
b6c7f5b
fix: add robust array validation to prevent divide-by-zero and undefi…
d-ulker Sep 15, 2025
d2b622d
feat: implement centralized configuration system
d-ulker Sep 15, 2025
7944219
fix: Update Dockerfile to run minimal unified API
d-ulker Sep 15, 2025
3d2691c
Fix multiple deployment and CSS issues
d-ulker Sep 15, 2025
7f196f8
security: remove hardcoded HF token from test file
d-ulker Sep 15, 2025
881bb77
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 15, 2025
8002d3c
fix: pin package versions in apt-get install commands
d-ulker Sep 15, 2025
9a300c0
fix: add --no-install-recommends flag to apt-get install commands
d-ulker Sep 15, 2025
4388ebb
fix: remove redundant except HTTPException: raise blocks
d-ulker Sep 15, 2025
04f4f83
fix: address all 7 nitpick comments in test_demo_integration.py
d-ulker Sep 15, 2025
ea122be
fix: improve demo functionality and security enhancements
d-ulker Sep 15, 2025
9f38d8c
Fix Dockerfile to use requirements-api.txt with protobuf dependency
d-ulker Sep 15, 2025
f0055a0
Add missing protobuf and whisper dependencies to requirements-api.txt
d-ulker Sep 15, 2025
8512c8e
Security improvements: bind to localhost in dev, use requests library…
d-ulker Sep 15, 2025
cfd4103
fix: resolve major Deepsource security and code quality issues
d-ulker Sep 15, 2025
e4f8122
Fix Dockerfile: remove specific curl version constraint
d-ulker Sep 15, 2025
a740293
fix: resolve additional critical and major Deepsource issues
d-ulker Sep 15, 2025
78cc67a
fix: address multiple security and syntax issues
d-ulker Sep 15, 2025
201f6be
fix: standardize API endpoints and improve security
d-ulker Sep 15, 2025
a9e1564
fix: implement robust request handling with retry logic and JSON parsing
d-ulker Sep 15, 2025
e71d910
fix: resolve Deepsource code quality issues for branch files
d-ulker Sep 15, 2025
f46f808
Fix model file validation to treat empty/tiny files as missing
d-ulker Sep 15, 2025
29ad9a0
Fix import issues in unified_ai_api.py
d-ulker Sep 15, 2025
fcae542
fix: update unified API dependencies and configuration
d-ulker Sep 15, 2025
8c03934
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 16, 2025
9175338
fix: use coerced numeric variables in chart rendering to prevent XSS
d-ulker Sep 16, 2025
bba8175
fix: move test fixtures to module scope and fix base64 decoding
d-ulker Sep 16, 2025
17b3e44
fix: improve index page readability and update title
d-ulker Sep 16, 2025
dfbe893
Merge branch 'feat/dl-update-demo-website' of github.com:uelkerd/SAMO…
d-ulker Sep 16, 2025
2f13ccd
security: remove OpenAI API key from client config
d-ulker Sep 16, 2025
21d226d
security: remove OpenAI API key from client-side code
d-ulker Sep 16, 2025
9365c66
feat: add optimized Cloud Run deployment with architecture fix
d-ulker Sep 16, 2025
5a1a8d6
fix: remove unused substitution variables from cloudbuild config
d-ulker Sep 16, 2025
33dd9a6
fix: use proper variable syntax for Cloud Build substitutions
d-ulker Sep 16, 2025
d981f3f
fix: clarify demo is simulated, not real API
d-ulker Sep 16, 2025
dd7dffe
security: implement safe torch.load with weights_only
d-ulker Sep 16, 2025
75450cc
security: remove bogus python-cors dependency
d-ulker Sep 16, 2025
25243b4
fix: add missing ML dependencies for huggingface_hub and safetensors
d-ulker Sep 16, 2025
c0522fe
security: sanitize error responses to prevent information leakage
d-ulker Sep 16, 2025
5c3e061
security: add 45MB file size limit to voice-journal handler
d-ulker Sep 16, 2025
0f0cd33
security: fix remaining raw summary field usage in chart rendering
d-ulker Sep 16, 2025
4a9e2b0
fix: correct CSS properties and update API documentation
d-ulker Sep 16, 2025
f4f1951
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 16, 2025
adf4444
fix: comprehensive improvements across testing, API, and deployment
d-ulker Sep 16, 2025
db1fde0
fix: improve exception handling, type annotations, and workflow logic
d-ulker Sep 16, 2025
d527322
fix: correct undefined variable 'i' in linting fix script
d-ulker Sep 16, 2025
beee347
security: fix BAN-B104 host binding issues across all API servers
d-ulker Sep 16, 2025
6a7912d
fix: resolve PYL-W0612 unused variable issues across codebase
d-ulker Sep 16, 2025
6a0af80
fix: resolve PYL-W0613 unused argument issues
d-ulker Sep 16, 2025
59ef917
fix: add model.eval() to HuggingFace models in startup_api.py
d-ulker Sep 16, 2025
d6cabdf
Merge branch 'feat/dl-update-demo-website' of github.com:uelkerd/SAMO…
d-ulker Sep 16, 2025
9264ab3
refactor: improve emotion detection handlers with caching and Pydanti…
d-ulker Sep 16, 2025
9d0eabc
security: fix overly permissive CORS configuration in startup_api.py
d-ulker Sep 16, 2025
891b8df
security: enhance CSP headers with media-src, worker-src, and object-…
d-ulker Sep 16, 2025
7be6210
security: fix unsafe CORS configuration across all API files
d-ulker Sep 16, 2025
ce32587
fix: improve Docker image cleanup script for digest-only versions
d-ulker Sep 16, 2025
6056026
fix: use fully-qualified image names in cleanup script
d-ulker Sep 16, 2025
492510b
fix: improve script robustness and fix Cloud Build config
d-ulker Sep 16, 2025
e34818d
Update website to use optimized API and fix emotion bar charts
d-ulker Sep 16, 2025
40b1e34
Fix OpenAI generation to use sample text instead
d-ulker Sep 16, 2025
df8a290
Fix API call to use direct URL instead of CORS proxy
d-ulker Sep 16, 2025
f025519
Fix null reference error in progress steps
d-ulker Sep 16, 2025
9b96ce1
Fix API calls to use query parameters instead of JSON body
d-ulker Sep 16, 2025
8721af0
Fix performance optimizer to handle emotion data object format
d-ulker Sep 16, 2025
7fc453e
Add debugging to emotion chart creation
d-ulker Sep 16, 2025
d936cf9
Fix script path for config.js
d-ulker Sep 16, 2025
07fcfe1
Fix emotion display: show top 5 emotions vertically in chart area
d-ulker Sep 16, 2025
3f04300
Add real OpenAI API integration with secure key management
d-ulker Sep 16, 2025
bd2ab3f
Fix memory leaks and Chart.js loading issues
d-ulker Sep 16, 2025
48450ab
Fix critical Chart.js and DOM errors
d-ulker Sep 16, 2025
f9065ab
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 16, 2025
d02b182
Fix critical demo visual breakages and memory issues
d-ulker Sep 16, 2025
4aed379
Merge branch 'feat/dl-update-demo-website' of github.com:uelkerd/SAMO…
d-ulker Sep 16, 2025
e93d291
Fix Top 5 Emotions chart display by changing canvas to div
d-ulker Sep 16, 2025
a57efb0
Fix Chart.js dependency and add real performance timing
d-ulker Sep 16, 2025
1161047
Limit emotion chart to show only top 5 emotions
d-ulker Sep 16, 2025
09e0a2f
Implement real summarization API integration
d-ulker Sep 16, 2025
9ebf5bc
Fix critical JavaScript syntax error
d-ulker Sep 16, 2025
0d8c148
Fix summarization API call format to match emotion API
d-ulker Sep 16, 2025
e3a92cf
Add comprehensive debugging for summarization API response
d-ulker Sep 16, 2025
7ce546f
security: Fix XSS vulnerabilities and API error leakage
d-ulker Sep 16, 2025
857d634
security: Resolve critical vulnerabilities identified in code review
d-ulker Sep 16, 2025
82d972d
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 17, 2025
5644e17
Implement comprehensive dynamic redesign of demo page UI/UX
d-ulker Sep 17, 2025
c841454
Complete comprehensive code review remediation and security fixes
d-ulker Sep 17, 2025
2cd2e63
Merge branch 'feat/dl-update-demo-website' of github.com:uelkerd/SAMO…
d-ulker Sep 17, 2025
f08e0ca
Fix horizontal progress flow to be truly horizontal and unobtrusive
d-ulker Sep 17, 2025
b2ef471
Reverse debug section behavior: hidden by default with toggle button
d-ulker Sep 17, 2025
ebb18f1
Fix Processing Information display and add local development server
d-ulker Sep 17, 2025
bd45d25
Fix API configuration: use real APIs by default, mock only with ?mock…
d-ulker Sep 17, 2025
497436f
Fix shellcheck issues: unused variable and double quote variables
d-ulker Sep 17, 2025
4e00ed6
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 17, 2025
885f56b
Make start-simple.sh location-independent and more robust
d-ulker Sep 17, 2025
b0a4666
Update demo website and local server files
d-ulker Sep 17, 2025
d519857
Remove duplicate error-message CSS rules
d-ulker Sep 17, 2025
6cdab5b
Add missing CSS variables and namespace global selectors
d-ulker Sep 17, 2025
2db7506
Fix duplicate test function name F811
d-ulker Sep 17, 2025
3591f81
Improve test robustness: add env vars, mocking, and timeouts
d-ulker Sep 17, 2025
5bd2f5d
Fix duplicate function name: rename to test_demo_error_handling_contract
d-ulker Sep 17, 2025
ce9240d
Add processing_time_ms field to TextSummary schema
d-ulker Sep 17, 2025
48e655c
Add processing_time_ms field to VoiceTranscription model
d-ulker Sep 17, 2025
f023043
Fix CORS origin regex to return single combined regex string
d-ulker Sep 17, 2025
d27c662
Fix unescaped enclosed quotes SH-2027 in deployment validation script
d-ulker Sep 17, 2025
4d2e920
Pin package versions in Dockerfiles to fix DOK-DL3008 security issue
d-ulker Sep 17, 2025
dcf89d4
Add GitHub Pages origins to production CORS whitelist
d-ulker Sep 17, 2025
15c4e7f
Remove deb11u version pins from bookworm-based Dockerfiles
d-ulker Sep 17, 2025
34c233f
Improve simple_server.py: support JSON body, proper URL encoding, rem…
d-ulker Sep 17, 2025
fb9971d
Consolidate imports: move requests to top, ensure request is in Flask…
d-ulker Sep 17, 2025
892c3ee
Fix information exposure: add logging, generic error messages, detail…
d-ulker Sep 17, 2025
7185fe1
Add gcloud binary existence check before authentication validation
d-ulker Sep 17, 2025
1b1513a
Remove useless except handler that raises immediately (PYL-W0706)
d-ulker Sep 17, 2025
dcf9a33
Remove redundant imports of patch and Mock (PYL-W0404)
d-ulker Sep 17, 2025
28b1b7e
Fix unused variables (PYL-W0612): remove unused exception variables
d-ulker Sep 17, 2025
2333930
Address nitpick comments: harden scripts, improve error handling, par…
d-ulker Sep 17, 2025
f24203c
Fix processing_time_ms calculation timing: move after summarization c…
d-ulker Sep 17, 2025
8f99b61
Address code review comments: fix CORS regex, improve transcribe endp…
d-ulker Sep 17, 2025
eafef94
Address nitpick comments: improve logging, fix validation tests, opti…
d-ulker Sep 17, 2025
e713e13
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 17, 2025
e72490c
Fix critical demo interface issues for better UX
d-ulker Sep 17, 2025
3409b66
Fix DeepSource issues: undefined variables, f-string formatting, dupl…
d-ulker Sep 17, 2025
9d888d2
Fix more DeepSource issues: undefined variables, duplicate imports
d-ulker Sep 17, 2025
61eba6d
Fix major DeepSource issues: undefined variables, duplicate imports, …
d-ulker Sep 17, 2025
4712f76
Fix statement with no effect issues in evaluation scripts
d-ulker Sep 17, 2025
1051eaf
Fix subprocess security issues: remove shell=True, add proper error h…
d-ulker Sep 17, 2025
777f1a4
Fix critical issues: security binding, multiple imports, unused varia…
d-ulker Sep 17, 2025
c7cd2c1
Fix API endpoints, async blocking, and data validation issues
d-ulker Sep 17, 2025
575ede9
Fix critical syntax errors and unused variables
d-ulker Sep 17, 2025
0c18393
Fix major syntax errors in training and testing scripts
d-ulker Sep 17, 2025
9e68d76
Fix whitespace issues across 187 Python files
d-ulker Sep 17, 2025
5cafad6
Fix 19 nitpick issues across multiple files
d-ulker Sep 17, 2025
a5c87eb
Fix 34 nitpick comments across multiple files
d-ulker Sep 17, 2025
39f947f
Fix test mocking, Cloud Run host binding, and missing os import
d-ulker Sep 17, 2025
c2b5315
feat/dl: Add comprehensive demo page with DeBERTa v3 Large integration
deepsource-autofix[bot] Sep 17, 2025
f6718dd
Fix all critical and major DeepSource issues
d-ulker Sep 18, 2025
f74ece0
feat/dl: Major cleanup - Remove 180+ .pyc files, duplicate APIs, and …
d-ulker Sep 18, 2025
d7fe79e
feat/dl: Deep cleanup phase 2 - Remove 25+ excessive files and duplic…
d-ulker Sep 18, 2025
a7338fb
fix: Restore missing generateSampleText function to demo
d-ulker Sep 18, 2025
f5a7eec
fix: Restore all missing processing functions for demo
d-ulker Sep 18, 2025
9cc5d37
fix: Improve API timeout handling and user feedback
d-ulker Sep 18, 2025
f57d299
Fix comprehensive demo functionality and user experience
d-ulker Sep 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 23 additions & 1 deletion .deepsource.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
version = 1

exclude_patterns = [
"deprecated/**"
"deprecated/**",
"scripts/legacy/**",
"scripts/training/*_broken.py",
"scripts/training/working_training_script.py",
"scripts/training/simple_working_training.py",
"scripts/training/restart_training_debug.py",
"scripts/training/pre_training_validation.py",
"scripts/training/minimal_working_training.py",
"scripts/training/focal_loss_training.py",
"scripts/training/fixed_training_with_optimized_config.py",
"scripts/training/final_bulletproof_training_cell.py",
"scripts/training/bulletproof_training_cell_fixed.py",
"scripts/training/bulletproof_training_cell.py",
"scripts/testing/test_domain_adaptation.py",
"scripts/testing/standalone_focal_test.py",
"scripts/testing/simple_test.py",
"scripts/testing/simple_temperature_test_local.py",
"scripts/testing/quick_focal_test.py",
"scripts/testing/quick_f1_test.py",
"scripts/testing/local_validation_debug.py",
"scripts/maintenance/vertex_ai_setup_fixed.py",
"**/temp_*",
"**/test_temp_*"
]

[[analyzers]]
Expand Down
47 changes: 33 additions & 14 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
# Reduce Docker build context
.git
.github
.circleci
docs/
*.md
LICENSE
**/__pycache__/
**/*.pyc
.logs
.tmp
dist
build
artifacts
notebooks
tests/
.venv/
node_modules/
.env
*.pem
.key
id_*
Comment on lines +5 to +8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix secrets patterns: “.key” is a bug; broaden .env variants and narrow SSH key globs.

  • “.key” only ignores a file literally named “.key”; it won’t catch “server.key”, etc.
  • Only “.env” is ignored; common variants (.env.local, .env.production, *.env) may still leak into build contexts.
  • id_* is overly broad; prefer specific SSH key prefixes to avoid hiding unrelated files.

Apply:

-.env
-*.pem
-.key
-id_*
+.env
+.env.*
+*.env
+*.pem
+*.key
+# common certs/keystores
+*.crt
+*.cer
+*.der
+*.p12
+*.pfx
+*.jks
+*.keystore
+*.csr
+# SSH private keys
+id_rsa*
+id_dsa*
+id_ecdsa*
+id_ed25519*
+# cloud creds (example)
+service-account*.json
+*-credentials.json
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.env
*.pem
.key
id_*
.env
.env.*
*.env
*.pem
*.key
# common certs/keystores
*.crt
*.cer
*.der
*.p12
*.pfx
*.jks
*.keystore
*.csr
# SSH private keys
id_rsa*
id_dsa*
id_ecdsa*
id_ed25519*
# cloud creds (example)
service-account*.json
*-credentials.json
🤖 Prompt for AI Agents
In .dockerignore around lines 5–8, the patterns are too narrow or too broad:
".key" only matches a file literally named ".key", ".env" misses common
variants, and "id_*" is overly broad. Replace ".key" with "*.key" to catch files
like server.key, expand ".env" to ".env*" or add "*.env" to cover
.env.local/.env.production and similar variants, and tighten SSH key globs by
replacing "id_*" with explicit private key names such as "id_rsa", "id_dsa",
"id_ecdsa", and "id_ed25519" (and keep their public variants if desired) so
unrelated files aren't inadvertently ignored.

__pycache__/
*.pyc
*.pyo
*.pyd
.Python
env/
venv/
ENV/
env.bak/
venv.bak/
.pytest_cache/
.coverage
htmlcov/
.tox/
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.DS_Store
*.log
logs/
artifacts/
build/
dist/
*.egg-info/
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ __pypackages__/
.eggs/
.embeddings_cache/
.env
.env.*.local
.env.development
.env.*
.env.local
.env.development
.env.production
.env.test
website/config.js
.eslintcache
.flake8
.fuse_hidden*
Expand Down Expand Up @@ -385,4 +386,7 @@ coverage.xml
bandit-report.json
ci_pipeline.log

# Configuration files with sensitive data
# (website/config.js already ignored above)


Empty file added =3.20.0,
Empty file.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@ All notable changes to this project will be documented in this file.

## [Unreleased] - 2025-08-07

### 🎉 **SAMO-DL Demo Website Integration - 100% COMPLETE** - 2025-01-15
- ✅ **Fully Functional AI-Powered Demo Website**: Transformed static showcase into complete emotion analysis platform
- ✅ **Real API Integration**: Connected to live SAMO DeBERTa v3 Large emotion detection API via CORS proxy
- ✅ **Text Truncation System**: Implemented 400-character limit handling with user warnings and visual feedback
- ✅ **Error Handling**: Robust validation for empty text, special characters, and network errors
- ✅ **Custom Favicon**: Created and integrated bold 'S' favicon for professional appearance
- ✅ **CORS Proxy**: Built `website/cors-proxy.py` to bypass browser security restrictions
- ✅ **Security Headers**: Moved CSP from HTML meta tags to HTTP headers to eliminate violations
- ✅ **User Experience**: Added loading states, success animations, and clear error messages
- ✅ **API Testing**: Comprehensive testing with various text lengths and character types
- ✅ **Production Ready**: All components tested and verified for deployment

### Technical Achievements:
- **Root Cause Resolution**: Fixed 500 Internal Server Error by implementing proper error forwarding in CORS proxy
- **Text Processing**: Smart truncation system prevents API failures while maintaining user experience
- **Real Model Output**: Displays actual emotion analysis results from SAMO DeBERTa v3 Large (27 emotions)
- **Cross-Browser Compatibility**: Works across modern browsers with proper CORS handling
- **Performance Optimized**: Fast loading with efficient API calls and minimal overhead

### Files Created/Modified:
- `website/favicon.ico` - Custom bold 'S' favicon
- `website/comprehensive-demo.html` - Main demo page with favicon integration
- `website/simple-test.html` - Test page with favicon
- `website/index.html` - Homepage with favicon
- `website/js/simple-demo-functions.js` - Core functionality with truncation logic
- `website/cors-proxy.py` - CORS proxy with proper error handling
- `website/http-server-with-csp.py` - HTTP server with security headers

## [Unreleased] - 2025-08-07

### Added
- HF emotion model integration as default local provider with env toggles (`EMOTION_LOCAL_ONLY` default on, `EMOTION_MODEL_DIR` default `${EMOTION_MODEL_DIR:-/models/emotion-english-distilroberta-base}` from centralized constants).
- New endpoints in `deployment/secure_api_server.py`:
Expand Down
83 changes: 83 additions & 0 deletions Dockerfile.optimized
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Optimized Dockerfile for Cloud Run with pre-downloaded models
FROM python:3.11-slim

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl=7.74.0-1.3+deb11u7 \
git=1:2.30.2-1+deb11u2 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Set environment variables for model caching
ENV HF_HOME=/app/models
ENV TRANSFORMERS_CACHE=/app/models
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1

# Copy requirements and install dependencies
COPY dependencies/requirements-api.txt .
RUN pip install --no-cache-dir -r requirements-api.txt

# Create models directory
RUN mkdir -p /app/models

# Copy the pre-download script
COPY scripts/pre_download_models.py .

# Pre-download models during build (this will take time but ensures fast startup)
RUN python pre_download_models.py

# Validate models were downloaded correctly (critical for Cloud Run success)
RUN echo "🔍 Validating model cache..." && \
ls -la /app/models/ && \
echo "📊 Checking model sizes..." && \
du -sh /app/models/* && \
echo "✅ Model validation completed successfully"

# Create validation script
RUN echo '#!/usr/bin/env python3\n\
import os\n\
import sys\n\
print("🧪 Testing model accessibility...")\n\
\n\
# Test transformers cache\n\
try:\n\
from transformers import AutoTokenizer\n\
tokenizer = AutoTokenizer.from_pretrained("duelker/samo-goemotions-deberta-v3-large", cache_dir="/app/models", local_files_only=True)\n\
print("✅ DeBERTa tokenizer loads successfully")\n\
except Exception as e:\n\
print(f"❌ DeBERTa tokenizer failed: {e}")\n\
sys.exit(1)\n\
\n\
try:\n\
from transformers import T5Tokenizer\n\
t5_tokenizer = T5Tokenizer.from_pretrained("t5-small", cache_dir="/app/models", local_files_only=True)\n\
print("✅ T5 tokenizer loads successfully")\n\
except Exception as e:\n\
print(f"❌ T5 tokenizer failed: {e}")\n\
sys.exit(1)\n\
\n\
# Test Whisper model file exists\n\
whisper_path = "/app/models/base.pt"\n\
if os.path.exists(whisper_path):\n\
print(f"✅ Whisper model file exists at {whisper_path}")\n\
else:\n\
print(f"❌ Whisper model file missing at {whisper_path}")\n\
sys.exit(1)\n\
\n\
print("🎉 All model validation tests passed!")\n\
' > validate_models.py && chmod +x validate_models.py

# Run model validation
RUN python validate_models.py

# Copy source code
COPY src/ ./src/
COPY *.py ./

# Expose port
EXPOSE 8080

# Run the optimized API
CMD ["python", "src/startup_api.py"]
66 changes: 66 additions & 0 deletions SECURITY_NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 🔒 Security Notice - Token Management

## ⚠️ CRITICAL: JWT Token Handling

**Date:** September 15, 2025
**Issue:** Test reports contained actual JWT tokens from API testing

### Actions Taken ✅

1. **Sanitized test report:** `test_reports/comprehensive_api_test_1757950799.json`
- Replaced real JWT tokens with `[REDACTED_JWT_ACCESS_TOKEN]`
- Replaced refresh tokens with `[REDACTED_JWT_REFRESH_TOKEN]`

2. **Updated documentation examples:**
- Replaced example JWT fragments with placeholder text
- Used generic `JWT_ACCESS_TOKEN_HERE` in all docs

### Security Best Practices 🛡️

#### For Test Scripts
- **Never log actual JWT tokens** in test outputs
- Use placeholder tokens in test reports
- Sanitize sensitive data before saving results

#### For Documentation
- Use placeholder tokens like `JWT_ACCESS_TOKEN_HERE`
- Never include real API keys, tokens, or secrets
- Use `[REDACTED]` or `[PLACEHOLDER]` for sensitive fields

#### For Development
- Actual tokens are temporary (30min expiry) and test-only
- Never commit `.env` files with real credentials
- Use environment variables for production secrets

### Token Security Context 🔍

**The exposed tokens were:**
- ✅ **Temporary test tokens** (30-minute expiry)
- ✅ **Generated for testing purposes only**
- ✅ **Not production credentials**
- ✅ **Already expired**
- ✅ **From test user account** (`test_user_*@example.com`)

**Risk Assessment: LOW**
- Tokens were short-lived test credentials
- No production systems affected
- No real user data exposed

### Prevention Measures 🚨

1. **Updated test scripts** to sanitize tokens before logging
2. **Added security checks** to documentation process
3. **Created this security notice** for future reference

### Review Checklist ✅

Before committing any files, ensure:
- [ ] No real JWT tokens in any files
- [ ] No API keys or secrets in clear text
- [ ] Test reports use `[REDACTED]` for sensitive data
- [ ] Documentation uses placeholder tokens only

---

**Security Status: RESOLVED** ✅
**Future Risk: MITIGATED** 🛡️
60 changes: 60 additions & 0 deletions cloudbuild-optimized.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Cloud Build configuration for optimized SAMO Unified API
steps:
# Build the optimized Docker image with pre-downloaded models
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-f'
- 'Dockerfile.optimized'
- '--platform'
- 'linux/amd64'
- '-t'
- 'us-central1-docker.pkg.dev/${PROJECT_ID}/samo-dl/samo-unified-api-optimized:${COMMIT_SHA}'
- '-t'
- 'us-central1-docker.pkg.dev/${PROJECT_ID}/samo-dl/samo-unified-api-optimized:latest'
- '.'
timeout: '1200s' # 20 minutes for model downloads

# Push the image to Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'us-central1-docker.pkg.dev/${PROJECT_ID}/samo-dl/samo-unified-api-optimized:${COMMIT_SHA}'

- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'us-central1-docker.pkg.dev/${PROJECT_ID}/samo-dl/samo-unified-api-optimized:latest'

Comment on lines +18 to +28

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add vulnerability scanning and fail the build on HIGH/CRITICAL.
Mirror the gating in the other pipeline to keep parity.

Apply:

   - name: 'gcr.io/cloud-builders/docker'
     args: 
       - 'push'
       - 'us-central1-docker.pkg.dev/${PROJECT_ID}/samo-dl/samo-unified-api-optimized:latest'
 
+  - name: 'gcr.io/cloud-builders/gcloud'
+    args:
+      - 'artifacts','docker','images','scan'
+      - 'us-central1-docker.pkg.dev/${PROJECT_ID}/samo-dl/samo-unified-api-optimized:${COMMIT_SHA}'
+
+  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
+    entrypoint: 'bash'
+    args:
+      - -c
+      - |
+        set -euo pipefail
+        if gcloud artifacts docker images list-vulnerabilities \
+          us-central1-docker.pkg.dev/${PROJECT_ID}/samo-dl/samo-unified-api-optimized:${COMMIT_SHA} \
+          --format='get(vulnerability.effectiveSeverity)' | grep -Eq 'CRITICAL|HIGH'; then
+          echo 'Found HIGH/CRITICAL vulnerabilities'; exit 1;
+        else
+          echo 'No HIGH/CRITICAL vulnerabilities';
+        fi

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In cloudbuild-optimized.yaml around lines 18-28, the pipeline pushes two images
but lacks a vulnerability scan that fails the build on HIGH/CRITICAL like the
other pipeline; add a post-push Cloud Build step that invokes Google Cloud's
container vulnerability scanning (e.g., use gcloud container images scan or the
Container Analysis API/CLI equivalent) against both pushed image tags, parse the
scan results, and exit non-zero if any finding has severity HIGH or CRITICAL so
the build fails; ensure the step runs after both push steps, has appropriate IAM
scope (roles/containeranalysis.occurrences.viewer) and uses substitutions for
PROJECT_ID and COMMIT_SHA to mirror the gating in the other pipeline.

# Deploy to Cloud Run with bulletproof optimized settings
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: 'gcloud'
args:
- 'run'
- 'deploy'
- 'samo-unified-api-optimized'
- '--image=us-central1-docker.pkg.dev/${PROJECT_ID}/samo-dl/samo-unified-api-optimized:${COMMIT_SHA}'
- '--platform=managed'
- '--region=us-central1'
- '--allow-unauthenticated'
- '--port=8080'
- '--timeout=1200' # Extended timeout for model loading (20 minutes)
- '--cpu=2'
- '--memory=6Gi' # Increased memory for safe model loading
- '--max-instances=10'
- '--min-instances=0'
- '--concurrency=80'
- '--startup-cpu-boost' # Faster cold starts
- '--timeout=3600' # Request timeout (1 hour) - using supported flag
- '--set-env-vars=PYTHONUNBUFFERED=1' # Ensure logging works

Comment on lines +33 to +50

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Inject required secret into the service.
If the app expects SAMO_EMOTION_API_KEY, add --set-secrets (no secret is passed today).

Apply:

       - '--startup-cpu-boost'  # Faster cold starts
-      - '--timeout=3600'  # Request timeout (1 hour) - using supported flag
-      - '--set-env-vars=PYTHONUNBUFFERED=1'  # Ensure logging works
+      - '--timeout=3600'  # Request timeout (1 hour)
+      - '--set-env-vars=PYTHONUNBUFFERED=1'
+      - '--set-secrets=SAMO_EMOTION_API_KEY=SAMO_EMOTION_API_KEY:latest'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- 'run'
- 'deploy'
- 'samo-unified-api-optimized'
- '--image=us-central1-docker.pkg.dev/${PROJECT_ID}/samo-dl/samo-unified-api-optimized:${COMMIT_SHA}'
- '--platform=managed'
- '--region=us-central1'
- '--allow-unauthenticated'
- '--port=8080'
- '--timeout=1200' # Extended timeout for model loading (20 minutes)
- '--cpu=2'
- '--memory=6Gi' # Increased memory for safe model loading
- '--max-instances=10'
- '--min-instances=0'
- '--concurrency=80'
- '--startup-cpu-boost' # Faster cold starts
- '--timeout=3600' # Request timeout (1 hour) - using supported flag
- '--set-env-vars=PYTHONUNBUFFERED=1' # Ensure logging works
- 'run'
- 'deploy'
- 'samo-unified-api-optimized'
- '--image=us-central1-docker.pkg.dev/${PROJECT_ID}/samo-dl/samo-unified-api-optimized:${COMMIT_SHA}'
- '--platform=managed'
- '--region=us-central1'
- '--allow-unauthenticated'
- '--port=8080'
- '--timeout=1200' # Extended timeout for model loading (20 minutes)
- '--cpu=2'
- '--memory=6Gi' # Increased memory for safe model loading
- '--max-instances=10'
- '--min-instances=0'
- '--concurrency=80'
- '--startup-cpu-boost' # Faster cold starts
- '--timeout=3600' # Request timeout (1 hour)
- '--set-env-vars=PYTHONUNBUFFERED=1'
- '--set-secrets=SAMO_EMOTION_API_KEY=SAMO_EMOTION_API_KEY:latest'
🤖 Prompt for AI Agents
In cloudbuild-optimized.yaml around lines 33 to 50, the Cloud Run deploy step
does not inject the required secret SAMO_EMOTION_API_KEY; add a --set-secrets
flag to the deploy args so the service receives the secret as an env var, for
example add
--set-secrets=SAMO_EMOTION_API_KEY=projects/${PROJECT_ID}/secrets/SAMO_EMOTION_API_KEY:latest
(or use the appropriate secret resource and version) alongside the other deploy
flags; place the flag with the other --set-* options to ensure the runtime
receives the key.

# Build options
options:
machineType: 'E2_HIGHCPU_8' # Use high-CPU machine for faster builds
diskSizeGb: 100 # Larger disk for model downloads
logging: CLOUD_LOGGING_ONLY

# Substitution variables are provided by Cloud Build automatically

# Build timeout
timeout: '1800s' # 30 minutes total
Loading
Loading