v3.1.3: Fix SPA redeclaration errors, update docker-compose for cookies
Some checks failed
Docker Build & Push / build (push) Has been cancelled
Some checks failed
Docker Build & Push / build (push) Has been cancelled
This commit is contained in:
parent
663ef6ba44
commit
79f69772a0
3 changed files with 304 additions and 295 deletions
|
|
@ -14,11 +14,14 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
# Persist data (Easy setup: Just maps a folder)
|
# Persist data (Easy setup: Just maps a folder)
|
||||||
- ./data:/app/data
|
- ./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)
|
# Local videos folder (Optional)
|
||||||
# - ./videos:/app/youtube_downloads
|
# - ./videos:/app/youtube_downloads
|
||||||
environment:
|
environment:
|
||||||
- PYTHONUNBUFFERED=1
|
- PYTHONUNBUFFERED=1
|
||||||
- FLASK_ENV=production
|
- FLASK_ENV=production
|
||||||
|
- COOKIES_FILE=/app/cookies.txt
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "curl", "-f", "http://localhost:5000/" ]
|
test: [ "CMD", "curl", "-f", "http://localhost:5000/" ]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
|
|
|
||||||
19
static/js/webllm-service.js
Normal file → Executable file
19
static/js/webllm-service.js
Normal file → Executable file
|
|
@ -3,7 +3,10 @@
|
||||||
* Uses MLC's WebLLM for on-device AI inference via WebGPU
|
* 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() {
|
constructor() {
|
||||||
this.engine = null;
|
this.engine = null;
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
|
|
@ -329,12 +332,14 @@ Do NOT copy sentences from the transcript. Instead, synthesize the core ideas in
|
||||||
this.loadProgress = 0;
|
this.loadProgress = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global singleton instance
|
// Global singleton instance
|
||||||
window.webLLMService = new WebLLMService();
|
window.webLLMService = new WebLLMService();
|
||||||
|
|
||||||
// Export for module usage
|
// Export for module usage
|
||||||
if (typeof module !== 'undefined' && module.exports) {
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
module.exports = WebLLMService;
|
module.exports = WebLLMService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End guard block for WebLLMService
|
||||||
|
|
|
||||||
|
|
@ -1703,10 +1703,11 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Track current language state and WebLLM status
|
// Track current language state and WebLLM status
|
||||||
let currentSummaryLang = 'en';
|
// Use var and guards to prevent redeclaration errors on SPA navigation
|
||||||
let webllmInitialized = false;
|
if (typeof currentSummaryLang === 'undefined') var currentSummaryLang = 'en';
|
||||||
let currentTranscriptText = null;
|
if (typeof webllmInitialized === 'undefined') var webllmInitialized = false;
|
||||||
let currentSummaryData = { en: null, vi: null };
|
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)
|
// WebLLM Progress Update Handler - Silent loading (just log to console)
|
||||||
function updateWebLLMProgress(percent, status) {
|
function updateWebLLMProgress(percent, status) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue