| import React from 'react' | import React from 'react' | ||||
| import DatasetUpdateForm from '@/app/components/datasets/create' | import DatasetUpdateForm from '@/app/components/datasets/create' | ||||
| type Props = {} | |||||
| const DatasetCreation = async (props: Props) => { | |||||
| const DatasetCreation = async () => { | |||||
| return ( | return ( | ||||
| <DatasetUpdateForm /> | <DatasetUpdateForm /> | ||||
| ) | ) |
| await clearAllAnnotations(appId) | await clearAllAnnotations(appId) | ||||
| onAdded() | onAdded() | ||||
| } | } | ||||
| catch (_) { | |||||
| catch (e) { | |||||
| console.error(`failed to clear all annotations, ${e}`) | |||||
| } | } | ||||
| finally { | finally { | ||||
| setShowClearConfirm(false) | setShowClearConfirm(false) |
| import type { AnswerNodeType } from './types' | import type { AnswerNodeType } from './types' | ||||
| export const checkNodeValid = (payload: AnswerNodeType) => { | |||||
| export const checkNodeValid = (_payload: AnswerNodeType) => { | |||||
| return true | return true | ||||
| } | } |
| import type { AssignerNodeType } from './types' | import type { AssignerNodeType } from './types' | ||||
| import { AssignerNodeInputType, WriteMode } from './types' | import { AssignerNodeInputType, WriteMode } from './types' | ||||
| export const checkNodeValid = (payload: AssignerNodeType) => { | |||||
| export const checkNodeValid = (_payload: AssignerNodeType) => { | |||||
| return true | return true | ||||
| } | } | ||||
| import type { EndNodeType } from './types' | import type { EndNodeType } from './types' | ||||
| export const checkNodeValid = (payload: EndNodeType) => { | |||||
| export const checkNodeValid = (_payload: EndNodeType) => { | |||||
| return true | return true | ||||
| } | } |
| onRemoveCondition?.(caseId, condition.id) | onRemoveCondition?.(caseId, condition.id) | ||||
| }, [caseId, condition, conditionId, isSubVariableKey, onRemoveCondition, onRemoveSubVariableCondition]) | }, [caseId, condition, conditionId, isSubVariableKey, onRemoveCondition, onRemoveSubVariableCondition]) | ||||
| const handleVarChange = useCallback((valueSelector: ValueSelector, varItem: Var) => { | |||||
| const handleVarChange = useCallback((valueSelector: ValueSelector, _varItem: Var) => { | |||||
| const resolvedVarType = getVarType({ | const resolvedVarType = getVarType({ | ||||
| valueSelector, | valueSelector, | ||||
| availableNodes, | availableNodes, |
| Toast.notify({ type: 'warning', message: `${t('common.modelProvider.parametersInvalidRemoved')}: ${keys.map(k => `${k} (${removedDetails[k]})`).join(', ')}` }) | Toast.notify({ type: 'warning', message: `${t('common.modelProvider.parametersInvalidRemoved')}: ${keys.map(k => `${k} (${removedDetails[k]})`).join(', ')}` }) | ||||
| handleCompletionParamsChange(filtered) | handleCompletionParamsChange(filtered) | ||||
| } | } | ||||
| catch (e) { | |||||
| catch { | |||||
| Toast.notify({ type: 'error', message: t('common.error') }) | Toast.notify({ type: 'error', message: t('common.error') }) | ||||
| handleCompletionParamsChange({}) | handleCompletionParamsChange({}) | ||||
| } | } |
| import produce from 'immer' | import produce from 'immer' | ||||
| import { z } from 'zod' | import { z } from 'zod' | ||||
| export const checkNodeValid = (payload: LLMNodeType) => { | |||||
| export const checkNodeValid = (_payload: LLMNodeType) => { | |||||
| return true | return true | ||||
| } | } | ||||
| export const validateSchemaAgainstDraft7 = (schemaToValidate: any) => { | export const validateSchemaAgainstDraft7 = (schemaToValidate: any) => { | ||||
| const schema = produce(schemaToValidate, (draft: any) => { | const schema = produce(schemaToValidate, (draft: any) => { | ||||
| // Make sure the schema has the $schema property for draft-07 | |||||
| // Make sure the schema has the $schema property for draft-07 | |||||
| if (!draft.$schema) | if (!draft.$schema) | ||||
| draft.$schema = 'http://json-schema.org/draft-07/schema#' | draft.$schema = 'http://json-schema.org/draft-07/schema#' | ||||
| }) | }) |
| import { v4 as uuid4 } from 'uuid' | import { v4 as uuid4 } from 'uuid' | ||||
| import { | import { | ||||
| useIsChatMode, | useIsChatMode, | ||||
| useIsNodeInLoop, | |||||
| useNodesReadOnly, | useNodesReadOnly, | ||||
| useWorkflow, | useWorkflow, | ||||
| } from '../../hooks' | } from '../../hooks' | ||||
| import useIsVarFileAttribute from './use-is-var-file-attribute' | import useIsVarFileAttribute from './use-is-var-file-attribute' | ||||
| import { useStore } from '@/app/components/workflow/store' | import { useStore } from '@/app/components/workflow/store' | ||||
| const DELIMITER = '@@@@@' | |||||
| const useConfig = (id: string, payload: LoopNodeType) => { | const useConfig = (id: string, payload: LoopNodeType) => { | ||||
| const { nodesReadOnly: readOnly } = useNodesReadOnly() | const { nodesReadOnly: readOnly } = useNodesReadOnly() | ||||
| const { isNodeInLoop } = useIsNodeInLoop(id) | |||||
| const isChatMode = useIsChatMode() | const isChatMode = useIsChatMode() | ||||
| const conversationVariables = useStore(s => s.conversationVariables) | const conversationVariables = useStore(s => s.conversationVariables) | ||||
| }, []) | }, []) | ||||
| // output | // output | ||||
| const { getLoopNodeChildren, getBeforeNodesInSameBranch } = useWorkflow() | |||||
| const beforeNodes = getBeforeNodesInSameBranch(id) | |||||
| const { getLoopNodeChildren } = useWorkflow() | |||||
| const loopChildrenNodes = [{ id, data: payload } as any, ...getLoopNodeChildren(id)] | const loopChildrenNodes = [{ id, data: payload } as any, ...getLoopNodeChildren(id)] | ||||
| const canChooseVarNodes = [...beforeNodes, ...loopChildrenNodes] | |||||
| const childrenNodeVars = toNodeOutputVars(loopChildrenNodes, isChatMode, undefined, [], conversationVariables) | const childrenNodeVars = toNodeOutputVars(loopChildrenNodes, isChatMode, undefined, [], conversationVariables) | ||||
| const { | const { |
| import type { StartNodeType } from './types' | import type { StartNodeType } from './types' | ||||
| export const checkNodeValid = (payload: StartNodeType) => { | |||||
| export const checkNodeValid = (_payload: StartNodeType) => { | |||||
| return true | return true | ||||
| } | } |
| import type { TemplateTransformNodeType } from './types' | import type { TemplateTransformNodeType } from './types' | ||||
| export const checkNodeValid = (payload: TemplateTransformNodeType) => { | |||||
| export const checkNodeValid = (_payload: TemplateTransformNodeType) => { | |||||
| return true | return true | ||||
| } | } |
| import type { ToolNodeType } from './types' | import type { ToolNodeType } from './types' | ||||
| export const checkNodeValid = (payload: ToolNodeType) => { | |||||
| export const checkNodeValid = (_payload: ToolNodeType) => { | |||||
| return true | return true | ||||
| } | } |
| export type InspectVarsSliceShape = InspectVarsState & InspectVarsActions | export type InspectVarsSliceShape = InspectVarsState & InspectVarsActions | ||||
| export const createInspectVarsSlice: StateCreator<InspectVarsSliceShape> = (set, get) => { | |||||
| export const createInspectVarsSlice: StateCreator<InspectVarsSliceShape> = (set) => { | |||||
| return ({ | return ({ | ||||
| currentFocusNodeId: null, | currentFocusNodeId: null, | ||||
| nodesWithInspectVars: [], | nodesWithInspectVars: [], | ||||
| if (!targetNode) | if (!targetNode) | ||||
| return | return | ||||
| const targetVar = targetNode.vars.find(varItem => varItem.id === varId) | const targetVar = targetNode.vars.find(varItem => varItem.id === varId) | ||||
| if(!targetVar) | |||||
| if (!targetVar) | |||||
| return | return | ||||
| targetVar.value = value | targetVar.value = value | ||||
| targetVar.edited = true | targetVar.edited = true | ||||
| }, | |||||
| }, | |||||
| ) | ) | ||||
| return { | return { | ||||
| nodesWithInspectVars: nodes, | nodesWithInspectVars: nodes, | ||||
| if (!targetNode) | if (!targetNode) | ||||
| return | return | ||||
| const targetVar = targetNode.vars.find(varItem => varItem.id === varId) | const targetVar = targetNode.vars.find(varItem => varItem.id === varId) | ||||
| if(!targetVar) | |||||
| if (!targetVar) | |||||
| return | return | ||||
| targetVar.value = value | targetVar.value = value | ||||
| targetVar.edited = false | targetVar.edited = false | ||||
| }, | |||||
| }, | |||||
| ) | ) | ||||
| return { | return { | ||||
| nodesWithInspectVars: nodes, | nodesWithInspectVars: nodes, | ||||
| if (!targetNode) | if (!targetNode) | ||||
| return | return | ||||
| const targetVar = targetNode.vars.find(varItem => varItem.id === varId) | const targetVar = targetNode.vars.find(varItem => varItem.id === varId) | ||||
| if(!targetVar) | |||||
| if (!targetVar) | |||||
| return | return | ||||
| targetVar.name = selector[1] | targetVar.name = selector[1] | ||||
| targetVar.selector = selector | targetVar.selector = selector | ||||
| }, | |||||
| }, | |||||
| ) | ) | ||||
| return { | return { | ||||
| nodesWithInspectVars: nodes, | nodesWithInspectVars: nodes, | ||||
| const needChangeVarIndex = targetNode.vars.findIndex(varItem => varItem.id === varId) | const needChangeVarIndex = targetNode.vars.findIndex(varItem => varItem.id === varId) | ||||
| if (needChangeVarIndex !== -1) | if (needChangeVarIndex !== -1) | ||||
| targetNode.vars.splice(needChangeVarIndex, 1) | targetNode.vars.splice(needChangeVarIndex, 1) | ||||
| }, | |||||
| }, | |||||
| ) | ) | ||||
| return { | return { | ||||
| nodesWithInspectVars: nodes, | nodesWithInspectVars: nodes, |
| '**/.next/', | '**/.next/', | ||||
| '**/public/*', | '**/public/*', | ||||
| '**/*.json', | '**/*.json', | ||||
| '**/*.js', | |||||
| ], | ], | ||||
| }, | }, | ||||
| { | { |