mirror of
https://github.com/langgenius/dify.git
synced 2026-05-12 15:58:19 +08:00
fix: update custom tool integration route
This commit is contained in:
parent
10cc0ddb64
commit
3d678baacd
@ -49,7 +49,7 @@ Not completed:
|
||||
| `/integrations/model-provider` | Existing model provider management page. |
|
||||
| `/integrations/tools` | Redirect to `/integrations/tools/built-in` unless a tools overview page is introduced. |
|
||||
| `/integrations/tools/built-in` | Existing built-in tools list. |
|
||||
| `/integrations/tools/swagger-api` | Existing custom API tool list, relabeled as Swagger API as Tool. |
|
||||
| `/integrations/tool/api` | Existing custom API tool list, relabeled as Swagger API as Tool. |
|
||||
| `/integrations/tools/workflow` | Existing Workflow as Tool management page. |
|
||||
| `/integrations/tools/mcp` | Existing MCP tools management page. |
|
||||
| `/integrations/trigger` | Existing plugin trigger list filtered from plugin management. |
|
||||
@ -92,9 +92,9 @@ Do not treat every plugin category as an Integrations navigation item automatica
|
||||
| `/tools?section=builtin` | `/integrations/tools/built-in` |
|
||||
| `/tools?section=builtin&category=builtin` | `/integrations/tools/built-in` |
|
||||
| `/tools?category=builtin` | `/integrations/tools/built-in` |
|
||||
| `/tools?section=custom-tool` | `/integrations/tools/swagger-api` |
|
||||
| `/tools?section=custom-tool&category=api` | `/integrations/tools/swagger-api` |
|
||||
| `/tools?category=api` | `/integrations/tools/swagger-api` |
|
||||
| `/tools?section=custom-tool` | `/integrations/tool/api` |
|
||||
| `/tools?section=custom-tool&category=api` | `/integrations/tool/api` |
|
||||
| `/tools?category=api` | `/integrations/tool/api` |
|
||||
| `/tools?section=workflow-tool` | `/integrations/tools/workflow` |
|
||||
| `/tools?section=workflow-tool&category=workflow` | `/integrations/tools/workflow` |
|
||||
| `/tools?category=workflow` | `/integrations/tools/workflow` |
|
||||
|
||||
@ -10,7 +10,7 @@ describe('integration routes', () => {
|
||||
expect(integrationPathBySection).toEqual({
|
||||
'provider': '/integrations/model-provider',
|
||||
'builtin': '/integrations/tools/built-in',
|
||||
'custom-tool': '/integrations/tools/swagger-api',
|
||||
'custom-tool': '/integrations/tool/api',
|
||||
'workflow-tool': '/integrations/tools/workflow',
|
||||
'mcp': '/integrations/tools/mcp',
|
||||
'data-source': '/integrations/data-source',
|
||||
@ -19,7 +19,7 @@ describe('integration routes', () => {
|
||||
'agent-strategy': '/integrations/agent-strategy',
|
||||
'extension': '/integrations/extension',
|
||||
})
|
||||
expect(buildIntegrationPath('custom-tool')).toBe('/integrations/tools/swagger-api')
|
||||
expect(buildIntegrationPath('custom-tool')).toBe('/integrations/tool/api')
|
||||
})
|
||||
|
||||
it.each([
|
||||
@ -28,7 +28,7 @@ describe('integration routes', () => {
|
||||
[['model-provider'], { type: 'section', section: 'provider' }],
|
||||
[['tools'], { type: 'redirect', destination: '/integrations/tools/built-in' }],
|
||||
[['tools', 'built-in'], { type: 'section', section: 'builtin' }],
|
||||
[['tools', 'swagger-api'], { type: 'section', section: 'custom-tool' }],
|
||||
[['tool', 'api'], { type: 'section', section: 'custom-tool' }],
|
||||
[['tools', 'workflow'], { type: 'section', section: 'workflow-tool' }],
|
||||
[['tools', 'mcp'], { type: 'section', section: 'mcp' }],
|
||||
[['data-source'], { type: 'section', section: 'data-source' }],
|
||||
@ -39,6 +39,7 @@ describe('integration routes', () => {
|
||||
[['model-providers'], { type: 'not-found' }],
|
||||
[['data-sources'], { type: 'not-found' }],
|
||||
[['api-extensions'], { type: 'not-found' }],
|
||||
[['tools', 'swagger-api'], { type: 'not-found' }],
|
||||
[['tools', 'trigger'], { type: 'not-found' }],
|
||||
[['tools', 'agent-strategy'], { type: 'not-found' }],
|
||||
[['tools', 'extension'], { type: 'not-found' }],
|
||||
@ -52,12 +53,12 @@ describe('integration routes', () => {
|
||||
[{ section: 'provider' }, '/integrations/model-provider'],
|
||||
[{ section: 'builtin' }, '/integrations/tools/built-in'],
|
||||
[{ category: 'builtin' }, '/integrations/tools/built-in'],
|
||||
[{ category: 'api' }, '/integrations/tools/swagger-api'],
|
||||
[{ category: 'api' }, '/integrations/tool/api'],
|
||||
[{ category: 'workflow' }, '/integrations/tools/workflow'],
|
||||
[{ category: 'mcp' }, '/integrations/tools/mcp'],
|
||||
[{ section: 'data-source' }, '/integrations/data-source'],
|
||||
[{ section: 'api-based-extension' }, '/integrations/tools/api-extension'],
|
||||
[{ section: 'custom-tool', category: 'api', q: 'slack', tags: ['a', 'b'] }, '/integrations/tools/swagger-api?q=slack&tags=a&tags=b'],
|
||||
[{ section: 'custom-tool', category: 'api', q: 'slack', tags: ['a', 'b'] }, '/integrations/tool/api?q=slack&tags=a&tags=b'],
|
||||
])('builds legacy /tools redirect for search params %j', (searchParams, expected) => {
|
||||
expect(getIntegrationRedirectPathByLegacyToolsSearchParams(searchParams)).toBe(expected)
|
||||
})
|
||||
|
||||
@ -53,7 +53,7 @@ export const sectionByToolCategory: Record<ToolCategory, IntegrationSection> = {
|
||||
export const integrationPathBySection: Record<IntegrationSection, string> = {
|
||||
'provider': '/integrations/model-provider',
|
||||
'builtin': '/integrations/tools/built-in',
|
||||
'custom-tool': '/integrations/tools/swagger-api',
|
||||
'custom-tool': '/integrations/tool/api',
|
||||
'workflow-tool': '/integrations/tools/workflow',
|
||||
'mcp': '/integrations/tools/mcp',
|
||||
'data-source': '/integrations/data-source',
|
||||
@ -112,7 +112,7 @@ export const getIntegrationRouteTargetBySlug = (slug?: string[]): IntegrationRou
|
||||
return { type: 'redirect', destination: buildIntegrationPath('builtin') }
|
||||
case 'tools/built-in':
|
||||
return { type: 'section', section: 'builtin' }
|
||||
case 'tools/swagger-api':
|
||||
case 'tool/api':
|
||||
return { type: 'section', section: 'custom-tool' }
|
||||
case 'tools/workflow':
|
||||
return { type: 'section', section: 'workflow-tool' }
|
||||
|
||||
@ -45,7 +45,7 @@ describe('Empty', () => {
|
||||
it('should render with Custom type and include link to Swagger API as Tool', () => {
|
||||
render(<Empty type={ToolTypeEnum.Custom} />)
|
||||
|
||||
const link = document.querySelector('a[href="/integrations/tools/swagger-api"]')
|
||||
const link = document.querySelector('a[href="/integrations/tool/api"]')
|
||||
expect(link).toBeInTheDocument()
|
||||
expect(link).toHaveAttribute('target', '_blank')
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user