Skip to content

fix(server): generate content opportunities and briefs in the brand's… - #640

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
d180:fix/content-opportunities-language
Aug 4, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
d180:fix/content-opportunities-language

Conversation

@d180

@d180 d180 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Content Opportunities and their AI-generated briefs were always produced in English, even for brands with a non-English brands.language (e.g. tr), because neither generation path read the language column or told the model what language to write in.
  • Add language to the brand .select(...) in both server/src/lib/opportunity-generator.js (opportunity generation) and server/src/routes/content.js (brief generation).
  • Pass getLanguageName(brand.language) into each prompt with an IMPORTANT: Write ... in ${langName}. instruction — matching the same convention already used in content-worker.js, topics.js, competitors.js, and prompts.js.
  • No migration or re-analysis needed: language already defaults to 'en' on brands, so English brands see no behavior change; the fix applies on the next generation cycle.

Related issue

Closes #638

Type of change

  • fix — Bug fix

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • npm run lint passes (run from server/; this PR only touches server/, no web/ changes)
  • npm run format:check passes (run from server/)
  • npm run test passes (run from server/, 147/147 tests)
  • Changes are focused — one concern per PR

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly the fix from the issue, and good call reusing the existing languages.js map. One optional follow-up: the issue's acceptance notes say proper nouns (brand/competitor names) shouldn't be translated — appending "keep proper nouns and metric names as-is" to the language instruction would pin that down. Fine as-is. Thanks!

@gkhngyk
gkhngyk merged commit b3b6c3b into ansvisor:main Aug 4, 2026
4 checks passed
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.

Content Opportunities and briefs are always generated in English regardless of the brand's language

2 participants