Skip to content

fix: restore difficulty extraction in content script#202

Open
VarshithReddy2006 wants to merge 1 commit into
vanshaggarwal27:mainfrom
VarshithReddy2006:fix/duplicate-difficulty-declarations-v2
Open

fix: restore difficulty extraction in content script#202
VarshithReddy2006 wants to merge 1 commit into
vanshaggarwal27:mainfrom
VarshithReddy2006:fix/duplicate-difficulty-declarations-v2

Conversation

@VarshithReddy2006

Copy link
Copy Markdown
Contributor

Description

This PR restores difficulty extraction in the content script before the blog generation payload is sent.

The payload currently includes the difficulty field:

payload: {
  title,
  description,
  code,
  author,
  client_time,
  custom_prompt,
  difficulty,
  language
}

However, the difficulty extraction logic was missing, causing difficulty to be undefined at runtime.

This change restores the difficulty detection logic and ensures a valid difficulty value is included in generated blog requests.

Related Issue

Fixes #197

Type of Change

  • Bug fix
  • New feature
  • Documentation update

Checklist

  • My code follows project guidelines
  • I have tested my changes
  • Documentation updated if needed

Verification

  • Restored difficulty extraction using existing LeetCode difficulty selectors.
  • Verified difficulty is defined before being used in the payload.
  • Verified the content script passes syntax validation:
node --check extension/content.js
  • Confirmed only a single difficulty extraction block exists.

@VarshithReddy2006

Copy link
Copy Markdown
Contributor Author

Hi @vanshaggarwal27 ,

While working on #197, I noticed that after removing the duplicate declarations, the content script still references difficulty inside the GENERATE_BLOG payload, but the difficulty extraction logic is no longer present in the current code.

This PR restores the missing difficulty extraction block so that difficulty is defined before being used in the payload, preventing runtime failures and ensuring difficulty information is included in generated blog content.

Could you please take a look when you get a chance? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] : Content Script Fails to Load Due to Duplicate const Declarations in triggerBlogGeneration

1 participant