mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:58:04 +08:00
feat: add llm debug
This commit is contained in:
@ -2,6 +2,7 @@ import { useState } from 'react'
|
||||
import { useWorkflow } from '@/app/components/workflow/hooks'
|
||||
import type { CommonNodeType, InputVar, Variable } from '@/app/components/workflow/types'
|
||||
import { InputVarType } from '@/app/components/workflow/types'
|
||||
import { RETRIEVAL_OUTPUT_STRUCT } from '@/app/components/workflow/constants'
|
||||
|
||||
type Params<T> = {
|
||||
id: string
|
||||
@ -23,17 +24,28 @@ const useOneStepRun = <T>({ id, data }: Params<T>) => {
|
||||
|
||||
const [runningStatus, setRunningStatus] = useState('un started')
|
||||
|
||||
// TODO: test
|
||||
const [inputVarValues, setInputVarValues] = useState<Record<string, any>>({
|
||||
name: 'Joel',
|
||||
age: '18',
|
||||
})
|
||||
|
||||
const [visionFiles, setVisionFiles] = useState<any[]>([])
|
||||
|
||||
const [contexts, setContexts] = useState<string[]>([RETRIEVAL_OUTPUT_STRUCT])
|
||||
|
||||
const toVarInputs = (variables: Variable[]): InputVar[] => {
|
||||
if (!variables)
|
||||
return []
|
||||
|
||||
const varInputs = variables.map((item) => {
|
||||
const varInputs = variables.map((item, i) => {
|
||||
const allVarTypes = [InputVarType.textInput, InputVarType.paragraph, InputVarType.number, InputVarType.select, InputVarType.files]
|
||||
return {
|
||||
label: item.variable,
|
||||
variable: item.variable,
|
||||
type: InputVarType.textInput, // TODO: dynamic get var type
|
||||
type: allVarTypes[i % allVarTypes.length], // TODO: dynamic get var type
|
||||
required: true, // TODO
|
||||
options: [], // TODO
|
||||
options: ['a', 'b', 'c'], // TODO
|
||||
}
|
||||
})
|
||||
|
||||
@ -46,6 +58,12 @@ const useOneStepRun = <T>({ id, data }: Params<T>) => {
|
||||
toVarInputs,
|
||||
runningStatus,
|
||||
setRunningStatus,
|
||||
inputVarValues,
|
||||
setInputVarValues,
|
||||
visionFiles,
|
||||
setVisionFiles,
|
||||
contexts,
|
||||
setContexts,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user