v3.1.3: Fix SPA redeclaration errors, update docker-compose for cookies
Some checks failed
Docker Build & Push / build (push) Has been cancelled

This commit is contained in:
KV-Tube Deployer 2026-01-20 07:25:27 +07:00
parent 663ef6ba44
commit 79f69772a0
3 changed files with 304 additions and 295 deletions

View file

@ -14,11 +14,14 @@ services:
volumes:
# Persist data (Easy setup: Just maps a folder)
- ./data:/app/data
# Cookies file for YouTube (Required for NAS/Server to fix "Transcript not available")
- ./data/cookies.txt:/app/cookies.txt
# Local videos folder (Optional)
# - ./videos:/app/youtube_downloads
environment:
- PYTHONUNBUFFERED=1
- FLASK_ENV=production
- COOKIES_FILE=/app/cookies.txt
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:5000/" ]
interval: 30s

19
static/js/webllm-service.js Normal file → Executable file
View file

@ -3,7 +3,10 @@
* Uses MLC's WebLLM for on-device AI inference via WebGPU
*/
class WebLLMService {
// Guard against redeclaration on SPA navigation
if (typeof WebLLMService === 'undefined') {
class WebLLMService {
constructor() {
this.engine = null;
this.isLoading = false;
@ -329,12 +332,14 @@ Do NOT copy sentences from the transcript. Instead, synthesize the core ideas in
this.loadProgress = 0;
}
}
}
}
// Global singleton instance
window.webLLMService = new WebLLMService();
// Global singleton instance
window.webLLMService = new WebLLMService();
// Export for module usage
if (typeof module !== 'undefined' && module.exports) {
// Export for module usage
if (typeof module !== 'undefined' && module.exports) {
module.exports = WebLLMService;
}
}
} // End guard block for WebLLMService

View file

@ -1703,10 +1703,11 @@
<script>
// Track current language state and WebLLM status
let currentSummaryLang = 'en';
let webllmInitialized = false;
let currentTranscriptText = null;
let currentSummaryData = { en: null, vi: null };
// Use var and guards to prevent redeclaration errors on SPA navigation
if (typeof currentSummaryLang === 'undefined') var currentSummaryLang = 'en';
if (typeof webllmInitialized === 'undefined') var webllmInitialized = false;
if (typeof currentTranscriptText === 'undefined') var currentTranscriptText = null;
if (typeof currentSummaryData === 'undefined') var currentSummaryData = { en: null, vi: null };
// WebLLM Progress Update Handler - Silent loading (just log to console)
function updateWebLLMProgress(percent, status) {