Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
af1d8470
Commit
af1d8470
authored
May 04, 2024
by
Timothy J. Baek
Browse files
fix: disable template variables in prompt
parent
3a2f1d56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
src/lib/utils/index.ts
src/lib/utils/index.ts
+2
-0
No files found.
src/lib/utils/index.ts
View file @
af1d8470
...
@@ -473,6 +473,8 @@ export const blobToFile = (blob, fileName) => {
...
@@ -473,6 +473,8 @@ export const blobToFile = (blob, fileName) => {
};
};
export
const
promptTemplate
=
(
template
:
string
,
prompt
:
string
)
=>
{
export
const
promptTemplate
=
(
template
:
string
,
prompt
:
string
)
=>
{
prompt
=
prompt
.
replace
(
/{{prompt}}|{{prompt:start:
\d
+}}|{{prompt:end:
\d
+}}/g
,
''
);
template
=
template
.
replace
(
/{{prompt}}/g
,
prompt
);
template
=
template
.
replace
(
/{{prompt}}/g
,
prompt
);
// Replace all instances of {{prompt:start:<length>}} with the first <length> characters of the prompt
// Replace all instances of {{prompt:start:<length>}} with the first <length> characters of the prompt
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment