mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 15:08:06 +08:00
refactor: type variable inspect handlers
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-Claude) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@ -25,7 +25,7 @@ type Props = {
|
||||
currentVar?: currentVarType
|
||||
varType: VarInInspectType
|
||||
varList: VarInInspect[]
|
||||
handleSelect: (state: any) => void
|
||||
handleSelect: (state: currentVarType) => void
|
||||
handleView?: () => void
|
||||
handleClear?: () => void
|
||||
}
|
||||
@ -50,7 +50,7 @@ const Group = ({
|
||||
|
||||
const visibleVarList = isEnv ? varList : varList.filter(v => v.visible)
|
||||
|
||||
const handleSelectVar = (varItem: any, type?: string) => {
|
||||
const handleSelectVar = (varItem: VarInInspect, type?: VarInInspectType) => {
|
||||
if (type === VarInInspectType.environment) {
|
||||
handleSelect({
|
||||
nodeId: VarInInspectType.environment,
|
||||
|
||||
@ -12,7 +12,7 @@ import Group from './group'
|
||||
|
||||
type Props = {
|
||||
currentNodeVar?: currentVarType
|
||||
handleVarSelect: (state: any) => void
|
||||
handleVarSelect: (state: currentVarType) => void
|
||||
}
|
||||
|
||||
const Left = ({
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import type { FC } from 'react'
|
||||
import type { SplitRightProps } from './split-panel'
|
||||
import type { VarInspectValue } from './types'
|
||||
import type { currentVarType } from './variables-tab'
|
||||
import type { GenRes } from '@/service/debug'
|
||||
import {
|
||||
@ -68,7 +69,7 @@ const Right: FC<Props> = ({
|
||||
editInspectVarValue,
|
||||
} = useCurrentVars()
|
||||
|
||||
const handleValueChange = (varId: string, value: any) => {
|
||||
const handleValueChange = (varId: string, value: VarInspectValue) => {
|
||||
if (!currentNodeVar || !currentVar)
|
||||
return
|
||||
editInspectVarValue(currentNodeVar.nodeId, varId, value)
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
import type { FileEntity } from '@/app/components/base/file-uploader/types'
|
||||
import type { PromptTemplateItem } from '@/app/components/workflow/types'
|
||||
import type { FileResponse } from '@/types/workflow'
|
||||
|
||||
export const EVENT_WORKFLOW_STOP = 'WORKFLOW_STOP'
|
||||
|
||||
export const CHUNK_SCHEMA_TYPES = ['general_structure', 'parent_child_structure', 'qa_structure']
|
||||
@ -16,3 +20,16 @@ export enum InspectTab {
|
||||
Variables = 'variables',
|
||||
Artifacts = 'artifacts',
|
||||
}
|
||||
|
||||
export type VarInspectValue
|
||||
= string
|
||||
| number
|
||||
| boolean
|
||||
| null
|
||||
| Record<string, unknown>
|
||||
| Array<string | number | boolean | null | Record<string, unknown>>
|
||||
| FileEntity
|
||||
| FileEntity[]
|
||||
| FileResponse
|
||||
| FileResponse[]
|
||||
| PromptTemplateItem[]
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import type { VarInspectValue } from './types'
|
||||
import type { VarInInspect } from '@/types/workflow'
|
||||
import { useDebounceFn } from 'ahooks'
|
||||
import * as React from 'react'
|
||||
@ -30,7 +31,7 @@ import { CHUNK_SCHEMA_TYPES, PreviewType } from './types'
|
||||
|
||||
type Props = {
|
||||
currentVar: VarInInspect
|
||||
handleValueChange: (varId: string, value: any) => void
|
||||
handleValueChange: (varId: string, value: VarInspectValue) => void
|
||||
isTruncated: boolean
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user