mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[PR #2161] [MERGED] feat: add {{prompt:middletruncate:<length>}} to title gen #7711
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/2161
Author: @cheahjs
Created: 5/10/2024
Status: ✅ Merged
Merged: 5/14/2024
Merged by: @tjbck
Base:
dev← Head:fix/handlebars-harden📝 Commits (3)
34a6d55feat: add {{prompt:middletruncate:}} to title gena789b78feat: add unit tests for prompt templates564a3a2Merge branch 'dev' into fix/handlebars-harden📊 Changes
6 files changed (+1128 additions, -25 deletions)
View changed files
📝
.github/workflows/format-build-frontend.yaml(+18 -0)📝
package-lock.json(+1006 -6)📝
package.json(+4 -2)📝
src/lib/constants.ts(+2 -2)➕
src/lib/utils/index.test.ts(+66 -0)📝
src/lib/utils/index.ts(+32 -15)📄 Description
Pull Request Checklist
devbranch.Description
Adds a
{{prompt:middletruncate:<length>}}placeholder for title generation to better address issues with overlapping prompts when using{{prompt:start:<length>}}with{{prompt:end:<length>}}. This also hardens the replacement logic, with all the replacements being done in one pass so it doesn't suffer from issues with placeholders containing placeholders.As a side thing, add
vitestand a GitHub Action workflow to run frontend unit tests, it's just tests forpromptTemplatefor now, but it will be available if anyone else wants to write unit tests.Changelog Entry
Added
{{prompt:middletruncate:<length>}}placeholder allows for truncating prompts with an ellipsis in the middle, improving title generation.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.