mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 19:08:58 +08:00
fix: add message caused problem after simple chat convert to workflow (#3511)
This commit is contained in:
parent
570a5c72a9
commit
443fee8537
@ -67,6 +67,11 @@ const ConfigPrompt: FC<Props> = ({
|
|||||||
|
|
||||||
const handleAddPrompt = useCallback(() => {
|
const handleAddPrompt = useCallback(() => {
|
||||||
const newPrompt = produce(payload as PromptItem[], (draft) => {
|
const newPrompt = produce(payload as PromptItem[], (draft) => {
|
||||||
|
if (draft.length === 0) {
|
||||||
|
draft.push({ role: PromptRole.system, text: '' })
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
const isLastItemUser = draft[draft.length - 1].role === PromptRole.user
|
const isLastItemUser = draft[draft.length - 1].role === PromptRole.user
|
||||||
draft.push({ role: isLastItemUser ? PromptRole.assistant : PromptRole.user, text: '' })
|
draft.push({ role: isLastItemUser ? PromptRole.assistant : PromptRole.user, text: '' })
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user