-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: custom action fix #1150
feat: custom action fix #1150
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughMinor changes in 🔗 Related PRs
Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts belowEmoji Descriptions:
Interact with the Bot:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to 4c4d743 in 37 seconds
More details
- Looked at
45
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. js/src/frameworks/langchain.spec.ts:68
- Draft comment:
expect
should not be awaited as it is not a promise.
expect(tools.length).toBe(1);
- Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_ZYt63caQvjTp4edd
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
actions: ["starRepositoryCustomAction"], | ||
}); | ||
|
||
await expect(tools.length).toBe(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect
should not be awaited as it is not a promise.
await expect(tools.length).toBe(1); | |
expect(tools.length).toBe(1); |
This comment was generated by github-actions[bot]! JS SDK Coverage Report📊 Coverage report for JS SDK can be found at the following URL: 📁 Test report folder can be found at the following URL: |
@@ -60,10 +60,11 @@ describe("Apps class tests", () => { | |||
}, | |||
}); | |||
|
|||
langchainToolSet.getTools({ | |||
const tools = await langchainToolSet.getTools({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good improvement adding proper async/await handling here. This prevents potential race conditions and makes the code more reliable. However, consider adding a test description that better explains what's being tested, e.g.:
it('should return exactly one tool when requesting starRepositoryCustomAction', async () => {
// ... rest of the test
});
).filter((action) => { | ||
const { name: actionName, toolName } = action.metadata || {}; | ||
const customActions = await this.userActionRegistry.getAllActions(); | ||
const toolsWithCustomActions = customActions.filter((action) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding null/undefined checks for the action
object since you're destructuring it directly. A safer approach would be:
const { name: actionName } = action?.metadata || {};
This prevents potential runtime errors if action
is null/undefined.
Code Review SummaryOverall, the changes look good and improve the codebase in several ways: Positive Changes:✅ Added proper async/await handling in test file Suggestions for Improvement:
Code Quality: 8/10The changes make the code more maintainable and reliable while maintaining functionality. The removal of redundant filtering improves code clarity. |
🔍 Review Summary
Minor updates were made to
langchain.spec.ts
andbase.toolset.ts
to enhance the efficiency of custom action processing.Original Description