mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
CI: add TS indentation check via esLint (#24810)
This commit is contained in:
4
.github/workflows/style.yml
vendored
4
.github/workflows/style.yml
vendored
@ -89,7 +89,9 @@ jobs:
|
|||||||
- name: Web style check
|
- name: Web style check
|
||||||
if: steps.changed-files.outputs.any_changed == 'true'
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
working-directory: ./web
|
working-directory: ./web
|
||||||
run: pnpm run lint
|
run: |
|
||||||
|
pnpm run lint
|
||||||
|
pnpm run eslint
|
||||||
|
|
||||||
docker-compose-template:
|
docker-compose-template:
|
||||||
name: Docker Compose Template
|
name: Docker Compose Template
|
||||||
|
|||||||
@ -621,7 +621,7 @@ export default translation
|
|||||||
&& !trimmed.startsWith('//'))
|
&& !trimmed.startsWith('//'))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ describe('Description Validation Logic', () => {
|
|||||||
try {
|
try {
|
||||||
validateDescriptionLength(invalidDescription)
|
validateDescriptionLength(invalidDescription)
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
expect((error as Error).message).toBe(expectedErrorMessage)
|
expect((error as Error).message).toBe(expectedErrorMessage)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -86,7 +86,7 @@ describe('Description Validation Logic', () => {
|
|||||||
expect(() => validateDescriptionLength(testDescription)).not.toThrow()
|
expect(() => validateDescriptionLength(testDescription)).not.toThrow()
|
||||||
expect(validateDescriptionLength(testDescription)).toBe(testDescription)
|
expect(validateDescriptionLength(testDescription)).toBe(testDescription)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
expect(() => validateDescriptionLength(testDescription)).toThrow(
|
expect(() => validateDescriptionLength(testDescription)).toThrow(
|
||||||
'Description cannot exceed 400 characters.',
|
'Description cannot exceed 400 characters.',
|
||||||
)
|
)
|
||||||
|
|||||||
@ -39,7 +39,7 @@ describe('Document List Sorting', () => {
|
|||||||
const result = aValue.localeCompare(bValue)
|
const result = aValue.localeCompare(bValue)
|
||||||
return order === 'asc' ? result : -result
|
return order === 'asc' ? result : -result
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const result = aValue - bValue
|
const result = aValue - bValue
|
||||||
return order === 'asc' ? result : -result
|
return order === 'asc' ? result : -result
|
||||||
}
|
}
|
||||||
|
|||||||
@ -196,7 +196,7 @@ describe('Plugin Tool Workflow Integration', () => {
|
|||||||
const _pluginId = (tool.uniqueIdentifier as any).split(':')[0]
|
const _pluginId = (tool.uniqueIdentifier as any).split(':')[0]
|
||||||
}).toThrow()
|
}).toThrow()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Valid tools should work fine
|
// Valid tools should work fine
|
||||||
expect(() => {
|
expect(() => {
|
||||||
const _pluginId = tool.uniqueIdentifier.split(':')[0]
|
const _pluginId = tool.uniqueIdentifier.split(':')[0]
|
||||||
|
|||||||
@ -252,7 +252,7 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {
|
|||||||
|
|
||||||
if (hasStyleChange)
|
if (hasStyleChange)
|
||||||
console.log('⚠️ Style changes detected - this causes visible flicker')
|
console.log('⚠️ Style changes detected - this causes visible flicker')
|
||||||
else
|
else
|
||||||
console.log('✅ No style changes detected')
|
console.log('✅ No style changes detected')
|
||||||
|
|
||||||
expect(timingData.length).toBeGreaterThan(1)
|
expect(timingData.length).toBeGreaterThan(1)
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const originalEnv = process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT
|
|||||||
function setupEnvironment(value?: string) {
|
function setupEnvironment(value?: string) {
|
||||||
if (value)
|
if (value)
|
||||||
process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT = value
|
process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT = value
|
||||||
else
|
else
|
||||||
delete process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT
|
delete process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT
|
||||||
|
|
||||||
// Clear module cache to force re-evaluation
|
// Clear module cache to force re-evaluation
|
||||||
@ -25,7 +25,7 @@ function setupEnvironment(value?: string) {
|
|||||||
function restoreEnvironment() {
|
function restoreEnvironment() {
|
||||||
if (originalEnv)
|
if (originalEnv)
|
||||||
process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT = originalEnv
|
process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT = originalEnv
|
||||||
else
|
else
|
||||||
delete process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT
|
delete process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT
|
||||||
|
|
||||||
jest.resetModules()
|
jest.resetModules()
|
||||||
|
|||||||
@ -47,7 +47,7 @@ describe('SVG Attribute Error Reproduction', () => {
|
|||||||
console.log(` ${index + 1}. ${error.substring(0, 100)}...`)
|
console.log(` ${index + 1}. ${error.substring(0, 100)}...`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('No inkscape errors found in this render')
|
console.log('No inkscape errors found in this render')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ describe('SVG Attribute Error Reproduction', () => {
|
|||||||
|
|
||||||
if (problematicKeys.length > 0)
|
if (problematicKeys.length > 0)
|
||||||
console.log(`🚨 PROBLEM: Still found problematic attributes: ${problematicKeys.join(', ')}`)
|
console.log(`🚨 PROBLEM: Still found problematic attributes: ${problematicKeys.join(', ')}`)
|
||||||
else
|
else
|
||||||
console.log('✅ No problematic attributes found after normalization')
|
console.log('✅ No problematic attributes found after normalization')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -106,7 +106,7 @@ const AvatarWithEdit = ({ onSave, ...props }: AvatarWithEditProps) => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (hoverArea === 'right' && !onAvatarError)
|
if (hoverArea === 'right' && !onAvatarError)
|
||||||
setIsShowDeleteConfirm(true)
|
setIsShowDeleteConfirm(true)
|
||||||
else
|
else
|
||||||
setIsShowAvatarPicker(true)
|
setIsShowAvatarPicker(true)
|
||||||
}}
|
}}
|
||||||
onMouseMove={(e) => {
|
onMouseMove={(e) => {
|
||||||
|
|||||||
@ -45,8 +45,8 @@ const ICON_MAP = {
|
|||||||
</div>,
|
</div>,
|
||||||
dataset: <AppIcon innerIcon={DatasetSvg} className='!border-[0.5px] !border-indigo-100 !bg-indigo-25' />,
|
dataset: <AppIcon innerIcon={DatasetSvg} className='!border-[0.5px] !border-indigo-100 !bg-indigo-25' />,
|
||||||
webapp: <div className='rounded-lg border-[0.5px] border-divider-subtle bg-util-colors-blue-brand-blue-brand-500 p-1 shadow-md'>
|
webapp: <div className='rounded-lg border-[0.5px] border-divider-subtle bg-util-colors-blue-brand-blue-brand-500 p-1 shadow-md'>
|
||||||
<WindowCursor className='h-4 w-4 text-text-primary-on-surface' />
|
<WindowCursor className='h-4 w-4 text-text-primary-on-surface' />
|
||||||
</div>,
|
</div>,
|
||||||
notion: <AppIcon innerIcon={NotionSvg} className='!border-[0.5px] !border-indigo-100 !bg-white' />,
|
notion: <AppIcon innerIcon={NotionSvg} className='!border-[0.5px] !border-indigo-100 !bg-white' />,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,12 +62,12 @@ const AppDetailNav = ({ title, desc, isExternal, icon, icon_background, navigati
|
|||||||
}, [appSidebarExpand, setAppSiderbarExpand])
|
}, [appSidebarExpand, setAppSiderbarExpand])
|
||||||
|
|
||||||
if (inWorkflowCanvas && hideHeader) {
|
if (inWorkflowCanvas && hideHeader) {
|
||||||
return (
|
return (
|
||||||
<div className='flex w-0 shrink-0'>
|
<div className='flex w-0 shrink-0'>
|
||||||
<AppSidebarDropdown navigation={navigation} />
|
<AppSidebarDropdown navigation={navigation} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -121,7 +121,7 @@ describe('Sidebar Animation Issues Reproduction', () => {
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Issue #1: Toggle Button Position Movement - FIXED', () => {
|
describe('Issue #1: Toggle Button Position Movement - FIXED', () => {
|
||||||
it('should verify consistent padding prevents button position shift', () => {
|
it('should verify consistent padding prevents button position shift', () => {
|
||||||
let expanded = false
|
let expanded = false
|
||||||
const handleToggle = () => {
|
const handleToggle = () => {
|
||||||
|
|||||||
@ -84,7 +84,7 @@ const Annotation: FC<Props> = (props) => {
|
|||||||
setList(data as AnnotationItem[])
|
setList(data as AnnotationItem[])
|
||||||
setTotal(total)
|
setTotal(total)
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,13 +52,13 @@ const TypeSelector: FC<Props> = ({
|
|||||||
>
|
>
|
||||||
<div className='flex items-center'>
|
<div className='flex items-center'>
|
||||||
<InputVarTypeIcon type={selectedItem?.value as InputVarType} className='size-4 shrink-0 text-text-secondary' />
|
<InputVarTypeIcon type={selectedItem?.value as InputVarType} className='size-4 shrink-0 text-text-secondary' />
|
||||||
<span
|
<span
|
||||||
className={`
|
className={`
|
||||||
ml-1.5 ${!selectedItem?.name && 'text-components-input-text-placeholder'}
|
ml-1.5 ${!selectedItem?.name && 'text-components-input-text-placeholder'}
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
{selectedItem?.name}
|
{selectedItem?.name}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className='flex items-center space-x-1'>
|
<div className='flex items-center space-x-1'>
|
||||||
<Badge uppercase={false}>{inputVarTypeToVarType(selectedItem?.value as InputVarType)}</Badge>
|
<Badge uppercase={false}>{inputVarTypeToVarType(selectedItem?.value as InputVarType)}</Badge>
|
||||||
|
|||||||
@ -175,7 +175,6 @@ const ConfigContent: FC<Props> = ({
|
|||||||
...datasetConfigs,
|
...datasetConfigs,
|
||||||
reranking_enable: enable,
|
reranking_enable: enable,
|
||||||
})
|
})
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [currentRerankModel, datasetConfigs, onChange])
|
}, [currentRerankModel, datasetConfigs, onChange])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -57,10 +57,10 @@ const ChatUserInput = ({
|
|||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
{type !== 'checkbox' && (
|
{type !== 'checkbox' && (
|
||||||
<div className='system-sm-semibold mb-1 flex h-6 items-center gap-1 text-text-secondary'>
|
<div className='system-sm-semibold mb-1 flex h-6 items-center gap-1 text-text-secondary'>
|
||||||
<div className='truncate'>{name || key}</div>
|
<div className='truncate'>{name || key}</div>
|
||||||
{!required && <span className='system-xs-regular text-text-tertiary'>{t('workflow.panel.optional')}</span>}
|
{!required && <span className='system-xs-regular text-text-tertiary'>{t('workflow.panel.optional')}</span>}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className='grow'>
|
<div className='grow'>
|
||||||
{type === 'string' && (
|
{type === 'string' && (
|
||||||
|
|||||||
@ -112,72 +112,72 @@ const getFormattedChatList = (messages: ChatMessage[], conversationId: string, t
|
|||||||
const newChatList: IChatItem[] = []
|
const newChatList: IChatItem[] = []
|
||||||
try {
|
try {
|
||||||
messages.forEach((item: ChatMessage) => {
|
messages.forEach((item: ChatMessage) => {
|
||||||
const questionFiles = item.message_files?.filter((file: any) => file.belongs_to === 'user') || []
|
const questionFiles = item.message_files?.filter((file: any) => file.belongs_to === 'user') || []
|
||||||
newChatList.push({
|
newChatList.push({
|
||||||
id: `question-${item.id}`,
|
id: `question-${item.id}`,
|
||||||
content: item.inputs.query || item.inputs.default_input || item.query, // text generation: item.inputs.query; chat: item.query
|
content: item.inputs.query || item.inputs.default_input || item.query, // text generation: item.inputs.query; chat: item.query
|
||||||
isAnswer: false,
|
isAnswer: false,
|
||||||
message_files: getProcessedFilesFromResponse(questionFiles.map((item: any) => ({ ...item, related_id: item.id }))),
|
message_files: getProcessedFilesFromResponse(questionFiles.map((item: any) => ({ ...item, related_id: item.id }))),
|
||||||
parentMessageId: item.parent_message_id || undefined,
|
parentMessageId: item.parent_message_id || undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
const answerFiles = item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || []
|
const answerFiles = item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || []
|
||||||
newChatList.push({
|
newChatList.push({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
content: item.answer,
|
content: item.answer,
|
||||||
agent_thoughts: addFileInfos(item.agent_thoughts ? sortAgentSorts(item.agent_thoughts) : item.agent_thoughts, item.message_files),
|
agent_thoughts: addFileInfos(item.agent_thoughts ? sortAgentSorts(item.agent_thoughts) : item.agent_thoughts, item.message_files),
|
||||||
feedback: item.feedbacks.find(item => item.from_source === 'user'), // user feedback
|
feedback: item.feedbacks.find(item => item.from_source === 'user'), // user feedback
|
||||||
adminFeedback: item.feedbacks.find(item => item.from_source === 'admin'), // admin feedback
|
adminFeedback: item.feedbacks.find(item => item.from_source === 'admin'), // admin feedback
|
||||||
feedbackDisabled: false,
|
feedbackDisabled: false,
|
||||||
isAnswer: true,
|
isAnswer: true,
|
||||||
message_files: getProcessedFilesFromResponse(answerFiles.map((item: any) => ({ ...item, related_id: item.id }))),
|
message_files: getProcessedFilesFromResponse(answerFiles.map((item: any) => ({ ...item, related_id: item.id }))),
|
||||||
log: [
|
log: [
|
||||||
...item.message,
|
...item.message,
|
||||||
...(item.message[item.message.length - 1]?.role !== 'assistant'
|
...(item.message[item.message.length - 1]?.role !== 'assistant'
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
text: item.answer,
|
text: item.answer,
|
||||||
files: item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || [],
|
files: item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || [],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
] as IChatItem['log'],
|
] as IChatItem['log'],
|
||||||
workflow_run_id: item.workflow_run_id,
|
workflow_run_id: item.workflow_run_id,
|
||||||
conversationId,
|
conversationId,
|
||||||
input: {
|
input: {
|
||||||
inputs: item.inputs,
|
inputs: item.inputs,
|
||||||
query: item.query,
|
query: item.query,
|
||||||
},
|
},
|
||||||
more: {
|
more: {
|
||||||
time: dayjs.unix(item.created_at).tz(timezone).format(format),
|
time: dayjs.unix(item.created_at).tz(timezone).format(format),
|
||||||
tokens: item.answer_tokens + item.message_tokens,
|
tokens: item.answer_tokens + item.message_tokens,
|
||||||
latency: item.provider_response_latency.toFixed(2),
|
latency: item.provider_response_latency.toFixed(2),
|
||||||
},
|
},
|
||||||
citation: item.metadata?.retriever_resources,
|
citation: item.metadata?.retriever_resources,
|
||||||
annotation: (() => {
|
annotation: (() => {
|
||||||
if (item.annotation_hit_history) {
|
if (item.annotation_hit_history) {
|
||||||
return {
|
return {
|
||||||
id: item.annotation_hit_history.annotation_id,
|
id: item.annotation_hit_history.annotation_id,
|
||||||
authorName: item.annotation_hit_history.annotation_create_account?.name || 'N/A',
|
authorName: item.annotation_hit_history.annotation_create_account?.name || 'N/A',
|
||||||
created_at: item.annotation_hit_history.created_at,
|
created_at: item.annotation_hit_history.created_at,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (item.annotation) {
|
if (item.annotation) {
|
||||||
return {
|
return {
|
||||||
id: item.annotation.id,
|
id: item.annotation.id,
|
||||||
authorName: item.annotation.account.name,
|
authorName: item.annotation.account.name,
|
||||||
logAnnotation: item.annotation,
|
logAnnotation: item.annotation,
|
||||||
created_at: 0,
|
created_at: 0,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return undefined
|
return undefined
|
||||||
})(),
|
})(),
|
||||||
parentMessageId: `question-${item.id}`,
|
parentMessageId: `question-${item.id}`,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
return newChatList
|
return newChatList
|
||||||
}
|
}
|
||||||
@ -503,7 +503,7 @@ function DetailPanel({ detail, onFeedback }: IDetailPanel) {
|
|||||||
|
|
||||||
setThreadChatItems(getThreadMessages(tree, newAllChatItems.at(-1)?.id))
|
setThreadChatItems(getThreadMessages(tree, newAllChatItems.at(-1)?.id))
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
setHasMore(false)
|
setHasMore(false)
|
||||||
}
|
}
|
||||||
@ -522,7 +522,7 @@ function DetailPanel({ detail, onFeedback }: IDetailPanel) {
|
|||||||
if (outerDiv && outerDiv.scrollHeight > outerDiv.clientHeight) {
|
if (outerDiv && outerDiv.scrollHeight > outerDiv.clientHeight) {
|
||||||
scrollContainer = outerDiv
|
scrollContainer = outerDiv
|
||||||
}
|
}
|
||||||
else if (scrollableDiv && scrollableDiv.scrollHeight > scrollableDiv.clientHeight) {
|
else if (scrollableDiv && scrollableDiv.scrollHeight > scrollableDiv.clientHeight) {
|
||||||
scrollContainer = scrollableDiv
|
scrollContainer = scrollableDiv
|
||||||
}
|
}
|
||||||
else if (chatContainer && chatContainer.scrollHeight > chatContainer.clientHeight) {
|
else if (chatContainer && chatContainer.scrollHeight > chatContainer.clientHeight) {
|
||||||
|
|||||||
@ -167,7 +167,7 @@ function AppCard({
|
|||||||
setAppDetail(res)
|
setAppDetail(res)
|
||||||
setShowAccessControl(false)
|
setShowAccessControl(false)
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error('Failed to fetch app detail:', error)
|
console.error('Failed to fetch app detail:', error)
|
||||||
}
|
}
|
||||||
}, [appDetail, setAppDetail])
|
}, [appDetail, setAppDetail])
|
||||||
|
|||||||
@ -40,12 +40,12 @@ const OPTION_MAP = {
|
|||||||
`<script>
|
`<script>
|
||||||
window.difyChatbotConfig = {
|
window.difyChatbotConfig = {
|
||||||
token: '${token}'${isTestEnv
|
token: '${token}'${isTestEnv
|
||||||
? `,
|
? `,
|
||||||
isDev: true`
|
isDev: true`
|
||||||
: ''}${IS_CE_EDITION
|
: ''}${IS_CE_EDITION
|
||||||
? `,
|
? `,
|
||||||
baseUrl: '${url}${basePath}'`
|
baseUrl: '${url}${basePath}'`
|
||||||
: ''},
|
: ''},
|
||||||
inputs: {
|
inputs: {
|
||||||
// You can define the inputs from the Start node here
|
// You can define the inputs from the Start node here
|
||||||
// key is the variable name
|
// key is the variable name
|
||||||
|
|||||||
@ -240,7 +240,7 @@ const SettingsModal: FC<ISettingsModalProps> = ({
|
|||||||
<Link href={docLink('/guides/application-publishing/launch-your-webapp-quickly/README', {
|
<Link href={docLink('/guides/application-publishing/launch-your-webapp-quickly/README', {
|
||||||
'zh-Hans': '/guides/application-publishing/launch-your-webapp-quickly/readme',
|
'zh-Hans': '/guides/application-publishing/launch-your-webapp-quickly/readme',
|
||||||
})}
|
})}
|
||||||
target='_blank' rel='noopener noreferrer' className='text-text-accent'>{t('common.operation.learnMore')}</Link>
|
target='_blank' rel='noopener noreferrer' className='text-text-accent'>{t('common.operation.learnMore')}</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* form body */}
|
{/* form body */}
|
||||||
|
|||||||
@ -68,7 +68,7 @@ const getKey = (
|
|||||||
|
|
||||||
const List = () => {
|
const List = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { systemFeatures } = useGlobalPublicStore()
|
const { systemFeatures } = useGlobalPublicStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { isCurrentWorkspaceEditor, isCurrentWorkspaceDatasetOperator } = useAppContext()
|
const { isCurrentWorkspaceEditor, isCurrentWorkspaceDatasetOperator } = useAppContext()
|
||||||
const showTagManagementModal = useTagStore(s => s.showTagManagementModal)
|
const showTagManagementModal = useTagStore(s => s.showTagManagementModal)
|
||||||
|
|||||||
@ -46,12 +46,12 @@ const InputsFormContent = ({ showTip }: Props) => {
|
|||||||
{visibleInputsForms.map(form => (
|
{visibleInputsForms.map(form => (
|
||||||
<div key={form.variable} className='space-y-1'>
|
<div key={form.variable} className='space-y-1'>
|
||||||
{form.type !== InputVarType.checkbox && (
|
{form.type !== InputVarType.checkbox && (
|
||||||
<div className='flex h-6 items-center gap-1'>
|
<div className='flex h-6 items-center gap-1'>
|
||||||
<div className='system-md-semibold text-text-secondary'>{form.label}</div>
|
<div className='system-md-semibold text-text-secondary'>{form.label}</div>
|
||||||
{!form.required && (
|
{!form.required && (
|
||||||
<div className='system-xs-regular text-text-tertiary'>{t('appDebug.variableTable.optional')}</div>
|
<div className='system-xs-regular text-text-tertiary'>{t('appDebug.variableTable.optional')}</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{form.type === InputVarType.textInput && (
|
{form.type === InputVarType.textInput && (
|
||||||
<Input
|
<Input
|
||||||
|
|||||||
@ -12,12 +12,12 @@ type CheckboxProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Checkbox = ({
|
const Checkbox = ({
|
||||||
id,
|
id,
|
||||||
checked,
|
checked,
|
||||||
onCheck,
|
onCheck,
|
||||||
className,
|
className,
|
||||||
disabled,
|
disabled,
|
||||||
indeterminate,
|
indeterminate,
|
||||||
}: CheckboxProps) => {
|
}: CheckboxProps) => {
|
||||||
const checkClassName = (checked || indeterminate)
|
const checkClassName = (checked || indeterminate)
|
||||||
? 'bg-components-checkbox-bg text-components-checkbox-icon hover:bg-components-checkbox-bg-hover'
|
? 'bg-components-checkbox-bg text-components-checkbox-icon hover:bg-components-checkbox-bg-hover'
|
||||||
|
|||||||
@ -131,7 +131,7 @@ export const formatDateForOutput = (date: Dayjs, includeTime: boolean = false, l
|
|||||||
// Output format with time
|
// Output format with time
|
||||||
return date.format('YYYY-MM-DDTHH:mm:ss.SSSZ')
|
return date.format('YYYY-MM-DDTHH:mm:ss.SSSZ')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Date-only output format without timezone
|
// Date-only output format without timezone
|
||||||
return date.format('YYYY-MM-DD')
|
return date.format('YYYY-MM-DD')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ const DemoForm = () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const name = useStore(form.store, state => state.values.name)
|
const name = useStore(form.store, state => state.values.name)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form
|
<form
|
||||||
|
|||||||
@ -70,10 +70,10 @@ export type GetValuesOptions = {
|
|||||||
needCheckValidatedValues?: boolean
|
needCheckValidatedValues?: boolean
|
||||||
}
|
}
|
||||||
export type FormRefObject = {
|
export type FormRefObject = {
|
||||||
getForm: () => AnyFormApi
|
getForm: () => AnyFormApi
|
||||||
getFormValues: (obj: GetValuesOptions) => {
|
getFormValues: (obj: GetValuesOptions) => {
|
||||||
values: Record<string, any>
|
values: Record<string, any>
|
||||||
isCheckValidated: boolean
|
isCheckValidated: boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export type FormRef = ForwardedRef<FormRefObject>
|
export type FormRef = ForwardedRef<FormRefObject>
|
||||||
|
|||||||
@ -529,9 +529,9 @@ const Flowchart = React.forwardRef((props: {
|
|||||||
{isLoading && !svgString && (
|
{isLoading && !svgString && (
|
||||||
<div className='px-[26px] py-4'>
|
<div className='px-[26px] py-4'>
|
||||||
<LoadingAnim type='text'/>
|
<LoadingAnim type='text'/>
|
||||||
<div className="mt-2 text-sm text-gray-500">
|
<div className="mt-2 text-sm text-gray-500">
|
||||||
{t('common.wait_for_completion', 'Waiting for diagram code to complete...')}
|
{t('common.wait_for_completion', 'Waiting for diagram code to complete...')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@ -20,9 +20,9 @@ const CurrentBlockComponent: FC<CurrentBlockComponentProps> = ({
|
|||||||
|
|
||||||
const Icon = generatorType === GeneratorType.prompt ? MagicEdit : CodeAssistant
|
const Icon = generatorType === GeneratorType.prompt ? MagicEdit : CodeAssistant
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!editor.hasNodes([CurrentBlockNode]))
|
if (!editor.hasNodes([CurrentBlockNode]))
|
||||||
throw new Error('WorkflowVariableBlockPlugin: WorkflowVariableBlock not registered on editor')
|
throw new Error('WorkflowVariableBlockPlugin: WorkflowVariableBlock not registered on editor')
|
||||||
}, [editor])
|
}, [editor])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -16,9 +16,9 @@ const ErrorMessageBlockComponent: FC<Props> = ({
|
|||||||
const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_ERROR_MESSAGE_COMMAND)
|
const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_ERROR_MESSAGE_COMMAND)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!editor.hasNodes([ErrorMessageBlockNode]))
|
if (!editor.hasNodes([ErrorMessageBlockNode]))
|
||||||
throw new Error('WorkflowVariableBlockPlugin: WorkflowVariableBlock not registered on editor')
|
throw new Error('WorkflowVariableBlockPlugin: WorkflowVariableBlock not registered on editor')
|
||||||
}, [editor])
|
}, [editor])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -16,9 +16,9 @@ const LastRunBlockComponent: FC<Props> = ({
|
|||||||
const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_LAST_RUN_COMMAND)
|
const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_LAST_RUN_COMMAND)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!editor.hasNodes([LastRunBlockNode]))
|
if (!editor.hasNodes([LastRunBlockNode]))
|
||||||
throw new Error('WorkflowVariableBlockPlugin: WorkflowVariableBlock not registered on editor')
|
throw new Error('WorkflowVariableBlockPlugin: WorkflowVariableBlock not registered on editor')
|
||||||
}, [editor])
|
}, [editor])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -219,36 +219,36 @@ const SimpleSelect: FC<ISelectProps> = ({
|
|||||||
{renderTrigger && <ListboxButton className='w-full'>{renderTrigger(selectedItem)}</ListboxButton>}
|
{renderTrigger && <ListboxButton className='w-full'>{renderTrigger(selectedItem)}</ListboxButton>}
|
||||||
{!renderTrigger && (
|
{!renderTrigger && (
|
||||||
<ListboxButton onClick={() => {
|
<ListboxButton onClick={() => {
|
||||||
onOpenChange?.(open)
|
onOpenChange?.(open)
|
||||||
}} className={classNames(`flex h-full w-full items-center rounded-lg border-0 bg-components-input-bg-normal pl-3 pr-10 focus-visible:bg-state-base-hover-alt focus-visible:outline-none group-hover/simple-select:bg-state-base-hover-alt sm:text-sm sm:leading-6 ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'}`, className)}>
|
}} className={classNames(`flex h-full w-full items-center rounded-lg border-0 bg-components-input-bg-normal pl-3 pr-10 focus-visible:bg-state-base-hover-alt focus-visible:outline-none group-hover/simple-select:bg-state-base-hover-alt sm:text-sm sm:leading-6 ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'}`, className)}>
|
||||||
<span className={classNames('system-sm-regular block truncate text-left text-components-input-text-filled', !selectedItem?.name && 'text-components-input-text-placeholder')}>{selectedItem?.name ?? localPlaceholder}</span>
|
<span className={classNames('system-sm-regular block truncate text-left text-components-input-text-filled', !selectedItem?.name && 'text-components-input-text-placeholder')}>{selectedItem?.name ?? localPlaceholder}</span>
|
||||||
<span className="absolute inset-y-0 right-0 flex items-center pr-2">
|
<span className="absolute inset-y-0 right-0 flex items-center pr-2">
|
||||||
{isLoading ? <RiLoader4Line className='h-3.5 w-3.5 animate-spin text-text-secondary' />
|
{isLoading ? <RiLoader4Line className='h-3.5 w-3.5 animate-spin text-text-secondary' />
|
||||||
: (selectedItem && !notClearable)
|
: (selectedItem && !notClearable)
|
||||||
? (
|
? (
|
||||||
<XMarkIcon
|
<XMarkIcon
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
setSelectedItem(null)
|
setSelectedItem(null)
|
||||||
onSelect({ name: '', value: '' })
|
onSelect({ name: '', value: '' })
|
||||||
}}
|
}}
|
||||||
className="h-4 w-4 cursor-pointer text-text-quaternary"
|
className="h-4 w-4 cursor-pointer text-text-quaternary"
|
||||||
aria-hidden="false"
|
aria-hidden="false"
|
||||||
/>
|
|
||||||
)
|
|
||||||
: (
|
|
||||||
open ? (
|
|
||||||
<ChevronUpIcon
|
|
||||||
className="h-4 w-4 text-text-quaternary group-hover/simple-select:text-text-secondary"
|
|
||||||
aria-hidden="true"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<ChevronDownIcon
|
|
||||||
className="h-4 w-4 text-text-quaternary group-hover/simple-select:text-text-secondary"
|
|
||||||
aria-hidden="true"
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
)}
|
: (
|
||||||
|
open ? (
|
||||||
|
<ChevronUpIcon
|
||||||
|
className="h-4 w-4 text-text-quaternary group-hover/simple-select:text-text-secondary"
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<ChevronDownIcon
|
||||||
|
className="h-4 w-4 text-text-quaternary group-hover/simple-select:text-text-secondary"
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
</ListboxButton>
|
</ListboxButton>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -226,7 +226,7 @@ const TagSelector: FC<TagSelectorProps> = ({
|
|||||||
const res = await fetchTagList(type)
|
const res = await fetchTagList(type)
|
||||||
setTagList(res)
|
setTagList(res)
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
setTagList([])
|
setTagList([])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,7 +60,7 @@ const Toast = ({
|
|||||||
|| (type === 'warning' && 'bg-toast-warning-bg')
|
|| (type === 'warning' && 'bg-toast-warning-bg')
|
||||||
|| (type === 'error' && 'bg-toast-error-bg')
|
|| (type === 'error' && 'bg-toast-error-bg')
|
||||||
|| (type === 'info' && 'bg-toast-info-bg')
|
|| (type === 'info' && 'bg-toast-info-bg')
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
<div className={`flex ${size === 'md' ? 'gap-1' : 'gap-0.5'}`}>
|
<div className={`flex ${size === 'md' ? 'gap-1' : 'gap-0.5'}`}>
|
||||||
<div className={`flex items-center justify-center ${size === 'md' ? 'p-0.5' : 'p-1'}`}>
|
<div className={`flex items-center justify-center ${size === 'md' ? 'p-0.5' : 'p-1'}`}>
|
||||||
|
|||||||
@ -61,7 +61,6 @@ const RetrievalParamConfig: FC<Props> = ({
|
|||||||
...value,
|
...value,
|
||||||
reranking_enable: enable,
|
reranking_enable: enable,
|
||||||
})
|
})
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [currentModel, onChange, value])
|
}, [currentModel, onChange, value])
|
||||||
|
|
||||||
const rerankModel = useMemo(() => {
|
const rerankModel = useMemo(() => {
|
||||||
|
|||||||
@ -29,7 +29,6 @@ const OptionsWrap: FC<Props> = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (controlFoldOptions)
|
if (controlFoldOptions)
|
||||||
foldHide()
|
foldHide()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [controlFoldOptions])
|
}, [controlFoldOptions])
|
||||||
return (
|
return (
|
||||||
<div className={cn(className, !fold ? 'mb-0' : 'mb-3')}>
|
<div className={cn(className, !fold ? 'mb-0' : 'mb-3')}>
|
||||||
|
|||||||
@ -64,7 +64,6 @@ const Website: FC<Props> = ({
|
|||||||
checkSetApiKey().then(() => {
|
checkSetApiKey().then(() => {
|
||||||
setIsLoaded(true)
|
setIsLoaded(true)
|
||||||
})
|
})
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
const handleOnConfig = useCallback(() => {
|
const handleOnConfig = useCallback(() => {
|
||||||
setShowAccountSettingModal({
|
setShowAccountSettingModal({
|
||||||
@ -97,7 +96,7 @@ const Website: FC<Props> = ({
|
|||||||
<span className={cn(s.jinaLogo, 'mr-2')}/>
|
<span className={cn(s.jinaLogo, 'mr-2')}/>
|
||||||
<span>Jina Reader</span>
|
<span>Jina Reader</span>
|
||||||
</button>}
|
</button>}
|
||||||
{ENABLE_WEBSITE_FIRECRAWL && <button
|
{ENABLE_WEBSITE_FIRECRAWL && <button
|
||||||
className={cn('rounded-lg px-4 py-2',
|
className={cn('rounded-lg px-4 py-2',
|
||||||
selectedProvider === DataSourceProvider.fireCrawl
|
selectedProvider === DataSourceProvider.fireCrawl
|
||||||
? 'system-sm-medium border-[1.5px] border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary'
|
? 'system-sm-medium border-[1.5px] border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary'
|
||||||
|
|||||||
@ -29,7 +29,6 @@ const OptionsWrap: FC<Props> = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (controlFoldOptions)
|
if (controlFoldOptions)
|
||||||
foldHide()
|
foldHide()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [controlFoldOptions])
|
}, [controlFoldOptions])
|
||||||
return (
|
return (
|
||||||
<div className={cn(className, !fold ? 'mb-0' : 'mb-3')}>
|
<div className={cn(className, !fold ? 'mb-0' : 'mb-3')}>
|
||||||
|
|||||||
@ -161,7 +161,7 @@ const CSVUploader: FC<Props> = ({
|
|||||||
const fileChangeHandle = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const fileChangeHandle = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const currentFile = e.target.files?.[0]
|
const currentFile = e.target.files?.[0]
|
||||||
if (!isValid(currentFile))
|
if (!isValid(currentFile))
|
||||||
return
|
return
|
||||||
|
|
||||||
initialUpload(currentFile)
|
initialUpload(currentFile)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,9 +24,9 @@ const InfoPanel = () => {
|
|||||||
{t('dataset.connectDatasetIntro.content.end')}
|
{t('dataset.connectDatasetIntro.content.end')}
|
||||||
</span>
|
</span>
|
||||||
<a className='system-sm-regular self-stretch text-text-accent'
|
<a className='system-sm-regular self-stretch text-text-accent'
|
||||||
href={docLink('/guides/knowledge-base/connect-external-knowledge-base')}
|
href={docLink('/guides/knowledge-base/connect-external-knowledge-base')}
|
||||||
target='_blank'
|
target='_blank'
|
||||||
rel="noopener noreferrer">
|
rel="noopener noreferrer">
|
||||||
{t('dataset.connectDatasetIntro.learnMore')}
|
{t('dataset.connectDatasetIntro.learnMore')}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -69,13 +69,13 @@ const ChunkDetailModal: FC<Props> = ({
|
|||||||
<div>
|
<div>
|
||||||
<div className='flex gap-x-1'>
|
<div className='flex gap-x-1'>
|
||||||
<div className='w-4 shrink-0 text-[13px] font-medium leading-[20px] text-text-tertiary'>Q</div>
|
<div className='w-4 shrink-0 text-[13px] font-medium leading-[20px] text-text-tertiary'>Q</div>
|
||||||
<div className={cn('body-md-regular text-text-secondary line-clamp-20')}>
|
<div className={cn('body-md-regular line-clamp-20 text-text-secondary')}>
|
||||||
{content}
|
{content}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='flex gap-x-1'>
|
<div className='flex gap-x-1'>
|
||||||
<div className='w-4 shrink-0 text-[13px] font-medium leading-[20px] text-text-tertiary'>A</div>
|
<div className='w-4 shrink-0 text-[13px] font-medium leading-[20px] text-text-tertiary'>A</div>
|
||||||
<div className={cn('body-md-regular text-text-secondary line-clamp-20')}>
|
<div className={cn('body-md-regular line-clamp-20 text-text-secondary')}>
|
||||||
{answer}
|
{answer}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -28,7 +28,6 @@ const useEditDatasetMetadata = ({
|
|||||||
showEditModal()
|
showEditModal()
|
||||||
localStorage.removeItem(isShowManageMetadataLocalStorageKey)
|
localStorage.removeItem(isShowManageMetadataLocalStorageKey)
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const { data: datasetMetaData } = useDatasetMetaData(datasetId)
|
const { data: datasetMetaData } = useDatasetMetaData(datasetId)
|
||||||
|
|||||||
@ -132,7 +132,7 @@ export class SlashCommandRegistry {
|
|||||||
try {
|
try {
|
||||||
return await handler.search(args, locale)
|
return await handler.search(args, locale)
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.warn(`Command search failed for ${commandName}:`, error)
|
console.warn(`Command search failed for ${commandName}:`, error)
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ export class SlashCommandRegistry {
|
|||||||
try {
|
try {
|
||||||
return await handler.search(args, locale)
|
return await handler.search(args, locale)
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.warn(`Command search failed for ${handler.name}:`, error)
|
console.warn(`Command search failed for ${handler.name}:`, error)
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|||||||
@ -205,7 +205,7 @@ export const searchAnything = async (
|
|||||||
const results = await action.search(query, query, locale)
|
const results = await action.search(query, query, locale)
|
||||||
return { success: true, data: results, actionType: action.key }
|
return { success: true, data: results, actionType: action.key }
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.warn(`Search failed for ${action.key}:`, error)
|
console.warn(`Search failed for ${action.key}:`, error)
|
||||||
return { success: false, data: [], actionType: action.key, error }
|
return { success: false, data: [], actionType: action.key, error }
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ export const searchAnything = async (
|
|||||||
if (result.status === 'fulfilled' && result.value.success) {
|
if (result.status === 'fulfilled' && result.value.success) {
|
||||||
allResults.push(...result.value.data)
|
allResults.push(...result.value.data)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const actionKey = globalSearchActions[index]?.key || 'unknown'
|
const actionKey = globalSearchActions[index]?.key || 'unknown'
|
||||||
failedActions.push(actionKey)
|
failedActions.push(actionKey)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,7 +166,7 @@ const GotoAnything: FC<Props> = ({
|
|||||||
acc[result.type].push(result)
|
acc[result.type].push(result)
|
||||||
return acc
|
return acc
|
||||||
}, {} as { [key: string]: SearchResult[] }),
|
}, {} as { [key: string]: SearchResult[] }),
|
||||||
[searchResults])
|
[searchResults])
|
||||||
|
|
||||||
const emptyResult = useMemo(() => {
|
const emptyResult = useMemo(() => {
|
||||||
if (searchResults.length || !searchQuery.trim() || isLoading || isCommandsMode)
|
if (searchResults.length || !searchQuery.trim() || isLoading || isCommandsMode)
|
||||||
|
|||||||
@ -32,7 +32,6 @@ const DataSourceWebsite: FC<Props> = ({ provider }) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
checkSetApiKey()
|
checkSetApiKey()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const [configTarget, setConfigTarget] = useState<DataSourceProvider | null>(null)
|
const [configTarget, setConfigTarget] = useState<DataSourceProvider | null>(null)
|
||||||
|
|||||||
@ -60,9 +60,9 @@ const AddCredentialInLoadBalancing = ({
|
|||||||
asChild
|
asChild
|
||||||
popupContent={t('plugin.auth.credentialUnavailable')}
|
popupContent={t('plugin.auth.credentialUnavailable')}
|
||||||
>
|
>
|
||||||
{Item}
|
{Item}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return Item
|
return Item
|
||||||
}, [notAllowCustomCredential, t, customModel])
|
}, [notAllowCustomCredential, t, customModel])
|
||||||
|
|||||||
@ -176,11 +176,11 @@ const Authorized = ({
|
|||||||
onClick={() => handleEdit(
|
onClick={() => handleEdit(
|
||||||
undefined,
|
undefined,
|
||||||
currentCustomConfigurationModelFixedFields
|
currentCustomConfigurationModelFixedFields
|
||||||
? {
|
? {
|
||||||
model: currentCustomConfigurationModelFixedFields.__model_name,
|
model: currentCustomConfigurationModelFixedFields.__model_name,
|
||||||
model_type: currentCustomConfigurationModelFixedFields.__model_type,
|
model_type: currentCustomConfigurationModelFixedFields.__model_type,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
)}
|
)}
|
||||||
className='system-xs-medium flex h-[30px] cursor-pointer items-center px-3 text-text-accent-light-mode-only'
|
className='system-xs-medium flex h-[30px] cursor-pointer items-center px-3 text-text-accent-light-mode-only'
|
||||||
>
|
>
|
||||||
|
|||||||
@ -200,8 +200,8 @@ const ModelLoadBalancingModal = ({
|
|||||||
<div className='grow'>
|
<div className='grow'>
|
||||||
<div className='text-sm text-text-secondary'>{
|
<div className='text-sm text-text-secondary'>{
|
||||||
providerFormSchemaPredefined
|
providerFormSchemaPredefined
|
||||||
? t('common.modelProvider.auth.providerManaged')
|
? t('common.modelProvider.auth.providerManaged')
|
||||||
: t('common.modelProvider.auth.specifyModelCredential')
|
: t('common.modelProvider.auth.specifyModelCredential')
|
||||||
}</div>
|
}</div>
|
||||||
<div className='text-xs text-text-tertiary'>{
|
<div className='text-xs text-text-tertiary'>{
|
||||||
providerFormSchemaPredefined
|
providerFormSchemaPredefined
|
||||||
|
|||||||
@ -41,13 +41,10 @@ const Item: FC<Props> = ({
|
|||||||
onFetchedPayload(payload)
|
onFetchedPayload(payload)
|
||||||
setPayload({ ...payload, from: dependency.type })
|
setPayload({ ...payload, from: dependency.type })
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [data])
|
}, [data])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (error)
|
if (error)
|
||||||
onFetchError()
|
onFetchError()
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [error])
|
}, [error])
|
||||||
if (!payload) return <Loading />
|
if (!payload) return <Loading />
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -131,7 +131,6 @@ const InstallByDSLList: ForwardRefRenderFunction<ExposeRefs, Props> = ({
|
|||||||
if (failedIndex.length > 0)
|
if (failedIndex.length > 0)
|
||||||
setErrorIndexes([...errorIndexes, ...failedIndex])
|
setErrorIndexes([...errorIndexes, ...failedIndex])
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [isFetchingMarketplaceDataById])
|
}, [isFetchingMarketplaceDataById])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -156,15 +155,12 @@ const InstallByDSLList: ForwardRefRenderFunction<ExposeRefs, Props> = ({
|
|||||||
if (failedIndex.length > 0)
|
if (failedIndex.length > 0)
|
||||||
setErrorIndexes([...errorIndexes, ...failedIndex])
|
setErrorIndexes([...errorIndexes, ...failedIndex])
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [isFetchingDataByMeta])
|
}, [isFetchingDataByMeta])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// get info all failed
|
// get info all failed
|
||||||
if (infoByMetaError || infoByIdError)
|
if (infoByMetaError || infoByIdError)
|
||||||
setErrorIndexes([...errorIndexes, ...marketPlaceInDSLIndex])
|
setErrorIndexes([...errorIndexes, ...marketPlaceInDSLIndex])
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [infoByMetaError, infoByIdError])
|
}, [infoByMetaError, infoByIdError])
|
||||||
|
|
||||||
const isLoadedAllData = (plugins.filter(p => !!p).length + errorIndexes.length) === allPlugins.length
|
const isLoadedAllData = (plugins.filter(p => !!p).length + errorIndexes.length) === allPlugins.length
|
||||||
@ -189,8 +185,6 @@ const InstallByDSLList: ForwardRefRenderFunction<ExposeRefs, Props> = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isLoadedAllData && installedInfo)
|
if (isLoadedAllData && installedInfo)
|
||||||
onLoadedAllPlugin(installedInfo!)
|
onLoadedAllPlugin(installedInfo!)
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [isLoadedAllData, installedInfo])
|
}, [isLoadedAllData, installedInfo])
|
||||||
|
|
||||||
const handleSelect = useCallback((index: number) => {
|
const handleSelect = useCallback((index: number) => {
|
||||||
|
|||||||
@ -61,7 +61,6 @@ const Loaded: React.FC<LoadedProps> = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hasInstalled && uniqueIdentifier === installedInfoPayload.uniqueIdentifier)
|
if (hasInstalled && uniqueIdentifier === installedInfoPayload.uniqueIdentifier)
|
||||||
onInstalled()
|
onInstalled()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [hasInstalled])
|
}, [hasInstalled])
|
||||||
|
|
||||||
const handleInstall = async () => {
|
const handleInstall = async () => {
|
||||||
|
|||||||
@ -55,7 +55,6 @@ const Uploading: FC<Props> = ({
|
|||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
handleUpload()
|
handleUpload()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@ -175,7 +175,6 @@ export const MarketplaceContextProvider = ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [queryPlugins, queryMarketplaceCollectionsAndPlugins, isSuccess, exclude])
|
}, [queryPlugins, queryMarketplaceCollectionsAndPlugins, isSuccess, exclude])
|
||||||
|
|
||||||
const handleQueryMarketplaceCollectionsAndPlugins = useCallback(() => {
|
const handleQueryMarketplaceCollectionsAndPlugins = useCallback(() => {
|
||||||
|
|||||||
@ -155,9 +155,9 @@ const Authorized = ({
|
|||||||
}, [setPluginDefaultCredential, onUpdate, notify, t, handleSetDoingAction])
|
}, [setPluginDefaultCredential, onUpdate, notify, t, handleSetDoingAction])
|
||||||
const { mutateAsync: updatePluginCredential } = useUpdatePluginCredentialHook(pluginPayload)
|
const { mutateAsync: updatePluginCredential } = useUpdatePluginCredentialHook(pluginPayload)
|
||||||
const handleRename = useCallback(async (payload: {
|
const handleRename = useCallback(async (payload: {
|
||||||
credential_id: string
|
credential_id: string
|
||||||
name: string
|
name: string
|
||||||
}) => {
|
}) => {
|
||||||
if (doingActionRef.current)
|
if (doingActionRef.current)
|
||||||
return
|
return
|
||||||
try {
|
try {
|
||||||
@ -306,17 +306,17 @@ const Authorized = ({
|
|||||||
!notAllowCustomCredential && (
|
!notAllowCustomCredential && (
|
||||||
<>
|
<>
|
||||||
<div className='h-[1px] bg-divider-subtle'></div>
|
<div className='h-[1px] bg-divider-subtle'></div>
|
||||||
<div className='p-2'>
|
<div className='p-2'>
|
||||||
<Authorize
|
<Authorize
|
||||||
pluginPayload={pluginPayload}
|
pluginPayload={pluginPayload}
|
||||||
theme='secondary'
|
theme='secondary'
|
||||||
showDivider={false}
|
showDivider={false}
|
||||||
canOAuth={canOAuth}
|
canOAuth={canOAuth}
|
||||||
canApiKey={canApiKey}
|
canApiKey={canApiKey}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onUpdate={onUpdate}
|
onUpdate={onUpdate}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,9 +87,9 @@ export const usePluginAuthAction = (
|
|||||||
}, [setPluginDefaultCredential, onUpdate, notify, t, handleSetDoingAction])
|
}, [setPluginDefaultCredential, onUpdate, notify, t, handleSetDoingAction])
|
||||||
const { mutateAsync: updatePluginCredential } = useUpdatePluginCredentialHook(pluginPayload)
|
const { mutateAsync: updatePluginCredential } = useUpdatePluginCredentialHook(pluginPayload)
|
||||||
const handleRename = useCallback(async (payload: {
|
const handleRename = useCallback(async (payload: {
|
||||||
credential_id: string
|
credential_id: string
|
||||||
name: string
|
name: string
|
||||||
}) => {
|
}) => {
|
||||||
if (doingActionRef.current)
|
if (doingActionRef.current)
|
||||||
return
|
return
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -97,7 +97,7 @@ const AppSelector: FC<Props> = ({
|
|||||||
try {
|
try {
|
||||||
await setSize((size: number) => size + 1)
|
await setSize((size: number) => size + 1)
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
// Add a small delay to ensure state updates are complete
|
// Add a small delay to ensure state updates are complete
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setIsLoadingMore(false)
|
setIsLoadingMore(false)
|
||||||
|
|||||||
@ -61,7 +61,7 @@ const DetailHeader = ({
|
|||||||
onUpdate,
|
onUpdate,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { userProfile: { timezone } } = useAppContext()
|
const { userProfile: { timezone } } = useAppContext()
|
||||||
|
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
const locale = useGetLanguage()
|
const locale = useGetLanguage()
|
||||||
|
|||||||
@ -55,9 +55,9 @@ const EndpointModal: FC<Props> = ({
|
|||||||
const value = processedCredential[field.name]
|
const value = processedCredential[field.name]
|
||||||
if (typeof value === 'string')
|
if (typeof value === 'string')
|
||||||
processedCredential[field.name] = value === 'true' || value === '1' || value === 'True'
|
processedCredential[field.name] = value === 'true' || value === '1' || value === 'True'
|
||||||
else if (typeof value === 'number')
|
else if (typeof value === 'number')
|
||||||
processedCredential[field.name] = value === 1
|
processedCredential[field.name] = value === 1
|
||||||
else if (typeof value === 'boolean')
|
else if (typeof value === 'boolean')
|
||||||
processedCredential[field.name] = value
|
processedCredential[field.name] = value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -45,7 +45,7 @@ const MultipleToolSelector = ({
|
|||||||
canChooseMCPTool,
|
canChooseMCPTool,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { data: mcpTools } = useAllMCPTools()
|
const { data: mcpTools } = useAllMCPTools()
|
||||||
const enabledCount = value.filter((item) => {
|
const enabledCount = value.filter((item) => {
|
||||||
const isMCPTool = mcpTools?.find(tool => tool.id === item.provider_name)
|
const isMCPTool = mcpTools?.find(tool => tool.id === item.provider_name)
|
||||||
if(isMCPTool)
|
if(isMCPTool)
|
||||||
|
|||||||
@ -222,12 +222,12 @@ const ReasoningConfigForm: React.FC<Props> = ({
|
|||||||
{t('workflow.nodes.agent.clickToViewParameterSchema')}
|
{t('workflow.nodes.agent.clickToViewParameterSchema')}
|
||||||
</div>}
|
</div>}
|
||||||
asChild={false}>
|
asChild={false}>
|
||||||
<div
|
<div
|
||||||
className='ml-0.5 cursor-pointer rounded-[4px] p-px text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary'
|
className='ml-0.5 cursor-pointer rounded-[4px] p-px text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary'
|
||||||
onClick={() => showSchema(input_schema as SchemaRoot, label[language] || label.en_US)}
|
onClick={() => showSchema(input_schema as SchemaRoot, label[language] || label.en_US)}
|
||||||
>
|
>
|
||||||
<RiBracesLine className='size-3.5'/>
|
<RiBracesLine className='size-3.5'/>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@ -98,7 +98,6 @@ const Action: FC<Props> = ({
|
|||||||
hideDeleteConfirm()
|
hideDeleteConfirm()
|
||||||
onDelete()
|
onDelete()
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [installationId, onDelete])
|
}, [installationId, onDelete])
|
||||||
return (
|
return (
|
||||||
<div className='flex space-x-1'>
|
<div className='flex space-x-1'>
|
||||||
|
|||||||
@ -101,19 +101,19 @@ const AutoUpdateSetting: FC<Props> = ({
|
|||||||
|
|
||||||
const renderTimePickerTrigger = useCallback(({ inputElem, onClick, isOpen }: TriggerParams) => {
|
const renderTimePickerTrigger = useCallback(({ inputElem, onClick, isOpen }: TriggerParams) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className='group float-right flex h-8 w-[160px] cursor-pointer items-center justify-between rounded-lg bg-components-input-bg-normal px-2 hover:bg-state-base-hover-alt'
|
className='group float-right flex h-8 w-[160px] cursor-pointer items-center justify-between rounded-lg bg-components-input-bg-normal px-2 hover:bg-state-base-hover-alt'
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
<div className='flex w-0 grow items-center gap-x-1'>
|
<div className='flex w-0 grow items-center gap-x-1'>
|
||||||
<RiTimeLine className={cn(
|
<RiTimeLine className={cn(
|
||||||
'h-4 w-4 shrink-0 text-text-tertiary',
|
'h-4 w-4 shrink-0 text-text-tertiary',
|
||||||
isOpen ? 'text-text-secondary' : 'group-hover:text-text-secondary',
|
isOpen ? 'text-text-secondary' : 'group-hover:text-text-secondary',
|
||||||
)} />
|
)} />
|
||||||
{inputElem}
|
{inputElem}
|
||||||
</div>
|
|
||||||
<div className='system-sm-regular text-text-tertiary'>{convertTimezoneToOffsetStr(timezone)}</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div className='system-sm-regular text-text-tertiary'>{convertTimezoneToOffsetStr(timezone)}</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}, [timezone])
|
}, [timezone])
|
||||||
|
|
||||||
|
|||||||
@ -28,10 +28,10 @@ export const dayjsToTimeOfDay = (date?: Dayjs): number => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const convertUTCDaySecondsToLocalSeconds = (utcDaySeconds: number, localTimezone: string): number => {
|
export const convertUTCDaySecondsToLocalSeconds = (utcDaySeconds: number, localTimezone: string): number => {
|
||||||
const utcDayStart = dayjs().utc().startOf('day')
|
const utcDayStart = dayjs().utc().startOf('day')
|
||||||
const utcTargetTime = utcDayStart.add(utcDaySeconds, 'second')
|
const utcTargetTime = utcDayStart.add(utcDaySeconds, 'second')
|
||||||
const localTargetTime = utcTargetTime.tz(localTimezone)
|
const localTargetTime = utcTargetTime.tz(localTimezone)
|
||||||
const localDayStart = localTargetTime.startOf('day')
|
const localDayStart = localTargetTime.startOf('day')
|
||||||
const secondsInLocalDay = localTargetTime.diff(localDayStart, 'second')
|
const secondsInLocalDay = localTargetTime.diff(localDayStart, 'second')
|
||||||
return secondsInLocalDay
|
return secondsInLocalDay
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ const DowngradeWarningModal = ({
|
|||||||
<div className='flex flex-col items-start gap-2 self-stretch'>
|
<div className='flex flex-col items-start gap-2 self-stretch'>
|
||||||
<div className='title-2xl-semi-bold text-text-primary'>{t(`${i18nPrefix}.title`)}</div>
|
<div className='title-2xl-semi-bold text-text-primary'>{t(`${i18nPrefix}.title`)}</div>
|
||||||
<div className='system-md-regular text-text-secondary'>
|
<div className='system-md-regular text-text-secondary'>
|
||||||
{t(`${i18nPrefix}.description`)}
|
{t(`${i18nPrefix}.description`)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='mt-9 flex items-start justify-end space-x-2 self-stretch'>
|
<div className='mt-9 flex items-start justify-end space-x-2 self-stretch'>
|
||||||
|
|||||||
@ -136,47 +136,47 @@ const UpdatePluginModal: FC<Props> = ({
|
|||||||
onExcludeAndDowngrade={handleExcludeAndDownload}
|
onExcludeAndDowngrade={handleExcludeAndDownload}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!doShowDowngradeWarningModal && (
|
{!doShowDowngradeWarningModal && (
|
||||||
<>
|
<>
|
||||||
<div className='system-md-regular mb-2 mt-3 text-text-secondary'>
|
<div className='system-md-regular mb-2 mt-3 text-text-secondary'>
|
||||||
{t(`${i18nPrefix}.description`)}
|
{t(`${i18nPrefix}.description`)}
|
||||||
</div>
|
</div>
|
||||||
<div className='flex flex-wrap content-start items-start gap-1 self-stretch rounded-2xl bg-background-section-burn p-2'>
|
<div className='flex flex-wrap content-start items-start gap-1 self-stretch rounded-2xl bg-background-section-burn p-2'>
|
||||||
<Card
|
<Card
|
||||||
installed={uploadStep === UploadStep.installed}
|
installed={uploadStep === UploadStep.installed}
|
||||||
payload={pluginManifestToCardPluginProps({
|
payload={pluginManifestToCardPluginProps({
|
||||||
...originalPackageInfo.payload,
|
...originalPackageInfo.payload,
|
||||||
icon: icon!,
|
icon: icon!,
|
||||||
})}
|
})}
|
||||||
className='w-full'
|
className='w-full'
|
||||||
titleLeft={
|
titleLeft={
|
||||||
<>
|
<>
|
||||||
<Badge className='mx-1' size="s" state={BadgeState.Warning}>
|
<Badge className='mx-1' size="s" state={BadgeState.Warning}>
|
||||||
{`${originalPackageInfo.payload.version} -> ${targetPackageInfo.version}`}
|
{`${originalPackageInfo.payload.version} -> ${targetPackageInfo.version}`}
|
||||||
</Badge>
|
</Badge>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className='flex items-center justify-end gap-2 self-stretch pt-5'>
|
<div className='flex items-center justify-end gap-2 self-stretch pt-5'>
|
||||||
{uploadStep === UploadStep.notStarted && (
|
{uploadStep === UploadStep.notStarted && (
|
||||||
|
<Button
|
||||||
|
onClick={handleCancel}
|
||||||
|
>
|
||||||
|
{t('common.operation.cancel')}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
onClick={handleCancel}
|
variant='primary'
|
||||||
|
loading={uploadStep === UploadStep.upgrading}
|
||||||
|
onClick={handleConfirm}
|
||||||
|
disabled={uploadStep === UploadStep.upgrading}
|
||||||
>
|
>
|
||||||
{t('common.operation.cancel')}
|
{configBtnText}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
</div>
|
||||||
<Button
|
</>
|
||||||
variant='primary'
|
)}
|
||||||
loading={uploadStep === UploadStep.upgrading}
|
|
||||||
onClick={handleConfirm}
|
|
||||||
disabled={uploadStep === UploadStep.upgrading}
|
|
||||||
>
|
|
||||||
{configBtnText}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -141,7 +141,6 @@ const MCPDetailContent: FC<Props> = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isTriggerAuthorize)
|
if (isTriggerAuthorize)
|
||||||
handleAuthorize()
|
handleAuthorize()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
if (!detail)
|
if (!detail)
|
||||||
|
|||||||
@ -209,9 +209,9 @@ function MCPServiceCard({
|
|||||||
>
|
>
|
||||||
|
|
||||||
<div className="flex items-center justify-center gap-[1px]">
|
<div className="flex items-center justify-center gap-[1px]">
|
||||||
<RiEditLine className="h-3.5 w-3.5" />
|
<RiEditLine className="h-3.5 w-3.5" />
|
||||||
<div className="system-xs-medium px-[3px] text-text-tertiary">{serverPublished ? t('tools.mcp.server.edit') : t('tools.mcp.server.addDescription')}</div>
|
<div className="system-xs-medium px-[3px] text-text-tertiary">{serverPublished ? t('tools.mcp.server.edit') : t('tools.mcp.server.addDescription')}</div>
|
||||||
</div>
|
</div>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -70,9 +70,9 @@ export const addDefaultValue = (value: Record<string, any>, formSchemas: { varia
|
|||||||
if (formSchema.type === 'boolean' && itemValue !== undefined && itemValue !== null && itemValue !== '') {
|
if (formSchema.type === 'boolean' && itemValue !== undefined && itemValue !== null && itemValue !== '') {
|
||||||
if (typeof itemValue === 'string')
|
if (typeof itemValue === 'string')
|
||||||
newValues[formSchema.variable] = itemValue === 'true' || itemValue === '1' || itemValue === 'True'
|
newValues[formSchema.variable] = itemValue === 'true' || itemValue === '1' || itemValue === 'True'
|
||||||
else if (typeof itemValue === 'number')
|
else if (typeof itemValue === 'number')
|
||||||
newValues[formSchema.variable] = itemValue === 1
|
newValues[formSchema.variable] = itemValue === 1
|
||||||
else if (typeof itemValue === 'boolean')
|
else if (typeof itemValue === 'boolean')
|
||||||
newValues[formSchema.variable] = itemValue
|
newValues[formSchema.variable] = itemValue
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -162,13 +162,13 @@ export const getConfiguredValue = (value: Record<string, any>, formSchemas: { va
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getVarKindType = (type: FormTypeEnum) => {
|
const getVarKindType = (type: FormTypeEnum) => {
|
||||||
if (type === FormTypeEnum.file || type === FormTypeEnum.files)
|
if (type === FormTypeEnum.file || type === FormTypeEnum.files)
|
||||||
return VarKindType.variable
|
return VarKindType.variable
|
||||||
if (type === FormTypeEnum.select || type === FormTypeEnum.boolean || type === FormTypeEnum.textNumber)
|
if (type === FormTypeEnum.select || type === FormTypeEnum.boolean || type === FormTypeEnum.textNumber)
|
||||||
return VarKindType.constant
|
return VarKindType.constant
|
||||||
if (type === FormTypeEnum.textInput || type === FormTypeEnum.secretInput)
|
if (type === FormTypeEnum.textInput || type === FormTypeEnum.secretInput)
|
||||||
return VarKindType.mixed
|
return VarKindType.mixed
|
||||||
}
|
}
|
||||||
|
|
||||||
export const generateAgentToolValue = (value: Record<string, any>, formSchemas: { variable: string; default?: any; type: string }[], isReasoning = false) => {
|
export const generateAgentToolValue = (value: Record<string, any>, formSchemas: { variable: string; default?: any; type: string }[], isReasoning = false) => {
|
||||||
const newValues = {} as any
|
const newValues = {} as any
|
||||||
|
|||||||
@ -83,7 +83,6 @@ export const useWorkflowInit = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleGetInitialWorkflowData()
|
handleGetInitialWorkflowData()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const handleFetchPreloadData = useCallback(async () => {
|
const handleFetchPreloadData = useCallback(async () => {
|
||||||
|
|||||||
@ -101,7 +101,6 @@ const AllTools = ({
|
|||||||
category: PluginType.tool,
|
category: PluginType.tool,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [searchText, tags, enable_marketplace])
|
}, [searchText, tags, enable_marketplace])
|
||||||
|
|
||||||
const pluginRef = useRef<ListRef>(null)
|
const pluginRef = useRef<ListRef>(null)
|
||||||
|
|||||||
@ -60,7 +60,6 @@ const OperationDropdown: FC<Props> = ({
|
|||||||
downloadFile({ data: blob, fileName })
|
downloadFile({ data: blob, fileName })
|
||||||
setNeedDownload(false)
|
setNeedDownload(false)
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [blob])
|
}, [blob])
|
||||||
return (
|
return (
|
||||||
<PortalToFollowElem
|
<PortalToFollowElem
|
||||||
|
|||||||
@ -56,7 +56,6 @@ const List = forwardRef<ListRef, ListProps>(({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleScroll()
|
handleScroll()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [list])
|
}, [list])
|
||||||
|
|
||||||
const handleHeadClick = () => {
|
const handleHeadClick = () => {
|
||||||
|
|||||||
@ -122,7 +122,6 @@ const Tool: FC<Props> = ({
|
|||||||
}
|
}
|
||||||
if (!hasSearchText && !isFold)
|
if (!hasSearchText && !isFold)
|
||||||
setFold(true)
|
setFold(true)
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [hasSearchText])
|
}, [hasSearchText])
|
||||||
|
|
||||||
const FoldIcon = isFold ? RiArrowRightSLine : RiArrowDownSLine
|
const FoldIcon = isFold ? RiArrowRightSLine : RiArrowDownSLine
|
||||||
|
|||||||
@ -40,7 +40,6 @@ const DatasetsDetailProvider: FC<DatasetsDetailProviderProps> = ({
|
|||||||
}, [])
|
}, [])
|
||||||
if (allDatasetIds.length === 0) return
|
if (allDatasetIds.length === 0) return
|
||||||
updateDatasetsDetail(allDatasetIds)
|
updateDatasetsDetail(allDatasetIds)
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -82,26 +82,26 @@ const HeaderInRestoring = ({
|
|||||||
<RestoringTitle />
|
<RestoringTitle />
|
||||||
</div>
|
</div>
|
||||||
<div className=' flex items-center justify-end gap-x-2'>
|
<div className=' flex items-center justify-end gap-x-2'>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleRestore}
|
onClick={handleRestore}
|
||||||
disabled={!currentVersion || currentVersion.version === WorkflowVersion.Draft}
|
disabled={!currentVersion || currentVersion.version === WorkflowVersion.Draft}
|
||||||
variant='primary'
|
variant='primary'
|
||||||
className={cn(
|
className={cn(
|
||||||
theme === 'dark' && 'rounded-lg border border-black/5 bg-white/10 backdrop-blur-sm',
|
theme === 'dark' && 'rounded-lg border border-black/5 bg-white/10 backdrop-blur-sm',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{t('workflow.common.restore')}
|
{t('workflow.common.restore')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleCancelRestore}
|
onClick={handleCancelRestore}
|
||||||
className={cn(
|
className={cn(
|
||||||
'text-components-button-secondary-accent-text',
|
'text-components-button-secondary-accent-text',
|
||||||
theme === 'dark' && 'rounded-lg border border-black/5 bg-white/10 backdrop-blur-sm',
|
theme === 'dark' && 'rounded-lg border border-black/5 bg-white/10 backdrop-blur-sm',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className='flex items-center gap-x-0.5'>
|
<div className='flex items-center gap-x-0.5'>
|
||||||
<RiHistoryLine className='h-4 w-4' />
|
<RiHistoryLine className='h-4 w-4' />
|
||||||
<span className='px-0.5'>{t('workflow.common.exitVersions')}</span>
|
<span className='px-0.5'>{t('workflow.common.exitVersions')}</span>
|
||||||
</div>
|
</div>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -49,7 +49,7 @@ const VersionHistoryButton: FC<VersionHistoryButtonProps> = ({
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
handleViewVersionHistory()
|
handleViewVersionHistory()
|
||||||
},
|
},
|
||||||
{ exactMatch: true, useCapture: true })
|
{ exactMatch: true, useCapture: true })
|
||||||
|
|
||||||
return <Tooltip
|
return <Tooltip
|
||||||
popupContent={<PopupContent />}
|
popupContent={<PopupContent />}
|
||||||
@ -57,15 +57,15 @@ const VersionHistoryButton: FC<VersionHistoryButtonProps> = ({
|
|||||||
popupClassName='rounded-lg border-[0.5px] border-components-panel-border bg-components-tooltip-bg
|
popupClassName='rounded-lg border-[0.5px] border-components-panel-border bg-components-tooltip-bg
|
||||||
shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px] p-1.5'
|
shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px] p-1.5'
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
className={cn(
|
className={cn(
|
||||||
'p-2',
|
'p-2',
|
||||||
theme === 'dark' && 'rounded-lg border border-black/5 bg-white/10 backdrop-blur-sm',
|
theme === 'dark' && 'rounded-lg border border-black/5 bg-white/10 backdrop-blur-sm',
|
||||||
)}
|
)}
|
||||||
onClick={handleViewVersionHistory}
|
onClick={handleViewVersionHistory}
|
||||||
>
|
>
|
||||||
<RiHistoryLine className='h-4 w-4 text-components-button-secondary-text' />
|
<RiHistoryLine className='h-4 w-4 text-components-button-secondary-text' />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,6 @@ export const HooksStoreContextProvider = ({ children, ...restProps }: HooksStore
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (storeRef.current && d3Selection && d3Zoom)
|
if (storeRef.current && d3Selection && d3Zoom)
|
||||||
storeRef.current.getState().refreshAll(restProps)
|
storeRef.current.getState().refreshAll(restProps)
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [d3Selection, d3Zoom])
|
}, [d3Selection, d3Zoom])
|
||||||
|
|
||||||
if (!storeRef.current)
|
if (!storeRef.current)
|
||||||
|
|||||||
@ -54,9 +54,9 @@ export const useInspectVarsCrudCommon = ({
|
|||||||
if (!node)
|
if (!node)
|
||||||
return undefined
|
return undefined
|
||||||
const varId = node.vars.find((varItem) => {
|
const varId = node.vars.find((varItem) => {
|
||||||
return varItem.selector[1] === varName
|
return varItem.selector[1] === varName
|
||||||
})?.id
|
})?.id
|
||||||
return varId
|
return varId
|
||||||
}, [getNodeInspectVars])
|
}, [getNodeInspectVars])
|
||||||
|
|
||||||
const getInspectVar = useCallback((nodeId: string, name: string): VarInInspect | undefined => {
|
const getInspectVar = useCallback((nodeId: string, name: string): VarInInspect | undefined => {
|
||||||
@ -71,16 +71,16 @@ export const useInspectVarsCrudCommon = ({
|
|||||||
}, [getNodeInspectVars])
|
}, [getNodeInspectVars])
|
||||||
|
|
||||||
const hasSetInspectVar = useCallback((nodeId: string, name: string, sysVars: VarInInspect[], conversationVars: VarInInspect[]) => {
|
const hasSetInspectVar = useCallback((nodeId: string, name: string, sysVars: VarInInspect[], conversationVars: VarInInspect[]) => {
|
||||||
const isEnv = isENV([nodeId])
|
const isEnv = isENV([nodeId])
|
||||||
if (isEnv) // always have value
|
if (isEnv) // always have value
|
||||||
return true
|
return true
|
||||||
const isSys = isSystemVar([nodeId])
|
const isSys = isSystemVar([nodeId])
|
||||||
if (isSys)
|
if (isSys)
|
||||||
return sysVars.some(varItem => varItem.selector?.[1]?.replace('sys.', '') === name)
|
return sysVars.some(varItem => varItem.selector?.[1]?.replace('sys.', '') === name)
|
||||||
const isChatVar = isConversationVar([nodeId])
|
const isChatVar = isConversationVar([nodeId])
|
||||||
if (isChatVar)
|
if (isChatVar)
|
||||||
return conversationVars.some(varItem => varItem.selector?.[1] === name)
|
return conversationVars.some(varItem => varItem.selector?.[1] === name)
|
||||||
return getInspectVar(nodeId, name) !== undefined
|
return getInspectVar(nodeId, name) !== undefined
|
||||||
}, [getInspectVar])
|
}, [getInspectVar])
|
||||||
|
|
||||||
const hasNodeInspectVars = useCallback((nodeId: string) => {
|
const hasNodeInspectVars = useCallback((nodeId: string) => {
|
||||||
@ -115,23 +115,23 @@ export const useInspectVarsCrudCommon = ({
|
|||||||
} = workflowStore.getState()
|
} = workflowStore.getState()
|
||||||
const nodes = produce(nodesWithInspectVars, (draft) => {
|
const nodes = produce(nodesWithInspectVars, (draft) => {
|
||||||
const nodeInfo = allNodes.find(node => node.id === nodeId)
|
const nodeInfo = allNodes.find(node => node.id === nodeId)
|
||||||
if (nodeInfo) {
|
if (nodeInfo) {
|
||||||
const index = draft.findIndex(node => node.nodeId === nodeId)
|
const index = draft.findIndex(node => node.nodeId === nodeId)
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
draft.unshift({
|
draft.unshift({
|
||||||
nodeId,
|
nodeId,
|
||||||
nodeType: nodeInfo.data.type,
|
nodeType: nodeInfo.data.type,
|
||||||
title: nodeInfo.data.title,
|
title: nodeInfo.data.title,
|
||||||
vars: payload,
|
vars: payload,
|
||||||
nodePayload: nodeInfo.data,
|
nodePayload: nodeInfo.data,
|
||||||
})
|
})
|
||||||
}
|
|
||||||
else {
|
|
||||||
draft[index].vars = payload
|
|
||||||
// put the node to the topAdd commentMore actions
|
|
||||||
draft.unshift(draft.splice(index, 1)[0])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
draft[index].vars = payload
|
||||||
|
// put the node to the topAdd commentMore actions
|
||||||
|
draft.unshift(draft.splice(index, 1)[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
setNodesWithInspectVars(nodes)
|
setNodesWithInspectVars(nodes)
|
||||||
handleCancelNodeSuccessStatus(nodeId)
|
handleCancelNodeSuccessStatus(nodeId)
|
||||||
|
|||||||
@ -35,9 +35,9 @@ const useNodesAvailableVarList = (nodes: Node[], {
|
|||||||
hideChatVar = false,
|
hideChatVar = false,
|
||||||
passedInAvailableNodes,
|
passedInAvailableNodes,
|
||||||
}: Params = {
|
}: Params = {
|
||||||
onlyLeafNodeVar: false,
|
onlyLeafNodeVar: false,
|
||||||
filterVar: () => true,
|
filterVar: () => true,
|
||||||
}) => {
|
}) => {
|
||||||
const { getTreeLeafNodes, getBeforeNodesInSameBranchIncludeParent } = useWorkflow()
|
const { getTreeLeafNodes, getBeforeNodesInSameBranchIncludeParent } = useWorkflow()
|
||||||
const { getNodeAvailableVars } = useWorkflowVariables()
|
const { getNodeAvailableVars } = useWorkflowVariables()
|
||||||
const isChatMode = useIsChatMode()
|
const isChatMode = useIsChatMode()
|
||||||
|
|||||||
@ -68,7 +68,7 @@ export const useWorkflowNodeStarted = () => {
|
|||||||
incomeEdges.forEach((edge) => {
|
incomeEdges.forEach((edge) => {
|
||||||
const incomeNode = nodes.find(node => node.id === edge.source)!
|
const incomeNode = nodes.find(node => node.id === edge.source)!
|
||||||
if (!incomeNode || !('data' in incomeNode))
|
if (!incomeNode || !('data' in incomeNode))
|
||||||
return
|
return
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(!incomeNode.data._runningBranchId && edge.sourceHandle === 'source')
|
(!incomeNode.data._runningBranchId && edge.sourceHandle === 'source')
|
||||||
|
|||||||
@ -93,7 +93,7 @@ export type AgentStrategySelectorProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) => {
|
export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) => {
|
||||||
const { enable_marketplace } = useGlobalPublicStore(s => s.systemFeatures)
|
const { enable_marketplace } = useGlobalPublicStore(s => s.systemFeatures)
|
||||||
|
|
||||||
const { value, onChange, canChooseMCPTool } = props
|
const { value, onChange, canChooseMCPTool } = props
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
|||||||
@ -236,7 +236,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
|
|||||||
'zh-Hans': '/guides/workflow/node/agent#选择-agent-策略',
|
'zh-Hans': '/guides/workflow/node/agent#选择-agent-策略',
|
||||||
'ja-JP': '/guides/workflow/node/agent#エージェント戦略の選択',
|
'ja-JP': '/guides/workflow/node/agent#エージェント戦略の選択',
|
||||||
})}
|
})}
|
||||||
className='text-text-accent-secondary' target='_blank'>
|
className='text-text-accent-secondary' target='_blank'>
|
||||||
{t('workflow.nodes.agent.learnMore')}
|
{t('workflow.nodes.agent.learnMore')}
|
||||||
</Link>
|
</Link>
|
||||||
</div>}
|
</div>}
|
||||||
|
|||||||
@ -193,10 +193,10 @@ const FormItem: FC<Props> = ({
|
|||||||
language={CodeLanguage.json}
|
language={CodeLanguage.json}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
noWrapper
|
noWrapper
|
||||||
className='bg h-[80px] overflow-y-auto rounded-[10px] bg-components-input-bg-normal p-1'
|
className='bg h-[80px] overflow-y-auto rounded-[10px] bg-components-input-bg-normal p-1'
|
||||||
placeholder={
|
placeholder={
|
||||||
<div className='whitespace-pre'>{payload.json_schema}</div>
|
<div className='whitespace-pre'>{payload.json_schema}</div>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{(type === InputVarType.singleFile) && (
|
{(type === InputVarType.singleFile) && (
|
||||||
|
|||||||
@ -53,7 +53,6 @@ const Editor: FC<Props> = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onFocusChange?.(isFocus)
|
onFocusChange?.(isFocus)
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [isFocus])
|
}, [isFocus])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -11,7 +11,7 @@ const McpToolNotSupportTooltip: FC = () => {
|
|||||||
<Tooltip
|
<Tooltip
|
||||||
popupContent={
|
popupContent={
|
||||||
<div className='w-[256px]'>
|
<div className='w-[256px]'>
|
||||||
{t('plugin.detailPanel.toolSelector.unsupportedMCPTool')}
|
{t('plugin.detailPanel.toolSelector.unsupportedMCPTool')}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -694,9 +694,9 @@ const getIterationItemType = ({
|
|||||||
curr = Array.isArray(curr) ? curr.find(v => v.variable === key) : []
|
curr = Array.isArray(curr) ? curr.find(v => v.variable === key) : []
|
||||||
|
|
||||||
if (isLast)
|
if (isLast)
|
||||||
arrayType = curr?.type
|
arrayType = curr?.type
|
||||||
else if (curr?.type === VarType.object || curr?.type === VarType.file)
|
else if (curr?.type === VarType.object || curr?.type === VarType.file)
|
||||||
curr = curr.children || []
|
curr = curr.children || []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,11 +55,11 @@ const VarList: FC<Props> = ({
|
|||||||
const { isValid, errorKey, errorMessageKey } = checkKeys([newKey], true)
|
const { isValid, errorKey, errorMessageKey } = checkKeys([newKey], true)
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
setToastHandle(Toast.notify({
|
setToastHandle(Toast.notify({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }),
|
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }),
|
||||||
}))
|
}))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (list.some(item => item.variable?.trim() === newKey.trim())) {
|
if (list.some(item => item.variable?.trim() === newKey.trim())) {
|
||||||
console.log('new key', newKey.trim())
|
console.log('new key', newKey.trim())
|
||||||
setToastHandle(Toast.notify({
|
setToastHandle(Toast.notify({
|
||||||
|
|||||||
@ -339,7 +339,7 @@ const VarReferencePicker: FC<Props> = ({
|
|||||||
const data = await fetchDynamicOptions()
|
const data = await fetchDynamicOptions()
|
||||||
setDynamicOptions(data?.options || [])
|
setDynamicOptions(data?.options || [])
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -250,7 +250,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
|||||||
|
|
||||||
if(logParams.showSpecialResultPanel) {
|
if(logParams.showSpecialResultPanel) {
|
||||||
return (
|
return (
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
'relative mr-1 h-full',
|
'relative mr-1 h-full',
|
||||||
)}>
|
)}>
|
||||||
<div
|
<div
|
||||||
@ -356,7 +356,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
|||||||
>
|
>
|
||||||
{
|
{
|
||||||
isSingleRunning ? <Stop className='h-4 w-4 text-text-tertiary' />
|
isSingleRunning ? <Stop className='h-4 w-4 text-text-tertiary' />
|
||||||
: <RiPlayLargeLine className='h-4 w-4 text-text-tertiary' />
|
: <RiPlayLargeLine className='h-4 w-4 text-text-tertiary' />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
@ -79,11 +79,11 @@ const LastRun: FC<Props> = ({
|
|||||||
}, [nodeId])
|
}, [nodeId])
|
||||||
|
|
||||||
const handlePageVisibilityChange = useCallback(() => {
|
const handlePageVisibilityChange = useCallback(() => {
|
||||||
if (document.visibilityState === 'hidden')
|
if (document.visibilityState === 'hidden')
|
||||||
setPageHasHide(true)
|
setPageHasHide(true)
|
||||||
else
|
else
|
||||||
setPageShowed(true)
|
setPageShowed(true)
|
||||||
}, [])
|
}, [])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.addEventListener('visibilitychange', handlePageVisibilityChange)
|
document.addEventListener('visibilitychange', handlePageVisibilityChange)
|
||||||
|
|
||||||
|
|||||||
@ -118,8 +118,8 @@ function useOutputVarList<T>({
|
|||||||
const [removedVar, setRemovedVar] = useState<ValueSelector>([])
|
const [removedVar, setRemovedVar] = useState<ValueSelector>([])
|
||||||
const removeVarInNode = useCallback(() => {
|
const removeVarInNode = useCallback(() => {
|
||||||
const varId = nodesWithInspectVars.find(node => node.nodeId === id)?.vars.find((varItem) => {
|
const varId = nodesWithInspectVars.find(node => node.nodeId === id)?.vars.find((varItem) => {
|
||||||
return varItem.name === removedVar[1]
|
return varItem.name === removedVar[1]
|
||||||
})?.id
|
})?.id
|
||||||
if(varId)
|
if(varId)
|
||||||
deleteInspectVar(id, varId)
|
deleteInspectVar(id, varId)
|
||||||
removeUsedVarInNodes(removedVar)
|
removeUsedVarInNodes(removedVar)
|
||||||
@ -143,8 +143,8 @@ function useOutputVarList<T>({
|
|||||||
setInputs(newInputs)
|
setInputs(newInputs)
|
||||||
onOutputKeyOrdersChange(outputKeyOrders.filter((_, i) => i !== index))
|
onOutputKeyOrdersChange(outputKeyOrders.filter((_, i) => i !== index))
|
||||||
const varId = nodesWithInspectVars.find(node => node.nodeId === id)?.vars.find((varItem) => {
|
const varId = nodesWithInspectVars.find(node => node.nodeId === id)?.vars.find((varItem) => {
|
||||||
return varItem.name === key
|
return varItem.name === key
|
||||||
})?.id
|
})?.id
|
||||||
if(varId)
|
if(varId)
|
||||||
deleteInspectVar(id, varId)
|
deleteInspectVar(id, varId)
|
||||||
}, [outputKeyOrders, isVarUsedInNodes, id, inputs, setInputs, onOutputKeyOrdersChange, nodesWithInspectVars, deleteInspectVar, showRemoveVarConfirm, varKey])
|
}, [outputKeyOrders, isVarUsedInNodes, id, inputs, setInputs, onOutputKeyOrdersChange, nodesWithInspectVars, deleteInspectVar, showRemoveVarConfirm, varKey])
|
||||||
|
|||||||
@ -45,10 +45,10 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
|
|||||||
const resetEditor = useStore(s => s.setControlPromptEditorRerenderKey)
|
const resetEditor = useStore(s => s.setControlPromptEditorRerenderKey)
|
||||||
return <div className='my-2'>
|
return <div className='my-2'>
|
||||||
<Field
|
<Field
|
||||||
required
|
required
|
||||||
title={t('workflow.nodes.agent.strategy.label')}
|
title={t('workflow.nodes.agent.strategy.label')}
|
||||||
className='px-4 py-2'
|
className='px-4 py-2'
|
||||||
tooltip={t('workflow.nodes.agent.strategy.tooltip')} >
|
tooltip={t('workflow.nodes.agent.strategy.tooltip')} >
|
||||||
<AgentStrategy
|
<AgentStrategy
|
||||||
strategy={inputs.agent_strategy_name ? {
|
strategy={inputs.agent_strategy_name ? {
|
||||||
agent_strategy_provider_name: inputs.agent_strategy_provider_name!,
|
agent_strategy_provider_name: inputs.agent_strategy_provider_name!,
|
||||||
|
|||||||
@ -76,7 +76,7 @@ const useSingleRunFormParams = ({
|
|||||||
return formatTracing([runResult], t)[0]
|
return formatTracing([runResult], t)[0]
|
||||||
}, [runResult, t])
|
}, [runResult, t])
|
||||||
|
|
||||||
const getDependentVars = () => {
|
const getDependentVars = () => {
|
||||||
return varInputs.map((item) => {
|
return varInputs.map((item) => {
|
||||||
// Guard against null/undefined variable to prevent app crash
|
// Guard against null/undefined variable to prevent app crash
|
||||||
if (!item.variable || typeof item.variable !== 'string')
|
if (!item.variable || typeof item.variable !== 'string')
|
||||||
|
|||||||
@ -69,7 +69,7 @@ const VarList: FC<Props> = ({
|
|||||||
if (item.value === WriteMode.set || item.value === WriteMode.increment || item.value === WriteMode.decrement
|
if (item.value === WriteMode.set || item.value === WriteMode.increment || item.value === WriteMode.decrement
|
||||||
|| item.value === WriteMode.multiply || item.value === WriteMode.divide) {
|
|| item.value === WriteMode.multiply || item.value === WriteMode.divide) {
|
||||||
if(varType === VarType.boolean)
|
if(varType === VarType.boolean)
|
||||||
draft[index].value = false
|
draft[index].value = false
|
||||||
draft[index].input_type = AssignerNodeInputType.constant
|
draft[index].input_type = AssignerNodeInputType.constant
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@ -31,8 +31,6 @@ const useKeyValueList = (value: string, onChange: (value: string) => void, noFil
|
|||||||
const newValue = list.filter(item => item.key && item.value).map(item => `${item.key}:${item.value}`).join('\n')
|
const newValue = list.filter(item => item.key && item.value).map(item => `${item.key}:${item.value}`).join('\n')
|
||||||
if (newValue !== value)
|
if (newValue !== value)
|
||||||
onChange(newValue)
|
onChange(newValue)
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [list, noFilter])
|
}, [list, noFilter])
|
||||||
const addItem = useCallback(() => {
|
const addItem = useCallback(() => {
|
||||||
setList([...list, {
|
setList([...list, {
|
||||||
|
|||||||
@ -51,7 +51,6 @@ const useConfig = (id: string, payload: HttpNodeType) => {
|
|||||||
setInputs(newInputs)
|
setInputs(newInputs)
|
||||||
setIsDataReady(true)
|
setIsDataReady(true)
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [defaultConfig])
|
}, [defaultConfig])
|
||||||
|
|
||||||
const handleMethodChange = useCallback((method: Method) => {
|
const handleMethodChange = useCallback((method: Method) => {
|
||||||
|
|||||||
@ -31,7 +31,6 @@ const MetadataTrigger = ({
|
|||||||
handleRemoveCondition(condition.id)
|
handleRemoveCondition(condition.id)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [metadataList, handleRemoveCondition, selectedDatasetsLoaded])
|
}, [metadataList, handleRemoveCondition, selectedDatasetsLoaded])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -172,7 +172,6 @@ const useConfig = (id: string, payload: KnowledgeRetrievalNodeType) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
setInputs(newInput)
|
setInputs(newInput)
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [currentProvider?.provider, currentModel, currentRerankModel, rerankDefaultModel])
|
}, [currentProvider?.provider, currentModel, currentRerankModel, rerankDefaultModel])
|
||||||
const [selectedDatasets, setSelectedDatasets] = useState<DataSet[]>([])
|
const [selectedDatasets, setSelectedDatasets] = useState<DataSet[]>([])
|
||||||
const [rerankModelOpen, setRerankModelOpen] = useState(false)
|
const [rerankModelOpen, setRerankModelOpen] = useState(false)
|
||||||
@ -229,7 +228,6 @@ const useConfig = (id: string, payload: KnowledgeRetrievalNodeType) => {
|
|||||||
setInputs(newInputs)
|
setInputs(newInputs)
|
||||||
setSelectedDatasetsLoaded(true)
|
setSelectedDatasetsLoaded(true)
|
||||||
})()
|
})()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -241,7 +239,6 @@ const useConfig = (id: string, payload: KnowledgeRetrievalNodeType) => {
|
|||||||
setInputs(produce(inputs, (draft) => {
|
setInputs(produce(inputs, (draft) => {
|
||||||
draft.query_variable_selector = query_variable_selector
|
draft.query_variable_selector = query_variable_selector
|
||||||
}))
|
}))
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const handleOnDatasetsChange = useCallback((newDatasets: DataSet[]) => {
|
const handleOnDatasetsChange = useCallback((newDatasets: DataSet[]) => {
|
||||||
|
|||||||
@ -34,7 +34,6 @@ const JsonImporter: FC<JsonImporterProps> = ({
|
|||||||
const rect = importBtnRef.current.getBoundingClientRect()
|
const rect = importBtnRef.current.getBoundingClientRect()
|
||||||
updateBtnWidth(rect.width)
|
updateBtnWidth(rect.width)
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const handleTrigger = useCallback((e: React.MouseEvent<HTMLElement, MouseEvent>) => {
|
const handleTrigger = useCallback((e: React.MouseEvent<HTMLElement, MouseEvent>) => {
|
||||||
|
|||||||
@ -155,7 +155,6 @@ const useConfig = (id: string, payload: ParameterExtractorNodeType) => {
|
|||||||
return
|
return
|
||||||
setModelChanged(false)
|
setModelChanged(false)
|
||||||
handleVisionConfigAfterModelChanged()
|
handleVisionConfigAfterModelChanged()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [isVisionModel, modelChanged])
|
}, [isVisionModel, modelChanged])
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user