-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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: Creating Archetype Selector #2422
Conversation
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.
Hi @alvarosps! Welcome to the elizaOS community. Thanks for submitting your first pull request; your efforts are helping us accelerate towards AGI. We'll review it shortly. You are now an elizaOS contributor!
📝 WalkthroughWalkthroughThe pull request introduces a new feature for agent archetype selection and management. A new Changes
Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Nitpick comments (2)
client/src/types/archetypes.ts (1)
17-21
: Remove duplicated style propertiesThe style properties are identical across all contexts (all, chat, post) for each archetype. Consider simplifying the structure.
style: { - all: ["Optimistic", "Encouraging", "Kind"], - chat: ["Optimistic", "Encouraging", "Kind"], - post: ["Optimistic", "Encouraging", "Kind"], + all: ["Optimistic", "Encouraging", "Kind"] },Also applies to: 48-52, 86-90
client/src/lib/api.ts (1)
105-110
: Add return type annotation for consistency.The implementation looks good but could benefit from an explicit return type annotation for better type safety and documentation.
- applyArchetype: (agentId: string, archetype: Character) => + applyArchetype: (agentId: string, archetype: Character): Promise<Character> =>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
client/src/App.tsx
(2 hunks)client/src/components/app-sidebar.tsx
(1 hunks)client/src/components/archetype-selector.tsx
(1 hunks)client/src/lib/api.ts
(1 hunks)client/src/types/archetypes.ts
(1 hunks)packages/client-direct/src/api.ts
(4 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/client-direct/src/api.ts
🧰 Additional context used
🪛 Biome (1.9.4)
client/src/components/app-sidebar.tsx
[error] 93-93: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
(lint/correctness/useJsxKeyInIterable)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: integration-tests
- GitHub Check: smoke-tests
🔇 Additional comments (2)
client/src/lib/api.ts (2)
105-110
: Implementation looks good!The method follows existing patterns, uses proper types, and inherits robust error handling from the fetcher utility.
105-110
: Consider URL pattern consistency.Some endpoints use
/agents/
prefix while others don't. Consider standardizing the URL patterns across all agent-related endpoints.
…potential issues and improving the code
…osps/eliza into feature/archetype-selector
Head branch was pushed to by a user without write access
try { | ||
setIsApplying(true); | ||
await apiClient.applyArchetype( | ||
agentId as UUID, | ||
archetypes[selectedArchetype] | ||
); | ||
setApplyStatus("success"); | ||
} catch (error) { | ||
console.error("Failed to apply archetype:", error); | ||
setApplyStatus( | ||
`Error: ${error instanceof Error ? error.message : "Unknown error"}` | ||
); | ||
} finally { | ||
setIsApplying(false); | ||
} |
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.
The setApplyStatus('success')
call appears to be in the wrong place. Since it's inside the try
block but before the await
, it will execute before knowing if the API call succeeded. Moving it after the await
would ensure the success message only displays after a confirmed successful API response.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
Hello, We are changing our plugin development strategy to be more scalable. We have moved the plugins out into their own repos and we're looking for people to either maintain those or own them on their own Github. If you'd like to be a maintainer, file an issue in the plugin repo and join our Discord https://discord.gg/elizaos to coordinate. If you'd like to control the plugin on your own Github, please add an issue to the plugin repo pointing to your repo, and add a modification to the registry. Submit a PR to edit the registry here: https://github.com/elizaos-plugins/registry Closing this PR for now. Let us know if you have any questions. |
Add Archetype Selector for Agent Customization
What does this PR do?
This PR introduces the Archetype Selector feature to enable customization of agent behaviors via predefined archetypes. This contribution includes:
New Component: ArchetypeSelector
Backend API Integration:
Reuses the /agents/:agentId/set route to apply archetypes.
Ensures validation and logging during archetype application.
UI Enhancements:
This feature enhances user experience by:
Allowing users to modify agent behavior dynamically without direct configuration file edits.
Supporting modular design with predefined archetypes for consistent customization.
Documentation changes needed?
My changes do not require a project documentation change.
Testing
I wanted to write unit tests, but this is my first contribution to the project, and I could not find unit tests already created in the frontend project, only inside the project packages. Since I did not want to make more changes, like adding new libraries, I didn't include unit tests (even though I've written some test cases).
To test, you can run the application locally, and you should be able to see the button in the sidebar to see the new UI, and select from the current example archetypes. This will change the current agent archetype. This is a 1st version of the feature, so there is a lot of room for improvement in the future.
Screenshots
Discord username alvarosps