chore: bump version to 0.1.30 and enhance message formatting in AI in…#142
Conversation
…teractions - Updated package version to 0.1.30. - Improved message formatting in AI chat requests to handle null and undefined content, ensuring more robust message construction. - Added support for including tool calls and tool call IDs in messages for enhanced context in AI interactions.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughMessage construction for the ChangesTool call metadata forwarding across providers
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/supercode-cli/server/src/index.ts (1)
255-263: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the repeated message-mapping into a shared helper.
These three blocks (openrouter, nvidia, concentrateai branches) are byte-for-byte identical. Duplicating the normalization/forwarding logic across providers risks them drifting apart on future edits. Consider a single helper, e.g.:
const toProviderMessage = (m: any) => { const msg: any = { role: m.role, content: m.content !== null && m.content !== undefined ? String(m.content) : "", } if (m.tool_calls) msg.tool_calls = m.tool_calls if (m.tool_call_id) msg.tool_call_id = m.tool_call_id return msg } // ... messages: nonSystemMessages.map(toProviderMessage),This is also identical to the mapping in
openrouter-service.ts(lines 75–83), so a shared module-level util would remove duplication across files.Also applies to: 404-412, 512-520
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/supercode-cli/server/src/index.ts` around lines 255 - 263, Extract the repeated nonSystemMessages mapping logic into a shared helper instead of duplicating the same normalization in the openrouter, nvidia, and concentrateai branches. Create a reusable message converter (for example, a module-level helper alongside the code in index.ts, or a shared util used by openrouter-service.ts as well) that builds the provider message object with role, stringified content, and optional tool_calls/tool_call_id, then use it in each branch via messages: nonSystemMessages.map(helperName). Keep the helper name and call sites aligned so future edits only need to be made in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/supercode-cli/server/src/index.ts`:
- Around line 255-263: Extract the repeated nonSystemMessages mapping logic into
a shared helper instead of duplicating the same normalization in the openrouter,
nvidia, and concentrateai branches. Create a reusable message converter (for
example, a module-level helper alongside the code in index.ts, or a shared util
used by openrouter-service.ts as well) that builds the provider message object
with role, stringified content, and optional tool_calls/tool_call_id, then use
it in each branch via messages: nonSystemMessages.map(helperName). Keep the
helper name and call sites aligned so future edits only need to be made in one
place.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6bd671d2-f293-4548-a028-671773ae5ace
📒 Files selected for processing (3)
apps/supercode-cli/server/package.jsonapps/supercode-cli/server/src/cli/ai/openrouter-service.tsapps/supercode-cli/server/src/index.ts
…teractions
Summary by CodeRabbit
Bug Fixes
Chores
0.1.30.