Merge remote-tracking branch 'origin/main' into feat/queue-based-graph-engine

This commit is contained in:
-LAN-
2025-09-03 01:33:17 +08:00
115 changed files with 5875 additions and 268 deletions

View File

@ -69,7 +69,6 @@ export default function AccountPage() {
}
catch (e) {
notify({ type: 'error', message: (e as Error).message })
setEditNameModalVisible(false)
setEditing(false)
}
}

View File

@ -43,6 +43,7 @@ const Filter: FC<IFilterProps> = ({ queryParams, setQueryParams }: IFilterProps)
{ value: 'succeeded', name: 'Success' },
{ value: 'failed', name: 'Fail' },
{ value: 'stopped', name: 'Stop' },
{ value: 'partial-succeeded', name: 'Partial Success' },
]}
/>
<Chip

View File

@ -103,12 +103,6 @@ const BaseField = ({
})
}, [values, show_on])
const booleanRadioValue = useMemo(() => {
if (value === null || value === undefined)
return undefined
return value ? 1 : 0
}, [value])
if (!show)
return null
@ -149,6 +143,7 @@ const BaseField = ({
onBlur={field.handleBlur}
disabled={disabled}
placeholder={memorizedPlaceholder}
autoComplete={'new-password'}
/>
)
}
@ -215,11 +210,11 @@ const BaseField = ({
formSchema.type === FormTypeEnum.boolean && (
<Radio.Group
className='flex w-fit items-center'
value={booleanRadioValue}
onChange={val => field.handleChange(val === 1)}
value={value}
onChange={v => field.handleChange(v)}
>
<Radio value={1} className='!mr-1'>True</Radio>
<Radio value={0}>False</Radio>
<Radio value={true} className='!mr-1'>True</Radio>
<Radio value={false}>False</Radio>
</Radio.Group>
)
}

View File

@ -5,7 +5,7 @@ import cn from '@/utils/classnames'
export type TRadioGroupProps = {
children?: ReactNode | ReactNode[]
value?: string | number
value?: string | number | boolean
className?: string
onChange?: (value: any) => void
}

View File

@ -10,7 +10,7 @@ export type IRadioProps = {
labelClassName?: string
children?: string | ReactNode
checked?: boolean
value?: string | number
value?: string | number | boolean
disabled?: boolean
onChange?: (e?: IRadioProps['value']) => void
}

View File

@ -36,7 +36,7 @@ export default function LocaleSigninSelect({
leaveTo="transform opacity-0 scale-95"
>
<MenuItems className="absolute right-0 z-10 mt-2 w-[200px] origin-top-right divide-y divide-divider-regular rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg focus:outline-none">
<div className="px-1 py-1 ">
<div className="max-h-96 overflow-y-auto px-1 py-1 [mask-image:linear-gradient(to_bottom,transparent_0px,black_8px,black_calc(100%-8px),transparent_100%)]">
{items.map((item) => {
return <MenuItem key={item.value}>
<button

View File

@ -65,7 +65,10 @@ export const useModelFormSchemas = (
}, [formSchemas, t])
const formValues = useMemo(() => {
let result = {}
let result: any = {}
formSchemas.forEach((schema) => {
result[schema.variable] = schema.default
})
if (credential) {
result = { ...result, __authorization_name__: credential?.credential_name }
if (credentials)
@ -74,7 +77,7 @@ export const useModelFormSchemas = (
if (model)
result = { ...result, __model_name: model?.model, __model_type: model?.model_type }
return result
}, [credentials, credential, model])
}, [credentials, credential, model, formSchemas])
return {
formSchemas: formSchemasWithAuthorizationName,

View File

@ -284,11 +284,11 @@ function Form<
</div>
<Radio.Group
className='flex items-center'
value={value[variable] === null ? undefined : (value[variable] ? 1 : 0)}
onChange={val => handleFormChange(variable, val === 1)}
value={value[variable]}
onChange={val => handleFormChange(variable, val)}
>
<Radio value={1} className='!mr-1'>True</Radio>
<Radio value={0}>False</Radio>
<Radio value={true} className='!mr-1'>True</Radio>
<Radio value={false}>False</Radio>
</Radio.Group>
</div>
{fieldMoreInfo?.(formSchema)}

View File

@ -2,6 +2,7 @@ import type { FC } from 'react'
import {
memo,
useCallback,
useEffect,
useMemo,
useRef,
} from 'react'
@ -188,6 +189,20 @@ const ModelModal: FC<ModelModalProps> = ({
return null
}, [model, provider])
useEffect(() => {
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === 'Escape') {
event.stopPropagation()
onCancel()
}
}
document.addEventListener('keydown', handleKeyDown, true)
return () => {
document.removeEventListener('keydown', handleKeyDown, true)
}
}, [onCancel])
return (
<PortalToFollowElem open>
<PortalToFollowElemContent className='z-[60] h-full w-full'>

View File

@ -91,8 +91,8 @@ const ParameterItem: FC<ParameterItemProps> = ({
numberInputRef.current!.value = `${num}`
}
const handleRadioChange = (v: number) => {
handleInputChange(v === 1)
const handleRadioChange = (v: boolean) => {
handleInputChange(v)
}
const handleStringInputChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
@ -187,11 +187,11 @@ const ParameterItem: FC<ParameterItemProps> = ({
return (
<Radio.Group
className='flex w-[178px] items-center'
value={renderValue ? 1 : 0}
value={renderValue as boolean}
onChange={handleRadioChange}
>
<Radio value={1} className='w-[83px]'>True</Radio>
<Radio value={0} className='w-[83px]'>False</Radio>
<Radio value={true} className='w-[83px]'>True</Radio>
<Radio value={false} className='w-[83px]'>False</Radio>
</Radio.Group>
)
}

View File

@ -111,7 +111,7 @@ const ConfigCredential: FC<Props> = ({
<Button onClick={onRemove}>{t('common.operation.remove')}</Button>
)
}
< div className='flex space-x-2'>
<div className='flex space-x-2'>
<Button onClick={onCancel}>{t('common.operation.cancel')}</Button>
<Button loading={isLoading || isSaving} disabled={isLoading || isSaving} variant='primary' onClick={handleSave}>{t('common.operation.save')}</Button>
</div>

View File

@ -346,7 +346,7 @@ export const useDSL = () => {
const appDetail = useAppStore(s => s.appDetail)
const handleExportDSL = useCallback(async (include = false) => {
const handleExportDSL = useCallback(async (include = false, workflowId?: string) => {
if (!appDetail)
return
@ -358,6 +358,7 @@ export const useDSL = () => {
await doSyncWorkflowDraft()
const { data } = await exportAppConfig({
appID: appDetail.id,
workflowID: workflowId,
include,
})
const a = document.createElement('a')

View File

@ -140,7 +140,7 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
<ConfigPrompt
readOnly={readOnly}
nodeId={id}
filterVar={filterInputVar}
filterVar={isShowVars ? filterJinja2InputVar : filterInputVar}
isChatModel={isChatModel}
isChatApp={isChatMode}
isShowContext

View File

@ -308,7 +308,7 @@ const useConfig = (id: string, payload: LLMNodeType) => {
}, [])
const filterJinja2InputVar = useCallback((varPayload: Var) => {
return [VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber].includes(varPayload.type)
return [VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber, VarType.arrayBoolean, VarType.arrayObject, VarType.object, VarType.array, VarType.boolean].includes(varPayload.type)
}, [])
const filterMemoryPromptVar = useCallback((varPayload: Var) => {

View File

@ -29,6 +29,10 @@ const useContextMenu = (props: ContextMenuProps) => {
key: VersionHistoryContextMenuOptions.edit,
name: t('workflow.versionHistory.nameThisVersion'),
},
{
key: VersionHistoryContextMenuOptions.exportDSL,
name: t('app.export'),
},
{
key: VersionHistoryContextMenuOptions.copyId,
name: t('workflow.versionHistory.copyId'),

View File

@ -3,7 +3,7 @@ import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { RiArrowDownDoubleLine, RiCloseLine, RiLoader2Line } from '@remixicon/react'
import copy from 'copy-to-clipboard'
import { useNodesSyncDraft, useWorkflowRun } from '../../hooks'
import { useDSL, useNodesSyncDraft, useWorkflowRun } from '../../hooks'
import { useStore, useWorkflowStore } from '../../store'
import { VersionHistoryContextMenuOptions, WorkflowVersionFilterOptions } from '../../types'
import VersionHistoryItem from './version-history-item'
@ -33,6 +33,7 @@ const VersionHistoryPanel = () => {
const workflowStore = useWorkflowStore()
const { handleSyncWorkflowDraft } = useNodesSyncDraft()
const { handleRestoreFromPublishedWorkflow, handleLoadBackupDraft } = useWorkflowRun()
const { handleExportDSL } = useDSL()
const appDetail = useAppStore.getState().appDetail
const setShowWorkflowVersionHistoryPanel = useStore(s => s.setShowWorkflowVersionHistoryPanel)
const currentVersion = useStore(s => s.currentVersion)
@ -107,8 +108,11 @@ const VersionHistoryPanel = () => {
message: t('workflow.versionHistory.action.copyIdSuccess'),
})
break
case VersionHistoryContextMenuOptions.exportDSL:
handleExportDSL(false, item.id)
break
}
}, [t])
}, [t, handleExportDSL])
const handleCancel = useCallback((operation: VersionHistoryContextMenuOptions) => {
switch (operation) {

View File

@ -451,6 +451,7 @@ export enum VersionHistoryContextMenuOptions {
restore = 'restore',
edit = 'edit',
delete = 'delete',
exportDSL = 'exportDSL',
copyId = 'copyId',
}