mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
chore: prompt change also clear useless tool id
This commit is contained in:
@ -132,8 +132,11 @@ const ConfigPrompt: FC<Props> = ({
|
||||
return (prompt: string) => {
|
||||
const newPrompt = produce(payload as PromptTemplateItem[], (draft) => {
|
||||
const item = draft[index]
|
||||
if (!isPromptMessageContext(item))
|
||||
if (!isPromptMessageContext(item)) {
|
||||
const nextMetadata = cleanupToolMetadata(prompt, item.metadata || {})
|
||||
item.metadata = nextMetadata
|
||||
item[item.edition_type === EditionType.jinja2 ? 'jinja2_text' : 'text'] = prompt
|
||||
}
|
||||
})
|
||||
onChange(newPrompt)
|
||||
}
|
||||
@ -249,6 +252,7 @@ const ConfigPrompt: FC<Props> = ({
|
||||
const handleCompletionPromptChange = useCallback((prompt: string) => {
|
||||
const newPrompt = produce(payload as PromptItem, (draft) => {
|
||||
draft[draft.edition_type === EditionType.jinja2 ? 'jinja2_text' : 'text'] = prompt
|
||||
draft.metadata = cleanupToolMetadata(prompt, draft.metadata || {})
|
||||
})
|
||||
onChange(newPrompt)
|
||||
}, [onChange, payload])
|
||||
|
||||
Reference in New Issue
Block a user