Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
3f72f885
authored
Nov 14, 2024
by
Archer
Committed by
GitHub
Nov 14, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: doc2x plugins (#3162)
parent
be59c2f6
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
125 additions
and
252 deletions
+125
-252
packages/plugins/register.ts
+0
-4
packages/plugins/src/Doc2X/PDF2text/index.ts
+74
-99
packages/plugins/src/Doc2X/PDF2text/template.json
+30
-134
packages/service/core/workflow/dispatch/tools/http468.ts
+2
-2
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodePluginIO/InputEditModal.tsx
+1
-0
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodePluginIO/InputTypeConfig.tsx
+2
-10
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/NodeCard.tsx
+10
-0
projects/app/src/service/common/system/volumnMongoWatch.ts
+1
-1
projects/app/src/service/core/app/plugin.ts
+2
-0
projects/app/src/service/mongo.ts
+3
-2
No files found.
packages/plugins/register.ts
View file @
3f72f885
...
@@ -87,7 +87,3 @@ export const getCommunityCb = async () => {
...
@@ -87,7 +87,3 @@ export const getCommunityCb = async () => {
{}
{}
);
);
};
};
export
const
getSystemPluginCb
=
async
()
=>
{
return
global
.
systemPluginCb
;
};
packages/plugins/src/Doc2X/PDF2text/index.ts
View file @
3f72f885
import
{
delay
}
from
'@fastgpt/global/common/system/utils'
;
import
{
delay
}
from
'@fastgpt/global/common/system/utils'
;
import
axios
from
'axios'
;
import
axios
from
'axios'
;
import
{
addLog
}
from
'@fastgpt/service/common/system/log'
;
import
{
getErrText
}
from
'@fastgpt/global/common/error/utils'
;
import
{
result
}
from
'lodash'
;
type
Props
=
{
type
Props
=
{
apikey
:
string
;
apikey
:
string
;
files
:
any
;
files
:
string
[];
ocr
:
boolean
;
};
};
// Response type same as HTTP outputs
// Response type same as HTTP outputs
type
Response
=
Promise
<
{
type
Response
=
Promise
<
{
result
:
string
;
result
:
string
;
failreason
:
string
;
success
:
boolean
;
success
:
boolean
;
error
?:
Record
<
string
,
any
>
;
}
>
;
}
>
;
const
main
=
async
({
apikey
,
files
}:
Props
):
Response
=>
{
const
main
=
async
({
apikey
,
files
}:
Props
):
Response
=>
{
// Check the apikey
// Check the apikey
if
(
!
apikey
)
{
if
(
!
apikey
)
{
return
{
return
Promise
.
reject
(
`API key is required`
);
result
:
''
,
failreason
:
`API key is required`
,
success
:
false
};
}
let
final_result
=
''
;
let
fail_reason
=
''
;
let
flag
=
false
;
//Convert the String to Array<String> or String
let
All_URL
:
Array
<
string
>
;
try
{
const
parsed
=
JSON
.
parse
(
files
);
if
(
Array
.
isArray
(
parsed
))
{
All_URL
=
parsed
;
}
else
{
All_URL
=
[
String
(
parsed
)];
}
}
catch
(
e
)
{
// Set it as String
All_URL
=
[
String
(
files
)];
}
}
const
successResult
=
[];
const
failedResult
=
[];
const
axiosInstance
=
axios
.
create
({
const
axiosInstance
=
axios
.
create
({
timeout
:
30000
// 30 seconds timeout
timeout
:
30000
// 30 seconds timeout
});
});
//Process each file one by one
//Process each file one by one
for
await
(
const
url
of
All_URL
)
{
for
await
(
const
url
of
files
)
{
//Fetch the pdf and check its content type
let
PDFResponse
;
try
{
try
{
PDFResponse
=
await
axiosInstance
.
get
(
url
,
{
responseType
:
'arraybuffer'
});
//Fetch the pdf and check its content type
}
catch
(
e
)
{
const
PDFResponse
=
await
axiosInstance
.
get
(
url
,
{
responseType
:
'arraybuffer'
});
fail_reason
+=
`\n---\nFile:
${
url
}
\n<Content>\nFailed to fetch image from URL:
${
e
}
\n</Content>\n`
;
flag
=
true
;
continue
;
}
if
(
PDFResponse
.
status
!==
200
)
{
if
(
PDFResponse
.
status
!==
200
)
{
fail_reason
+=
`\n---\nFile:
${
url
}
\n<Content>\nFailed to fetch PDF from URL:
${
PDFResponse
.
statusText
}
\n</Content>\n`
;
throw
new
Error
(
flag
=
true
;
`File:
${
url
}
\n<Content>\nFailed to fetch PDF from URL:
${
PDFResponse
.
statusText
}
\n</Content>`
continue
;
)
;
}
}
const
contentType
=
PDFResponse
.
headers
[
'content-type'
];
const
contentType
=
PDFResponse
.
headers
[
'content-type'
];
const
file_name
=
url
.
match
(
/read
\/([^
?
]
+
)
/
)?.[
1
]
||
'unknown.pdf'
;
const
file_name
=
url
.
match
(
/read
\/([^
?
]
+
)
/
)?.[
1
]
||
'unknown.pdf'
;
if
(
!
contentType
||
!
contentType
.
startsWith
(
'application/pdf'
))
{
if
(
!
contentType
||
!
contentType
.
startsWith
(
'application/pdf'
))
{
fail_reason
+=
`\n---\nFile:
${
file_name
}
\n<Content>\nThe provided file does not point to a PDF:
${
contentType
}
\n</Content>\n`
;
throw
new
Error
(
flag
=
true
;
`File:
${
file_name
}
\n<Content>\nThe provided file does not point to a PDF:
${
contentType
}
\n</Content>`
continue
;
)
;
}
}
const
blob
=
new
Blob
([
PDFResponse
.
data
],
{
type
:
'application/pdf'
});
const
blob
=
new
Blob
([
PDFResponse
.
data
],
{
type
:
'application/pdf'
});
// Get pre-upload URL first
// Get pre-upload URL first
let
preupload_url
=
'https://v2.doc2x.noedgeai.com/api/v2/parse/preupload'
;
const
preupload_response
=
await
axiosInstance
.
post
(
let
preupload_response
;
'https://v2.doc2x.noedgeai.com/api/v2/parse/preupload'
,
try
{
null
,
preupload_response
=
await
axiosInstance
.
post
(
preupload_url
,
null
,
{
{
headers
:
{
headers
:
{
Authorization
:
`Bearer
${
apikey
}
`
Authorization
:
`Bearer
${
apikey
}
`
}
}
});
}
catch
(
e
)
{
fail_reason
+=
`\n---\nFile:
${
file_name
}
\n<Content>\nFailed to get pre-upload URL:
${
e
}
\n</Content>\n`
;
flag
=
true
;
continue
;
}
}
);
if
(
preupload_response
.
status
!==
200
)
{
if
(
preupload_response
.
status
!==
200
)
{
fail_reason
+=
`\n---\nFile:
${
file_name
}
\n<Content>\nFailed to get pre-upload URL:
${
preupload_response
.
statusText
}
\n</Content>\n`
;
throw
new
Error
(
flag
=
true
;
`File:
${
file_name
}
\n<Content>\nFailed to get pre-upload URL:
${
preupload_response
.
statusText
}
\n</Content>`
continue
;
)
;
}
}
const
preupload_data
=
preupload_response
.
data
;
const
preupload_data
=
preupload_response
.
data
;
if
(
preupload_data
.
code
!==
'success'
)
{
if
(
preupload_data
.
code
!==
'success'
)
{
fail_reason
+=
`\n---\nFile:
${
file_name
}
\n<Content>\nFailed to get pre-upload URL:
${
JSON
.
stringify
(
preupload_data
)}
\n</Content>\n`
;
throw
new
Error
(
flag
=
true
;
`File:
${
file_name
}
\n<Content>\nFailed to get pre-upload URL:
${
JSON
.
stringify
(
preupload_data
)}
\n</Content>`
continue
;
)
;
}
}
const
upload_url
=
preupload_data
.
data
.
url
;
const
upload_url
=
preupload_data
.
data
.
url
;
const
uid
=
preupload_data
.
data
.
uid
;
const
uid
=
preupload_data
.
data
.
uid
;
// Upload file to pre-signed URL with binary stream
// Upload file to pre-signed URL with binary stream
try
{
const
response
=
await
axiosInstance
.
put
(
upload_url
,
blob
,
{
const
response
=
await
axiosInstance
.
put
(
upload_url
,
blob
,
{
headers
:
{
headers
:
{
'Content-Type'
:
'application/pdf'
'Content-Type'
:
'application/pdf'
...
@@ -111,71 +82,75 @@ const main = async ({ apikey, files }: Props): Response => {
...
@@ -111,71 +82,75 @@ const main = async ({ apikey, files }: Props): Response => {
if
(
response
.
status
!==
200
)
{
if
(
response
.
status
!==
200
)
{
throw
new
Error
(
`Upload failed with status
${
response
.
status
}
:
${
response
.
statusText
}
`
);
throw
new
Error
(
`Upload failed with status
${
response
.
status
}
:
${
response
.
statusText
}
`
);
}
}
}
catch
(
e
)
{
fail_reason
+=
`\n---\nFile:
${
file_name
}
\n<Content>\nFailed to upload file (uid:
${
uid
}
):
${
e
}
\n</Content>\n`
;
flag
=
true
;
continue
;
}
// Get the result by uid
// Get the result by uid
const
result_url
=
`https://v2.doc2x.noedgeai.com/api/v2/parse/status?uid=
${
uid
}
`
;
let
required_flag
=
true
;
let
result
=
''
;
// Wait for the result, at most 90s
// Wait for the result, at most 90s
const
maxAttempts
=
30
;
const
checkResult
=
async
(
retry
=
30
)
=>
{
for
await
(
const
_
of
Array
(
maxAttempts
).
keys
())
{
if
(
retry
<=
0
)
let
result_response
;
return
Promise
.
reject
(
`File:
${
file_name
}
\n<Content>\nFailed to get result (uid:
${
uid
}
): Get result timeout\n</Content>`
);
try
{
try
{
result_response
=
await
axiosInstance
.
get
(
result_url
,
{
const
result_response
=
await
axiosInstance
.
get
(
`https://v2.doc2x.noedgeai.com/api/v2/parse/status?uid=
${
uid
}
`
,
{
headers
:
{
headers
:
{
Authorization
:
`Bearer
${
apikey
}
`
Authorization
:
`Bearer
${
apikey
}
`
}
}
});
}
catch
(
e
)
{
fail_reason
+=
`\n---\nFile:
${
file_name
}
\n<Content>\nFailed to get result (uid:
${
uid
}
):
${
e
}
\n</Content>\n`
;
flag
=
true
;
required_flag
=
false
;
break
;
}
}
);
const
result_data
=
result_response
.
data
;
const
result_data
=
result_response
.
data
;
if
(
!
[
'ok'
,
'success'
].
includes
(
result_data
.
code
))
{
if
(
!
[
'ok'
,
'success'
].
includes
(
result_data
.
code
))
{
fail_reason
+=
`\n---\nFile:
${
file_name
}
\n<Content>\nFailed to get result (uid:
${
uid
}
):
${
JSON
.
stringify
(
result_data
)}
\n</Content>\n`
;
return
Promise
.
reject
(
flag
=
true
;
`File:
${
file_name
}
\n<Content>\nFailed to get result (uid:
${
uid
}
):
${
JSON
.
stringify
(
result_data
)}
\n</Content>`
required_flag
=
false
;
);
break
;
}
}
if
([
'ready'
,
'processing'
].
includes
(
result_data
.
data
.
status
))
{
if
([
'ready'
,
'processing'
].
includes
(
result_data
.
data
.
status
))
{
await
delay
(
3000
);
await
delay
(
3000
);
}
else
if
(
result_data
.
data
.
status
===
'success'
)
{
return
checkResult
(
retry
-
1
);
result
=
await
Promise
.
all
(
}
if
(
result_data
.
data
.
status
===
'success'
)
{
const
result
=
(
await
Promise
.
all
(
result_data
.
data
.
result
.
pages
.
map
((
page
:
{
md
:
any
})
=>
page
.
md
)
result_data
.
data
.
result
.
pages
.
map
((
page
:
{
md
:
any
})
=>
page
.
md
)
).
then
((
pages
)
=>
pages
.
join
(
'\n'
));
).
then
((
pages
)
=>
pages
.
join
(
'\n'
))
)
// Do some post-processing
// Do some post-processing
result
=
result
.
replace
(
/
\\[\(\)]
/g
,
'$'
).
replace
(
/
\\[\[\]]
/g
,
'$$'
);
.
replace
(
/
\\[\(\)]
/g
,
'$'
)
result
=
result
.
replace
(
/<img
\s
+src="
([^
"
]
+
)
"
(?:\s
*
\?[^
>
]
*
)?(?:\s
*
\/
>|>
)
/g
,
''
);
.
replace
(
/
\\[\[\]]
/g
,
'$$'
)
final_result
+=
`\n---\nFile:
${
file_name
}
\n<Content>\n
${
result
}
\n</Content>\n`
;
.
replace
(
/<img
\s
+src="
([^
"
]
+
)
"
(?:\s
*
\?[^
>
]
*
)?(?:\s
*
\/
>|>
)
/g
,
''
);
required_flag
=
false
;
break
;
return
`File:
${
file_name
}
\n<Content>\n
${
result
}
\n</Content>`
;
}
else
{
fail_reason
+=
`\n---\nFile:
${
file_name
}
\n<Content>\nFailed to get result (uid:
${
uid
}
):
${
result_data
.
data
.
status
}
\n</Content>\n`
;
flag
=
true
;
required_flag
=
false
;
break
;
}
}
await
delay
(
100
);
return
checkResult
(
retry
-
1
);
}
catch
(
error
)
{
await
delay
(
100
);
return
checkResult
(
retry
-
1
);
}
}
};
if
(
required_flag
)
{
const
result
=
await
checkResult
();
fail_reason
+=
`\n---\nFile:
${
file_name
}
\n<Content>\nTimeout for uid
${
uid
}
\n</Content>\n`
;
successResult
.
push
(
result
);
flag
=
true
;
}
catch
(
error
)
{
failedResult
.
push
(
`File:
${
url
}
\n<Content>\nFailed to fetch image from URL:
${
getErrText
(
error
)}
\n</Content>`
);
}
}
}
}
return
{
return
{
result
:
final_result
,
result
:
successResult
.
join
(
'\n******\n'
),
failreason
:
fail_reason
,
error
:
{
success
:
!
flag
message
:
failedResult
.
join
(
'\n******\n'
)
},
success
:
failedResult
.
length
===
0
};
};
};
};
...
...
packages/plugins/src/Doc2X/PDF2text/template.json
View file @
3f72f885
{
{
"author"
:
"Menghuan1918"
,
"author"
:
"Menghuan1918"
,
"version"
:
"488"
,
"version"
:
"488"
,
"name"
:
"
Doc2X
PDF识别"
,
"name"
:
"PDF识别"
,
"avatar"
:
"plugins/doc2x"
,
"avatar"
:
"plugins/doc2x"
,
"intro"
:
"将PDF文件发送至Doc2X进行解析,返回结构化的LaTeX公式的文本(markdown),支持传入String类型的URL或者流程输出中的文件链接变量"
,
"intro"
:
"将PDF文件发送至Doc2X进行解析,返回结构化的LaTeX公式的文本(markdown),支持传入String类型的URL或者流程输出中的文件链接变量"
,
"
inputExplanation
Url"
:
"https://fael3z0zfze.feishu.cn/wiki/Rkc5witXWiJoi5kORd2cofh6nDg?fromScene=spaceOverview"
,
"
course
Url"
:
"https://fael3z0zfze.feishu.cn/wiki/Rkc5witXWiJoi5kORd2cofh6nDg?fromScene=spaceOverview"
,
"showStatus"
:
true
,
"showStatus"
:
true
,
"weight"
:
10
,
"weight"
:
10
,
...
@@ -21,8 +21,8 @@
...
@@ -21,8 +21,8 @@
"flowNodeType"
:
"pluginInput"
,
"flowNodeType"
:
"pluginInput"
,
"showStatus"
:
false
,
"showStatus"
:
false
,
"position"
:
{
"position"
:
{
"x"
:
-13
9.66495007440972
,
"x"
:
-13
7.96875104510553
,
"y"
:
-90.9968973555371
2
"y"
:
-90.9968973555371
},
},
"version"
:
"481"
,
"version"
:
"481"
,
"inputs"
:
[
"inputs"
:
[
...
@@ -39,16 +39,19 @@
...
@@ -39,16 +39,19 @@
"list"
:
[]
"list"
:
[]
},
},
{
{
"renderTypeList"
:
[
"
reference
"
],
"renderTypeList"
:
[
"
fileSelect
"
],
"selectedTypeIndex"
:
0
,
"selectedTypeIndex"
:
0
,
"valueType"
:
"a
ny
"
,
"valueType"
:
"a
rrayString
"
,
"canEdit"
:
true
,
"canEdit"
:
true
,
"key"
:
"files"
,
"key"
:
"files"
,
"label"
:
"files"
,
"label"
:
"files"
,
"description"
:
"
待处理的PDF文件变量或URL
地址"
,
"description"
:
"
需要处理的PDF
地址"
,
"required"
:
true
,
"required"
:
true
,
"toolDescription"
:
"待处理的PDF文件变量或URL地址"
,
"list"
:
[],
"list"
:
[]
"canSelectFile"
:
true
,
"canSelectImg"
:
false
,
"maxFiles"
:
14
,
"defaultValue"
:
""
}
}
],
],
"outputs"
:
[
"outputs"
:
[
...
@@ -61,7 +64,7 @@
...
@@ -61,7 +64,7 @@
},
},
{
{
"id"
:
"url"
,
"id"
:
"url"
,
"valueType"
:
"a
ny
"
,
"valueType"
:
"a
rrayString
"
,
"key"
:
"files"
,
"key"
:
"files"
,
"label"
:
"files"
,
"label"
:
"files"
,
"type"
:
"hidden"
"type"
:
"hidden"
...
@@ -76,8 +79,8 @@
...
@@ -76,8 +79,8 @@
"flowNodeType"
:
"pluginOutput"
,
"flowNodeType"
:
"pluginOutput"
,
"showStatus"
:
false
,
"showStatus"
:
false
,
"position"
:
{
"position"
:
{
"x"
:
1
808.5347800638815
,
"x"
:
1
505.494975310334
,
"y"
:
-
105.67504356429907
"y"
:
-
4.14668564643415
},
},
"version"
:
"481"
,
"version"
:
"481"
,
"inputs"
:
[
"inputs"
:
[
...
@@ -92,12 +95,13 @@
...
@@ -92,12 +95,13 @@
},
},
{
{
"renderTypeList"
:
[
"reference"
],
"renderTypeList"
:
[
"reference"
],
"valueType"
:
"
string
"
,
"valueType"
:
"
object
"
,
"canEdit"
:
true
,
"canEdit"
:
true
,
"key"
:
"failreason"
,
"key"
:
"error"
,
"label"
:
"failreason"
,
"label"
:
"error"
,
"description"
:
"文件处理失败原因,由文件名以及报错组成,多个文件之间由横线分隔开,如所有文件处理成功则为空"
,
"description"
:
""
,
"value"
:
[
"zHG5jJBkXmjB"
,
"yDxzW5CFalGw"
]
"value"
:
[
"zHG5jJBkXmjB"
,
"httpRawResponse"
],
"isToolOutput"
:
true
},
},
{
{
"renderTypeList"
:
[
"reference"
],
"renderTypeList"
:
[
"reference"
],
...
@@ -106,7 +110,8 @@
...
@@ -106,7 +110,8 @@
"key"
:
"success"
,
"key"
:
"success"
,
"label"
:
"success"
,
"label"
:
"success"
,
"description"
:
"是否全部文件都处理成功,如有没有处理成功的文件,失败原因将会输出在failreason中"
,
"description"
:
"是否全部文件都处理成功,如有没有处理成功的文件,失败原因将会输出在failreason中"
,
"value"
:
[
"zHG5jJBkXmjB"
,
"m6CJJj7GFud5"
]
"value"
:
[
"zHG5jJBkXmjB"
,
"m6CJJj7GFud5"
],
"isToolOutput"
:
false
}
}
],
],
"outputs"
:
[]
"outputs"
:
[]
...
@@ -119,8 +124,8 @@
...
@@ -119,8 +124,8 @@
"flowNodeType"
:
"httpRequest468"
,
"flowNodeType"
:
"httpRequest468"
,
"showStatus"
:
true
,
"showStatus"
:
true
,
"position"
:
{
"position"
:
{
"x"
:
1077.798674089277
7
,
"x"
:
619.066193330823
7
,
"y"
:
-4
96.9521622173004
"y"
:
-4
72.91377894611503
},
},
"version"
:
"481"
,
"version"
:
"481"
,
"inputs"
:
[
"inputs"
:
[
...
@@ -170,7 +175,7 @@
...
@@ -170,7 +175,7 @@
"renderTypeList"
:
[
"custom"
],
"renderTypeList"
:
[
"custom"
],
"valueType"
:
"number"
,
"valueType"
:
"number"
,
"label"
:
""
,
"label"
:
""
,
"value"
:
30
,
"value"
:
30
0
,
"min"
:
5
,
"min"
:
5
,
"max"
:
600
,
"max"
:
600
,
"required"
:
true
,
"required"
:
true
,
...
@@ -215,7 +220,7 @@
...
@@ -215,7 +220,7 @@
"key"
:
"system_httpJsonBody"
,
"key"
:
"system_httpJsonBody"
,
"renderTypeList"
:
[
"hidden"
],
"renderTypeList"
:
[
"hidden"
],
"valueType"
:
"any"
,
"valueType"
:
"any"
,
"value"
:
"{
\n
\"
apikey
\"
:
\"
{{apikey}}
\"
,
\n
\"
files
\"
:
\"
{{files}}
\"
}"
,
"value"
:
"{
\n
\"
apikey
\"
:
\"
{{apikey}}
\"
,
\n
\"
files
\"
:
{{files}}
\n
}"
,
"label"
:
""
,
"label"
:
""
,
"required"
:
false
,
"required"
:
false
,
"debugLabel"
:
""
,
"debugLabel"
:
""
,
...
@@ -273,7 +278,7 @@
...
@@ -273,7 +278,7 @@
},
},
{
{
"renderTypeList"
:
[
"reference"
],
"renderTypeList"
:
[
"reference"
],
"valueType"
:
"
s
tring"
,
"valueType"
:
"
arrayS
tring"
,
"canEdit"
:
true
,
"canEdit"
:
true
,
"key"
:
"files"
,
"key"
:
"files"
,
"label"
:
"files"
,
"label"
:
"files"
,
...
@@ -299,7 +304,7 @@
...
@@ -299,7 +304,7 @@
"showDefaultValue"
:
true
"showDefaultValue"
:
true
},
},
"required"
:
true
,
"required"
:
true
,
"value"
:
[
"pMBi7J7vcsqB"
,
"system_text"
]
"value"
:
[
[
"pluginInput"
,
"url"
]
]
}
}
],
],
"outputs"
:
[
"outputs"
:
[
...
@@ -360,109 +365,6 @@
...
@@ -360,109 +365,6 @@
"type"
:
"dynamic"
,
"type"
:
"dynamic"
,
"key"
:
"success"
,
"key"
:
"success"
,
"label"
:
"success"
"label"
:
"success"
},
{
"id"
:
"yDxzW5CFalGw"
,
"valueType"
:
"string"
,
"type"
:
"dynamic"
,
"key"
:
"failreason"
,
"label"
:
"failreason"
}
]
},
{
"nodeId"
:
"pMBi7J7vcsqB"
,
"name"
:
"文本拼接"
,
"intro"
:
"可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。"
,
"avatar"
:
"core/workflow/template/textConcat"
,
"flowNodeType"
:
"textEditor"
,
"position"
:
{
"x"
:
469.8489508985863
,
"y"
:
-177.67504356429907
},
"version"
:
"486"
,
"inputs"
:
[
{
"key"
:
"system_addInputParam"
,
"renderTypeList"
:
[
"addInputParam"
],
"valueType"
:
"dynamic"
,
"label"
:
""
,
"required"
:
false
,
"description"
:
"workflow:dynamic_input_description_concat"
,
"customInputConfig"
:
{
"selectValueTypeList"
:
[
"string"
,
"number"
,
"boolean"
,
"object"
,
"arrayString"
,
"arrayNumber"
,
"arrayBoolean"
,
"arrayObject"
,
"arrayAny"
,
"any"
,
"chatHistory"
,
"datasetQuote"
,
"dynamic"
,
"selectApp"
,
"selectDataset"
],
"showDescription"
:
false
,
"showDefaultValue"
:
false
},
"debugLabel"
:
""
,
"toolDescription"
:
""
},
{
"key"
:
"system_textareaInput"
,
"renderTypeList"
:
[
"textarea"
],
"valueType"
:
"string"
,
"required"
:
true
,
"label"
:
"拼接文本"
,
"placeholder"
:
"workflow:input_variable_list"
,
"value"
:
"{{files}}"
,
"debugLabel"
:
""
,
"toolDescription"
:
""
},
{
"renderTypeList"
:
[
"reference"
],
"valueType"
:
"any"
,
"canEdit"
:
true
,
"key"
:
"files"
,
"label"
:
"files"
,
"customInputConfig"
:
{
"selectValueTypeList"
:
[
"string"
,
"number"
,
"boolean"
,
"object"
,
"arrayString"
,
"arrayNumber"
,
"arrayBoolean"
,
"arrayObject"
,
"arrayAny"
,
"any"
,
"chatHistory"
,
"datasetQuote"
,
"dynamic"
,
"selectApp"
,
"selectDataset"
],
"showDescription"
:
false
,
"showDefaultValue"
:
false
},
"required"
:
true
,
"value"
:
[
"pluginInput"
,
"url"
]
}
],
"outputs"
:
[
{
"id"
:
"system_text"
,
"key"
:
"system_text"
,
"label"
:
"workflow:concatenation_result"
,
"type"
:
"static"
,
"valueType"
:
"string"
,
"description"
:
""
}
}
]
]
}
}
...
@@ -476,14 +378,8 @@
...
@@ -476,14 +378,8 @@
},
},
{
{
"source"
:
"pluginInput"
,
"source"
:
"pluginInput"
,
"target"
:
"pMBi7J7vcsqB"
,
"sourceHandle"
:
"pluginInput-source-right"
,
"targetHandle"
:
"pMBi7J7vcsqB-target-left"
},
{
"source"
:
"pMBi7J7vcsqB"
,
"target"
:
"zHG5jJBkXmjB"
,
"target"
:
"zHG5jJBkXmjB"
,
"sourceHandle"
:
"p
MBi7J7vcsqB
-source-right"
,
"sourceHandle"
:
"p
luginInput
-source-right"
,
"targetHandle"
:
"zHG5jJBkXmjB-target-left"
"targetHandle"
:
"zHG5jJBkXmjB-target-left"
}
}
],
],
...
...
packages/service/core/workflow/dispatch/tools/http468.ts
View file @
3f72f885
...
@@ -18,7 +18,6 @@ import {
...
@@ -18,7 +18,6 @@ import {
textAdaptGptResponse
,
textAdaptGptResponse
,
replaceEditorVariable
replaceEditorVariable
}
from
'@fastgpt/global/core/workflow/runtime/utils'
;
}
from
'@fastgpt/global/core/workflow/runtime/utils'
;
import
{
getSystemPluginCb
}
from
'../../../../../plugins/register'
;
import
{
ContentTypes
}
from
'@fastgpt/global/core/workflow/constants'
;
import
{
ContentTypes
}
from
'@fastgpt/global/core/workflow/constants'
;
import
{
uploadFileFromBase64Img
}
from
'../../../../common/file/gridfs/controller'
;
import
{
uploadFileFromBase64Img
}
from
'../../../../common/file/gridfs/controller'
;
import
{
ReadFileBaseUrl
}
from
'@fastgpt/global/common/file/constants'
;
import
{
ReadFileBaseUrl
}
from
'@fastgpt/global/common/file/constants'
;
...
@@ -209,7 +208,8 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
...
@@ -209,7 +208,8 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
try
{
try
{
const
{
formatResponse
,
rawResponse
}
=
await
(
async
()
=>
{
const
{
formatResponse
,
rawResponse
}
=
await
(
async
()
=>
{
const
systemPluginCb
=
await
getSystemPluginCb
();
const
systemPluginCb
=
global
.
systemPluginCb
;
console
.
log
(
systemPluginCb
,
'-='
,
httpReqUrl
);
if
(
systemPluginCb
[
httpReqUrl
])
{
if
(
systemPluginCb
[
httpReqUrl
])
{
const
pluginResult
=
await
replaceSystemPluginResponse
({
const
pluginResult
=
await
replaceSystemPluginResponse
({
response
:
await
systemPluginCb
[
httpReqUrl
](
requestBody
),
response
:
await
systemPluginCb
[
httpReqUrl
](
requestBody
),
...
...
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodePluginIO/InputEditModal.tsx
View file @
3f72f885
...
@@ -215,6 +215,7 @@ const FieldEditModal = ({
...
@@ -215,6 +215,7 @@ const FieldEditModal = ({
);
);
const
onSubmitError
=
useCallback
(
const
onSubmitError
=
useCallback
(
(
e
:
Object
)
=>
{
(
e
:
Object
)
=>
{
console
.
log
(
'e'
,
e
);
for
(
const
item
of
Object
.
values
(
e
))
{
for
(
const
item
of
Object
.
values
(
e
))
{
if
(
item
.
message
)
{
if
(
item
.
message
)
{
toast
({
toast
({
...
...
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodePluginIO/InputTypeConfig.tsx
View file @
3f72f885
...
@@ -511,22 +511,14 @@ const InputTypeConfig = ({
...
@@ -511,22 +511,14 @@ const InputTypeConfig = ({
<
FormLabel
flex=
{
'0 0 132px'
}
fontWeight=
{
'medium'
}
>
<
FormLabel
flex=
{
'0 0 132px'
}
fontWeight=
{
'medium'
}
>
{
t
(
'app:document_upload'
)
}
{
t
(
'app:document_upload'
)
}
</
FormLabel
>
</
FormLabel
>
<
Switch
<
Switch
{
...
register
('
canSelectFile
')}
/>
{
...
register
('
canSelectFile
',
{
required
:
true
})}
/>
</
Flex
>
</
Flex
>
<
Box
w=
{
'full'
}
minH=
{
'40px'
}
>
<
Box
w=
{
'full'
}
minH=
{
'40px'
}
>
<
Flex
alignItems=
{
'center'
}
>
<
Flex
alignItems=
{
'center'
}
>
<
FormLabel
flex=
{
'0 0 132px'
}
fontWeight=
{
'medium'
}
>
<
FormLabel
flex=
{
'0 0 132px'
}
fontWeight=
{
'medium'
}
>
{
t
(
'app:image_upload'
)
}
{
t
(
'app:image_upload'
)
}
</
FormLabel
>
</
FormLabel
>
<
Switch
<
Switch
{
...
register
('
canSelectImg
')}
/>
{
...
register
('
canSelectImg
',
{
required
:
true
})}
/>
</
Flex
>
</
Flex
>
<
Flex
color=
{
'myGray.500'
}
>
<
Flex
color=
{
'myGray.500'
}
>
<
Box
fontSize=
{
'xs'
}
>
{
t
(
'app:image_upload_tip'
)
}
</
Box
>
<
Box
fontSize=
{
'xs'
}
>
{
t
(
'app:image_upload_tip'
)
}
</
Box
>
...
...
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/NodeCard.tsx
View file @
3f72f885
...
@@ -115,6 +115,16 @@ const NodeCard = (props: Props) => {
...
@@ -115,6 +115,16 @@ const NodeCard = (props: Props) => {
}
}
},
},
{
{
onSuccess
(
res
)
{
if
(
!
res
)
return
;
// Execute forcibly updates the courseUrl field
onChangeNode
({
nodeId
,
type
:
'attr'
,
key
:
'courseUrl'
,
value
:
res
?.
courseUrl
});
},
manual
:
false
manual
:
false
}
}
);
);
...
...
projects/app/src/service/common/system/volumnMongoWatch.ts
View file @
3f72f885
import
{
getSystemPlugins
}
from
'@/service/core/app/plugin'
;
import
{
getSystemPlugin
Cb
,
getSystemPlugin
s
}
from
'@/service/core/app/plugin'
;
import
{
initSystemConfig
}
from
'.'
;
import
{
initSystemConfig
}
from
'.'
;
import
{
createDatasetTrainingMongoWatch
}
from
'@/service/core/dataset/training/utils'
;
import
{
createDatasetTrainingMongoWatch
}
from
'@/service/core/dataset/training/utils'
;
import
{
MongoSystemConfigs
}
from
'@fastgpt/service/common/system/config/schema'
;
import
{
MongoSystemConfigs
}
from
'@fastgpt/service/common/system/config/schema'
;
...
...
projects/app/src/service/core/app/plugin.ts
View file @
3f72f885
...
@@ -22,6 +22,8 @@ export const getSystemPlugins = async (refresh = false) => {
...
@@ -22,6 +22,8 @@ export const getSystemPlugins = async (refresh = false) => {
addLog
.
info
(
`Load system plugin successfully:
${
global
.
systemPlugins
.
length
}
`
);
addLog
.
info
(
`Load system plugin successfully:
${
global
.
systemPlugins
.
length
}
`
);
getSystemPluginCb
();
return
cloneDeep
(
global
.
systemPlugins
);
return
cloneDeep
(
global
.
systemPlugins
);
}
catch
(
error
)
{
}
catch
(
error
)
{
//@ts-ignore
//@ts-ignore
...
...
projects/app/src/service/mongo.ts
View file @
3f72f885
...
@@ -12,7 +12,7 @@ import { startMongoWatch } from './common/system/volumnMongoWatch';
...
@@ -12,7 +12,7 @@ import { startMongoWatch } from './common/system/volumnMongoWatch';
import
{
startTrainingQueue
}
from
'./core/dataset/training/utils'
;
import
{
startTrainingQueue
}
from
'./core/dataset/training/utils'
;
import
{
systemStartCb
}
from
'@fastgpt/service/common/system/tools'
;
import
{
systemStartCb
}
from
'@fastgpt/service/common/system/tools'
;
import
{
addLog
}
from
'@fastgpt/service/common/system/log'
;
import
{
addLog
}
from
'@fastgpt/service/common/system/log'
;
import
{
getSystemPlugin
Cb
}
from
'./core/app/plugin'
;
import
{
getSystemPlugin
s
}
from
'./core/app/plugin'
;
/**
/**
* This function is equivalent to the entry to the service
* This function is equivalent to the entry to the service
...
@@ -32,8 +32,9 @@ export function connectToDatabase() {
...
@@ -32,8 +32,9 @@ export function connectToDatabase() {
systemStartCb
();
systemStartCb
();
//init system config;init vector database;init root user
//init system config;init vector database;init root user
await
Promise
.
all
([
getInitConfig
(),
getSystemPluginCb
(),
initVectorStore
(),
initRootUser
()]);
await
Promise
.
all
([
getInitConfig
(),
initVectorStore
(),
initRootUser
()]);
getSystemPlugins
();
startMongoWatch
();
startMongoWatch
();
// cron
// cron
startCron
();
startCron
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment