-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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(new-plugin): deva client integration #1238
feat(new-plugin): deva client integration #1238
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis pull request introduces the Deva client integration into the system, adding a new client platform with support for persona management, post creation, and interaction. The changes span multiple files, including configuration, documentation, and source code, to enable seamless integration of the Deva.me platform into the existing agent framework. Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 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: 15
🧹 Nitpick comments (7)
packages/client-deva/src/controller.ts (2)
190-192
: Ensure unique room IDs using persona IDGenerating
roomId
withthis.persona.username
may cause conflicts if usernames are not unique. Usingthis.persona.id
ensures uniqueness.Update the
roomId
generation:const roomId = stringToUuid( - "deva_generate_room-" + this.persona.username + "deva_generate_room-" + this.persona.id );
238-238
: Use consistent logging with 'elizaLogger'Replace
console.log(newPostContent);
withelizaLogger.log(newPostContent);
to maintain consistent logging practices throughout the code.Apply this diff:
- console.log(newPostContent); + elizaLogger.log(newPostContent);packages/client-deva/src/types.ts (2)
1-9
: Mark optional properties and correct types in 'DevaPersona'Properties like
description
,avatar
, andcover_image
may not always be present. Mark them as optional and adjust types if necessary.Modify the type definitions:
export type DevaPersona = { id: string; user_id: string; display_name: string; username: string; - description: string; + description?: string; - avatar: number; - cover_image: number; + avatar?: number; + cover_image?: number; };
11-21
: Adjust 'DevaPost' types for nullable fieldsFields like
in_reply_to_id
,mentioned_profile_persona_id
, andpersona
might be null. Update their types to reflect this possibility.Update the type definitions:
export type DevaPost = { id: string; author_type: string; text: string; persona_id: string; - in_reply_to_id: string; - mentioned_profile_persona_id: string; - persona: DevaPersona; + in_reply_to_id?: string | null; + mentioned_profile_persona_id?: string | null; + persona?: DevaPersona | null; created_at: string; updated_at: string; };packages/client-deva/src/index.ts (1)
17-19
: Add null check for character name.The success message assumes character name exists.
elizaLogger.success( - `✅ Deva client successfully started for character ${runtime.character.name}` + `✅ Deva client successfully started${runtime.character?.name ? ` for character ${runtime.character.name}` : ''}` );packages/client-deva/src/base.ts (1)
57-58
: Replace console.log with elizaLogger.Use consistent logging mechanism.
-console.log(res); +elizaLogger.debug("Post creation response:", res);docs/docs/packages/clients.md (1)
377-377
: Remove debug console.log statement.Production code should not contain debug logging statements.
- console.log(res);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (19)
.env.example
(1 hunks)agent/package.json
(1 hunks)agent/src/index.ts
(2 hunks)docs/api/enumerations/Clients.md
(1 hunks)docs/docs/packages/clients.md
(9 hunks)packages/client-deva/.npmignore
(1 hunks)packages/client-deva/eslint.config.mjs
(1 hunks)packages/client-deva/package.json
(1 hunks)packages/client-deva/src/base.ts
(1 hunks)packages/client-deva/src/controller.ts
(1 hunks)packages/client-deva/src/devaClient.ts
(1 hunks)packages/client-deva/src/enviroment.ts
(1 hunks)packages/client-deva/src/index.ts
(1 hunks)packages/client-deva/src/templates.ts
(1 hunks)packages/client-deva/src/types.ts
(1 hunks)packages/client-deva/tsconfig.json
(1 hunks)packages/client-deva/tsup.config.ts
(1 hunks)packages/core/src/defaultCharacter.ts
(1 hunks)packages/core/src/types.ts
(2 hunks)
✅ Files skipped from review due to trivial changes (5)
- packages/client-deva/eslint.config.mjs
- packages/client-deva/tsconfig.json
- packages/client-deva/.npmignore
- packages/client-deva/tsup.config.ts
- packages/client-deva/package.json
🧰 Additional context used
🪛 LanguageTool
docs/docs/packages/clients.md
[style] ~43-~43: This phrase is redundant (‘I’ stands for ‘interface’). Use simply “API”.
Context: ...ect** (@eliza/client-direct
) - Direct API interface for custom integrations - Auto (`@e...
(ACRONYM_TAUTOLOGY)
🪛 Markdownlint (0.37.0)
docs/docs/packages/clients.md
554-554: Column: 1
Hard tabs
(MD010, no-hard-tabs)
555-555: Column: 1
Hard tabs
(MD010, no-hard-tabs)
564-564: Column: 1
Hard tabs
(MD010, no-hard-tabs)
565-565: Column: 1
Hard tabs
(MD010, no-hard-tabs)
566-566: Column: 1
Hard tabs
(MD010, no-hard-tabs)
575-575: Column: 1
Hard tabs
(MD010, no-hard-tabs)
576-576: Column: 1
Hard tabs
(MD010, no-hard-tabs)
577-577: Column: 1
Hard tabs
(MD010, no-hard-tabs)
578-578: Column: 1
Hard tabs
(MD010, no-hard-tabs)
586-586: Column: 1
Hard tabs
(MD010, no-hard-tabs)
587-587: Column: 1
Hard tabs
(MD010, no-hard-tabs)
588-588: Column: 1
Hard tabs
(MD010, no-hard-tabs)
589-589: Column: 1
Hard tabs
(MD010, no-hard-tabs)
590-590: Column: 1
Hard tabs
(MD010, no-hard-tabs)
591-591: Column: 1
Hard tabs
(MD010, no-hard-tabs)
592-592: Column: 1
Hard tabs
(MD010, no-hard-tabs)
593-593: Column: 1
Hard tabs
(MD010, no-hard-tabs)
🔇 Additional comments (6)
packages/client-deva/src/templates.ts (1)
1-24
: Verify all placeholders are providedEnsure that all placeholders like
{{adjective}}
and{{topic}}
used in the template have corresponding values in the context to prevent unresolved variables in generated posts.packages/core/src/defaultCharacter.ts (1)
8-8
: Verify the impact of changing the default model provider.This changes the default model from LLAMALOCAL to OPENAI, which might affect users relying on the default local setup.
Run this script to check for potential impacts:
✅ Verification successful
Change to OPENAI as default provider is safe
The codebase is designed to be provider-agnostic, with multiple configuration levels allowing users to override the default provider through character configuration or runtime options.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Find character configurations that might be affected by the default model provider change # Search for character configurations that don't specify a model provider rg -l "\"modelProvider\"" -vLength of output: 65716
Script:
#!/bin/bash # Find files importing defaultCharacter.ts rg -l "from.*defaultCharacter" # Find tests that might reference the default model provider rg -l "modelProvider.*LLAMALOCAL|LLAMALOCAL.*modelProvider" "**/*test*" # Look for direct references to defaultCharacter rg -l "defaultCharacter" "packages/core"Length of output: 639
Script:
#!/bin/bash # Check content of test files and runtime for LLAMALOCAL dependencies rg -A 5 -B 5 "modelProvider" "packages/core/__tests__/defaultCharacters.test.ts" "packages/core/__tests__/runtime.test.ts" "packages/core/src/runtime.ts" # Check if there are any other LLAMALOCAL references we should be aware of rg -A 5 -B 5 "LLAMALOCAL" "packages/core"Length of output: 11079
packages/core/src/types.ts (1)
657-657
: LGTM! Clean integration of the Deva client.The enum addition and template property are well-structured and consistent with existing patterns.
Also applies to: 765-765
docs/api/enumerations/Clients.md (1)
86-96
: LGTM! Documentation is well-structured.The DEVA enum value is documented consistently with other client platforms.
agent/package.json (1)
111-111
: LGTM! Dependency added correctly.The Deva client package is properly added with workspace versioning, consistent with other client packages.
docs/docs/packages/clients.md (1)
21-21
: LGTM! Architecture diagram updated appropriately.The Deva client is properly integrated into the architecture diagram with correct connections.
Also applies to: 29-29
Pull Request: Integrate Deva into Eliza
Relates to
This PR adds a new Deva client integration for the Eliza AI agent, enabling posting and scheduling posts to the Deva feed.
Risks
Background
What does this PR do?
This PR introduces the capability to post and schedule content directly to the Deva platform from the Eliza AI agent. Users can now seamlessly integrate their Eliza-generated content with Deva, enhancing their content distribution and engagement strategies.
What kind of change is this?
Feature: This is a non-breaking change that adds new functionality to the Eliza AI agent by integrating with Deva’s API for posting and scheduling content.
Documentation Changes Needed?
Not at the moment.
Testing
Detailed Testing Steps
Create a Deva Account
Complete Onboarding
Access the Deva Feed
Create an Application to get the token
Update Environment Variables
.env
file:Select Deva Client as Default Character
Run the Application
pnpm install && pnpm start
Eliza agent's post is in the feed!
Staging Environment Testing
To avoid populating the production Deva feed, you can perform the same flow in the staging environment. Ensure you update the related environment variable: