Skip to content
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 support for handlebars templating engine as an option #1136

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

erise133
Copy link

@erise133 erise133 commented Dec 16, 2024

Relates to:

Added support for the Handlebars templating engine in the composeContext function, allowing for advanced template processing in addition to the existing simple string replacement.

Risks

  • Existing functionality for simple string replacement remains unchanged.
  • Handlebars is an optional addition and is only used when specified, minimizing potential impact on existing use cases.

Background

What does this PR do?

This PR enhances the composeContext function by integrating Handlebars as an optional templating engine. Users can now choose between simple key replacement or advanced template features provided by Handlebars, such as conditionals and loops.

What kind of change is this?

  • Feature: Adds a new functionality to support Handlebars templating engine.

Documentation changes needed?

  • Yes: Update documentation to include examples of using the Handlebars templating engine with composeContext.

Testing

Where should a reviewer start?

  • Review the changes in context.ts and the newly added tests in context.test.ts.

Detailed testing steps

  • Run the tests in context.test.ts to verify both the simple string replacement and Handlebars functionality.
  • Ensure all scenarios, including edge cases like missing values and advanced Handlebars templates, are covered by tests.

Discord username

kaboom89

@erise133 erise133 changed the base branch from main to develop December 16, 2024 16:59
Copy link
Collaborator

@monilpat monilpat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for doing this :)

packages/core/src/context.ts Show resolved Hide resolved
packages/core/src/tests/context.test.ts Show resolved Hide resolved
Copy link

@chrislatorres chrislatorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I agree with @monilpat on the long comment being moved somewhere else.

@monilpat monilpat merged commit 9348c97 into elizaOS:develop Dec 16, 2024
3 of 4 checks passed
@erise133
Copy link
Author

@chrislatorres @monilpat I forgot to uncomment Discord username part in the description. Would be nice to get the dev role in discord. Thanks

@chrislatorres
Copy link

@erise133

you should be able to get a coder role from the #⁠roles channel in Discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants