chore: use node specify llm to auto generate prompt (#6525)
This commit is contained in:
@@ -14,6 +14,7 @@ import PromptEditorHeightResizeWrap from './prompt-editor-height-resize-wrap'
|
||||
import cn from '@/utils/classnames'
|
||||
import { type PromptVariable } from '@/models/debug'
|
||||
import Tooltip from '@/app/components/base/tooltip'
|
||||
import type { CompletionParams } from '@/types/app'
|
||||
import { AppType } from '@/types/app'
|
||||
import { getNewVar, getVars } from '@/utils/var'
|
||||
import AutomaticBtn from '@/app/components/app/configuration/config/automatic/automatic-btn'
|
||||
@@ -58,6 +59,7 @@ const Prompt: FC<ISimplePromptInput> = ({
|
||||
const { eventEmitter } = useEventEmitterContextContext()
|
||||
const {
|
||||
modelConfig,
|
||||
completionParams,
|
||||
dataSets,
|
||||
setModelConfig,
|
||||
setPrevPromptConfig,
|
||||
@@ -247,6 +249,14 @@ const Prompt: FC<ISimplePromptInput> = ({
|
||||
{showAutomatic && (
|
||||
<GetAutomaticResModal
|
||||
mode={mode as AppType}
|
||||
model={
|
||||
{
|
||||
provider: modelConfig.provider,
|
||||
name: modelConfig.model_id,
|
||||
mode: modelConfig.mode,
|
||||
completion_params: completionParams as CompletionParams,
|
||||
}
|
||||
}
|
||||
isShow={showAutomatic}
|
||||
onClose={showAutomaticFalse}
|
||||
onFinished={handleAutomaticRes}
|
||||
|
||||
@@ -20,6 +20,7 @@ import Button from '@/app/components/base/button'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
import { generateRule } from '@/service/debug'
|
||||
import ConfigPrompt from '@/app/components/app/configuration/config-prompt'
|
||||
import type { Model } from '@/types/app'
|
||||
import { AppType } from '@/types/app'
|
||||
import ConfigVar from '@/app/components/app/configuration/config-var'
|
||||
import OpeningStatement from '@/app/components/app/configuration/features/chat-group/opening-statement'
|
||||
@@ -33,6 +34,7 @@ import { Generator } from '@/app/components/base/icons/src/vender/other'
|
||||
|
||||
export type IGetAutomaticResProps = {
|
||||
mode: AppType
|
||||
model: Model
|
||||
isShow: boolean
|
||||
onClose: () => void
|
||||
onFinished: (res: AutomaticRes) => void
|
||||
@@ -57,6 +59,7 @@ const TryLabel: FC<{
|
||||
|
||||
const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
|
||||
mode,
|
||||
model,
|
||||
isShow,
|
||||
onClose,
|
||||
isInLLMNode,
|
||||
@@ -149,10 +152,17 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
|
||||
return
|
||||
setLoadingTrue()
|
||||
try {
|
||||
const res = await generateRule({
|
||||
const { error, ...res } = await generateRule({
|
||||
instruction,
|
||||
model_config: model,
|
||||
})
|
||||
setRes(res)
|
||||
if (error) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: error,
|
||||
})
|
||||
}
|
||||
}
|
||||
finally {
|
||||
setLoadingFalse()
|
||||
|
||||
Reference in New Issue
Block a user