-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Short-chain burying #4678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Short-chain burying #4678
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f458557
TrackRegisterParams
dreamer6680 a9da786
新增工作流导入功能,支持从URL获取工作流JSON数据并创建应用。实现了URL验证、CORS处理、剪贴板读取等功能,确保用户能够顺利导入工…
dreamer6680 65efde7
更新工作流导入功能,将导入逻辑从utils模块迁移至workflow模块,并修正相关导入路径。此更改有助于代码结构的清晰和模块化。
dreamer6680 79eb1d4
优化工作流导入组件,重构导入逻辑,增加从URL获取工作流数据的功能,并实现JSON配置导入窗口。修复了状态管理和错误处理,提升用户体验。
dreamer6680 0d821d6
更新工作流导入功能,增加对UTM参数的支持,优化从URL获取工作流数据的逻辑,并重构相关API接口。修复了状态管理和错误处理,提升了用户体验。
dreamer6680 ecff04c
更新创建应用的API接口,将UTM参数的字段名称从`shorUrlId`和`projectCode`修改为`shorUrlPlatform…
dreamer6680 789e9e9
impoter json
dreamer6680 3a9270e
Optimize the logic
dreamer6680 530f2e6
delete some console
dreamer6680 7fe55a4
fix
dreamer6680 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dreamer6680 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { NextAPI } from '@/service/middleware/entry'; | ||
import { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next'; | ||
import axios from 'axios'; | ||
import { authCert } from '@fastgpt/service/support/permission/auth/common'; | ||
|
||
export type FetchWorkflowBody = { | ||
url: string; | ||
}; | ||
|
||
export type FetchWorkflowQuery = { | ||
url: string; | ||
}; | ||
|
||
export type FetchWorkflowResponseType = ApiResponseType<{ | ||
data: JSON; | ||
}>; | ||
|
||
async function handler( | ||
req: ApiRequestProps<FetchWorkflowBody, FetchWorkflowQuery>, | ||
res: FetchWorkflowResponseType | ||
) { | ||
await authCert({ req, authToken: true }); | ||
|
||
const url = req.body?.url || req.query?.url; | ||
|
||
if (!url) { | ||
return Promise.reject('app:type.error.URLempty'); | ||
} | ||
|
||
const response = await axios.get(url, { | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
'User-Agent': 'Mozilla/5.0 (compatible; FastGPT/1.0)' | ||
}, | ||
timeout: 30000, | ||
validateStatus: (status) => status < 500 | ||
}); | ||
|
||
const contentType = response.headers['content-type'] || ''; | ||
|
||
if (!response.data || response.data.length === 0) { | ||
return Promise.reject('app:type.error.workflowresponseempty'); | ||
} | ||
|
||
JSON.parse(JSON.stringify(response.data)); | ||
|
||
return response.data; | ||
} | ||
|
||
export default NextAPI(handler); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.