Skip to content

Conversation

@kamal
Copy link
Contributor

@kamal kamal commented Aug 17, 2025

Describe Your Changes

Adds the ability to insert the current date into the assistant prompt via a {{current_date}} template variable.

Without this ability, Jan-v1-4B-Q4_K_M thinks today is October 5, 2023.

Fixes Issues

  • Closes #
  • Closes #

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

Important

Adds support for {{current_date}} template variable in assistant prompts, updates useChat and formatDate, and includes tests and localization updates.

  • Behavior:
    • Adds {{current_date}} template variable support in renderInstructions() in instructionTemplate.ts to insert the current date.
    • Updates useChat in useChat.ts to use renderInstructions() for processing assistant instructions.
  • Utilities:
    • Modifies formatDate() in formatDate.ts to support date-only formatting with includeTime option.
  • Tests:
    • Adds tests for renderInstructions() in instructionTemplate.test.ts to verify date replacement.
    • Adds tests for formatDate() in formatDate.test.ts to verify date-only formatting.
    • Adds useChat.instructions.test.ts to test instruction rendering with date replacement.
  • Localization:
    • Updates assistants.json in multiple locales to include instructionsDateHint for using {{current_date}}.

This description was created by Ellipsis for 63d99f7. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 63d99f7 in 1 minute and 49 seconds. Click for details.
  • Reviewed 396 lines of code in 13 files
  • Skipped 0 files when reviewing.
  • Skipped posting 11 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. web-app/src/containers/dialogs/AddEditAssistant.tsx:321
  • Draft comment:
    Good addition of the instructions hint. For accessibility, consider linking this hint to the textarea via an aria-describedby attribute.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. web-app/src/hooks/__tests__/useChat.instructions.test.ts:119
  • Draft comment:
    The test for replacing {{current_date}} using fake timers is comprehensive. Consider adding an extra case where no placeholder exists to ensure idempotency.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The test file is new and focused specifically on the placeholder replacement feature. The suggested additional test seems like a reasonable edge case to test, but it's not critical since the main functionality (placeholder replacement) is already well tested. The comment is making a suggestion for improvement rather than pointing out a bug or issue. The comment might be overengineering - if there's no placeholder, there's nothing to replace, so it may not be worth testing. Also, we don't know if handling instructions without placeholders is even an important use case. While the suggested test might be nice to have, it's not critical enough to warrant a comment. The core functionality is already well tested. The comment should be removed as it suggests a nice-to-have but non-essential test case, and we want to keep PR comments focused on more important issues.
3. web-app/src/hooks/useChat.ts:249
  • Draft comment:
    Nice integration of renderInstructions to process the assistant's instructions. Since renderInstructions handles undefined inputs, this usage is safe.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it praises the integration and reassures that the usage is safe. It doesn't provide any actionable feedback or suggestions for improvement.
4. web-app/src/lib/instructionTemplate.ts:20
  • Draft comment:
    The renderInstructions function cleanly replaces all occurrences of {{current_date}}. Optionally, consider renaming the variable 'rendered' to something like 'processedInstructions' for clearer intent.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
5. web-app/src/locales/en/assistants.json:33
  • Draft comment:
    New key 'instructionsDateHint' added with appropriate guidance. Ensure that the placeholder syntax {{current_date}} is maintained consistently across all locale files.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to ensure consistency in placeholder syntax across locale files. This falls under the category of asking the author to double-check or ensure something, which is against the rules. Therefore, this comment should be removed.
6. web-app/src/locales/de-DE/assistants.json:33
  • Draft comment:
    The German translation for 'instructionsDateHint' looks consistent. Verify that users understand the placeholder usage.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify user understanding, which is not specific enough and violates the rule against asking for confirmation or verification of intention. It doesn't provide a specific suggestion or point out a clear issue with the code.
7. web-app/src/locales/id/assistants.json:33
  • Draft comment:
    The Indonesian translation for 'instructionsDateHint' is correctly added. Consistency across locales is maintained.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, stating that the Indonesian translation is correct and consistent. It doesn't provide any actionable feedback or suggestions for improvement.
8. web-app/src/locales/vn/assistants.json:33
  • Draft comment:
    The Vietnamese translation for 'instructionsDateHint' is added properly. The placeholder syntax remains intact.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, stating that the translation is added properly and the syntax remains intact. It does not provide any actionable feedback or suggestions for improvement.
9. web-app/src/locales/zh-CN/assistants.json:33
  • Draft comment:
    The Simplified Chinese translation for 'instructionsDateHint' is correctly added. Ensure consistency with other locale files.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and asks the PR author to ensure consistency, which is against the rules. It doesn't provide a specific suggestion or point out a specific issue.
10. web-app/src/locales/zh-TW/assistants.json:33
  • Draft comment:
    The Traditional Chinese translation for 'instructionsDateHint' has been added and is consistent with other locales.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it only states that a translation has been added and is consistent with other locales. It does not provide any actionable feedback or suggestions for improvement.
11. web-app/src/utils/formatDate.ts:29
  • Draft comment:
    The new includeTime flag is implemented correctly. In date-only mode, consider if specifying a timeZone is necessary for consistency, though the current behavior seems intended.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment starts with a purely informative statement about the implementation being correct, which is not allowed. The second part suggests considering the necessity of specifying a timeZone, but it does not make a specific suggestion or point out a potential issue. It also assumes the current behavior is intended, which is against the rules.

Workflow ID: wflow_YlDAyjYE0fUqVIIk

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@kamal kamal force-pushed the current-date-instruction branch from 63d99f7 to b77c893 Compare August 17, 2025 07:24
@louis-jan
Copy link
Contributor

Thanks for the contribution. We've been waiting for this update for a while. 💯

Copy link
Contributor

@louis-jan louis-jan left a comment

Choose a reason for hiding this comment

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

LGTM

@louis-jan louis-jan requested a review from LazyYuuki August 19, 2025 16:43
@louis-jan louis-jan self-assigned this Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: QA

Development

Successfully merging this pull request may close these issues.

3 participants