mirror of
https://github.com/langgenius/dify.git
synced 2026-01-07 23:04:12 +00:00
chore: http node check
This commit is contained in:
@@ -29,15 +29,17 @@ const nodeDefault: NodeDefault<HttpNodeType> = {
|
||||
const nodes = isChatMode ? ALL_CHAT_AVAILABLE_BLOCKS : ALL_COMPLETION_AVAILABLE_BLOCKS
|
||||
return nodes
|
||||
},
|
||||
checkValid(payload: HttpNodeType) {
|
||||
let isValid = true
|
||||
checkValid(payload: HttpNodeType, t: any) {
|
||||
let errorMessages = ''
|
||||
if (payload.type) {
|
||||
isValid = true
|
||||
errorMessages = ''
|
||||
}
|
||||
|
||||
if (!errorMessages && !payload.url)
|
||||
errorMessages = t('workflow.errorMsg.fieldRequired', { field: t('workflow.nodes.http.api') })
|
||||
|
||||
if (!errorMessages && !payload.url.startsWith('http://') && !payload.url.startsWith('https://'))
|
||||
errorMessages = t('workflow.nodes.http.notStartWithHttp')
|
||||
|
||||
return {
|
||||
isValid,
|
||||
isValid: !errorMessages,
|
||||
errorMessage: errorMessages,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -203,6 +203,7 @@ const translation = {
|
||||
http: {
|
||||
inputVars: 'Input Variables',
|
||||
api: 'API',
|
||||
notStartWithHttp: 'API should start with http:// or https://',
|
||||
key: 'Key',
|
||||
value: 'Value',
|
||||
bulkEdit: 'Bulk Edit',
|
||||
|
||||
@@ -203,6 +203,7 @@ const translation = {
|
||||
http: {
|
||||
inputVars: '输入变量',
|
||||
api: 'API',
|
||||
notStartWithHttp: 'API 应该以 http:// 或 https:// 开头',
|
||||
key: '键',
|
||||
value: '值',
|
||||
bulkEdit: '批量编辑',
|
||||
|
||||
Reference in New Issue
Block a user