mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 06:05:51 +08:00
fix: prompt and preview not show html like tag (#201)
This commit is contained in:
parent
93e99fb343
commit
1d06eba61a
@ -58,6 +58,8 @@ const OpeningStatement: FC<IOpeningStatementProps> = ({
|
|||||||
const coloredContent = (tempValue || '')
|
const coloredContent = (tempValue || '')
|
||||||
.replace(regex, varHighlightHTML({ name: '$1' })) // `<span class="${highLightClassName}">{{$1}}</span>`
|
.replace(regex, varHighlightHTML({ name: '$1' })) // `<span class="${highLightClassName}">{{$1}}</span>`
|
||||||
.replace(/\n/g, '<br />')
|
.replace(/\n/g, '<br />')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
|
||||||
|
|
||||||
const handleEdit = () => {
|
const handleEdit = () => {
|
||||||
|
@ -75,7 +75,7 @@ const PromptValuePanel: FC<IPromptValuePanelProps> = ({
|
|||||||
<div
|
<div
|
||||||
className="max-h-48 overflow-y-auto text-sm text-gray-700 break-all"
|
className="max-h-48 overflow-y-auto text-sm text-gray-700 break-all"
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: format(replaceStringWithValuesWithFormat(promptTemplate, promptVariables, inputs)),
|
__html: format(replaceStringWithValuesWithFormat(promptTemplate.replace(/</g, '<').replace(/>/g, '>'), promptVariables, inputs)),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
@ -70,6 +70,8 @@ const BlockInput: FC<IBlockInputProps> = ({
|
|||||||
const coloredContent = (currentValue || '')
|
const coloredContent = (currentValue || '')
|
||||||
.replace(regex, varHighlightHTML({ name: '$1' })) // `<span class="${highLightClassName}">{{$1}}</span>`
|
.replace(regex, varHighlightHTML({ name: '$1' })) // `<span class="${highLightClassName}">{{$1}}</span>`
|
||||||
.replace(/\n/g, '<br />')
|
.replace(/\n/g, '<br />')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
|
||||||
// Not use useCallback. That will cause out callback get old data.
|
// Not use useCallback. That will cause out callback get old data.
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user