fix: use generatedCopy.text instead of full object#2247
fix: use generatedCopy.text instead of full object#2247matt-aitken merged 1 commit intotriggerdotdev:mainfrom
Conversation
I believe the generatedCopy is the object that the AI SDK returns and we want to pass the text of the object rather in our template literal.
|
WalkthroughThe update modifies the AI agent workflow documentation to clarify that only the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docs/guides/ai-agents/generate-translate-copy.mdx (1)
60-65: Trim before splitting to avoid off-by-one word countsIf
generatedCopy.textends or begins with whitespace,split(/\s+/)will yield an extra empty string at index 0/-1. A quick trim keeps the count accurate:-const wordCount = generatedCopy.text.split(/\s+/).length; +const wordCount = generatedCopy.text.trim().split(/\s+/).length;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/guides/ai-agents/generate-translate-copy.mdx(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: nicktrn
PR: triggerdotdev/trigger.dev#1306
File: docs/github-actions.mdx:59-59
Timestamp: 2024-09-23T13:06:26.429Z
Learning: When suggesting changes to documentation, note that the team prefers to keep them simple to avoid confusion.
Learnt from: nicktrn
PR: triggerdotdev/trigger.dev#1306
File: docs/github-actions.mdx:59-59
Timestamp: 2024-10-12T01:08:24.066Z
Learning: When suggesting changes to documentation, note that the team prefers to keep them simple to avoid confusion.
docs/guides/ai-agents/generate-translate-copy.mdx (1)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-30T13:22:21.528Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : If you are able to generate an example payload for a task, do so.
🔇 Additional comments (1)
docs/guides/ai-agents/generate-translate-copy.mdx (1)
83-84: Correct property usage – nice catchSwitching to
${generatedCopy.text}prevents the entire response object (including metadata) from being passed to the translator, which could previously yield[object Object]in the prompt. LGTM.
Ran into a small issue when following the example at https://trigger.dev/docs/guides/ai-agents/generate-translate-copy.
This PR includes a minor fix to address it.
✅ Checklist
Testing
Manually verified that
generatedCopy.textis rendered correctly in the template literal.Changelog
Fixed a bug where the AI-generated object was being passed instead of its
.textvalue.Screenshots
N/A