Skip to content

“Truncate from End” variable option in Prompt Template has no effect #150

@utd-trev

Description

@utd-trev

[Bug] “Truncate from End” variable option in Prompt Template has no effect

Description

When configuring Prompt Template variables, the Truncate from End option does not apply at runtime. The plain Truncate option works as expected, but Truncate from End leaves the text unchanged.

Both positive (e.g., 5) and negative (e.g., -5) inputs fail. Additionally, the variable editor UI does not allow users to directly type a minus sign, even though the default value is preset as -1.

Steps to Reproduce

  1. Open the right-side panel and click + Prompt Template.
  2. (Optional) Name: Truncate and Truncate From End test prompt template
    Description: When prompted, the user inputs 'hello12345' for each variable. The expected output for Truncate is 'hello' and the expected output for Truncate From End is '12345'.
  3. Leave Custom Instructions as default.
  4. In the Prompt box, enter:
    {{truncate}}
    {{truncateFromEnd}}
    {{truncateFromEndNegative}}
  5. In Variables:
  • For truncate: enable Truncate and set to 5.
    → Token becomes: {{truncate:text(truncate:5)}}
  • For truncateFromEnd: enable Truncate from End and set to 5.
    → Token becomes: {{truncateFromEnd:text(truncateFromEnd:5)}}
  • For truncateFromEndNegative: enable Truncate from End and attempt to set to -5.
    • Note: the input box does not allow typing a minus sign (both the digit and minus are deleted when backspacing).
    • Workaround: manually edit the Prompt box token to: {{truncateFromEndNegative:text(truncateFromEnd:-5)}}.
  1. Save the template.
  2. Run the template; when prompted, input hello12345 for each variable.

Expected Behavior

The user’s first message (echo of filled variables) should be:
hello
12345
12345

  • truncate → returns the first 5 chars (hello).
  • truncateFromEnd → returns the last 5 chars (12345).
  • truncateFromEndNegative → also returns the last 5 chars (12345).

Actual Behavior

The user’s first message is:
hello
hello12345
hello12345

  • truncate works as expected.
  • Both Truncate from End cases (positive and negative) are ignored at runtime.

Reproducibility

  • Reproduces consistently with all models tested (default was Claude 3 Haiku; also tested with other available models).
  • Occurs across both Mac and PC environments, with multiple browsers.

Environment

  • OS: macOS, Windows 11
  • Browsers: Brave, Chrome, Firefox

Workarounds

None found.

Impact / Priority

Low priority (feature inconsistency), but it blocks use-cases that need end-truncation for safe prompt assembly or token budgeting.

Attachments

  • Screenshots of the Prompt Template configuration and variable settings (see attached).
Image Image Image Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions