feat(audit): Auto-load cached AI analysis on page open
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
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
Instead of requiring users to click "Wygeneruj analize AI" every time, the audit pages now automatically fetch cached analysis on DOMContentLoaded. If cache exists, results render instantly; if not, the generate button remains. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a6d7fc343e
commit
3307d99729
@ -161,3 +161,31 @@
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
if (typeof companyId === 'undefined' || typeof auditType === 'undefined') return;
|
||||
|
||||
fetch('/api/audit/analyze', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
},
|
||||
body: JSON.stringify({
|
||||
company_id: companyId,
|
||||
audit_type: auditType,
|
||||
force: false
|
||||
})
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
if (data.success && data.cached) {
|
||||
var prompt = document.getElementById('aiAnalyzePrompt');
|
||||
if (prompt) prompt.style.display = 'none';
|
||||
renderAIResults(data);
|
||||
}
|
||||
})
|
||||
.catch(function() {});
|
||||
});
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user