|
|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
'use client'
|
|
|
|
|
import type { FC } from 'react'
|
|
|
|
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
|
|
|
import { uniqueId } from 'lodash-es'
|
|
|
|
|
import React, { useCallback } from 'react'
|
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
import type { ModelConfig, PromptItem, Variable } from '../../../types'
|
|
|
|
|
import { EditionType } from '../../../types'
|
|
|
|
|
@ -14,6 +13,7 @@ import { PromptRole } from '@/models/debug'
|
|
|
|
|
const i18nPrefix = 'workflow.nodes.llm'
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
instanceId: string
|
|
|
|
|
className?: string
|
|
|
|
|
headerClassName?: string
|
|
|
|
|
canNotChooseSystemRole?: boolean
|
|
|
|
|
@ -59,6 +59,7 @@ const roleOptions = [
|
|
|
|
|
const roleOptionsWithoutSystemRole = roleOptions.filter(item => item.value !== PromptRole.system)
|
|
|
|
|
|
|
|
|
|
const ConfigPromptItem: FC<Props> = ({
|
|
|
|
|
instanceId,
|
|
|
|
|
className,
|
|
|
|
|
headerClassName,
|
|
|
|
|
canNotChooseSystemRole,
|
|
|
|
|
@ -86,10 +87,6 @@ const ConfigPromptItem: FC<Props> = ({
|
|
|
|
|
const {
|
|
|
|
|
setControlPromptEditorRerenderKey,
|
|
|
|
|
} = workflowStore.getState()
|
|
|
|
|
const [instanceId, setInstanceId] = useState(uniqueId())
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setInstanceId(`${id}-${uniqueId()}`)
|
|
|
|
|
}, [id])
|
|
|
|
|
|
|
|
|
|
const handleGenerated = useCallback((prompt: string) => {
|
|
|
|
|
onPromptChange(prompt)
|
|
|
|
|
|