Skip to content

Commit

Permalink
show correct error when ai is not supported in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbenz committed Aug 26, 2024
1 parent ab2bc2a commit de2d5c5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ async function generateSummary(text) {
}

async function createSummarizationSession(downloadProgressCallback) {
if (!window.ai.summarizer) {
throw new Error('AI Summarization is not supported');
if (!window.ai || !window.ai.summarizer) {
throw new Error('AI Summarization is not supported in this browser');
}
const canSummarize = await window.ai.summarizer.capabilities();
if (canSummarize.available === 'no') {
Expand Down

0 comments on commit de2d5c5

Please sign in to comment.