-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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: add agent server opitons with middleware settings #3648
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 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 (
|
@wtfsayo is working on something in this part of the stack and can review it |
lgtm |
Many developers may want to much control the agent server. And the middlreware in express can be sollution. It helps inject developer custom code to the agent server.
Use cases:
If developer want user's logined wallet address for acl control, it can parse the address from the header then add the control logic in his own middleware code.
PR Summary (Generated)
This PR introduces middleware support to the AgentServer, enhancing its flexibility and customization.
Summary of changes:
Added Middleware Support:
ServerMiddleware
interface to define the structure for custom middleware functions.ServerOptions
interface to allow passing an array of middleware functions duringAgentServer
initialization.AgentServer
constructor to acceptServerOptions
and integrate provided middleware into the Express application usingapp.use()
.Benefits of Middleware:
AgentServer
code.Example Usage:
Minor Refactor:
/media/uploads
and/media/generated
for better organization.Removed Endpoints:
/image
,/fine-tune
, and/speak
endpoints from theAgentServer
class. These endpoints may be relocated to other modules or are no longer part of the core server functionality in this PR.This PR significantly improves the
AgentServer
by making it more adaptable and extensible through the introduction of middleware support. This allows for a more flexible and powerful agent server architecture.