mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 13:46:02 +08:00
Merge branch 'feat/mcp-frontend' into deploy/dev
This commit is contained in:
commit
a4ee06e1be
@ -86,7 +86,6 @@ const MCPDetailContent: FC<Props> = ({
|
||||
return
|
||||
const res = await authorizeMcp({
|
||||
provider_id: detail.id,
|
||||
server_url: detail.server_url!,
|
||||
})
|
||||
if (res.result === 'success')
|
||||
handleUpdateTools()
|
||||
@ -194,7 +193,7 @@ const MCPDetailContent: FC<Props> = ({
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{detail.is_team_authorization && !isGettingTools && !toolList.length && (
|
||||
{!isUpdating && detail.is_team_authorization && !isGettingTools && !toolList.length && (
|
||||
<div className='flex h-full w-full flex-col items-center justify-center'>
|
||||
<div className='system-sm-regular mb-3 text-text-tertiary'>{t('tools.mcp.toolsEmpty')}</div>
|
||||
<Button
|
||||
@ -203,7 +202,7 @@ const MCPDetailContent: FC<Props> = ({
|
||||
>{t('tools.mcp.getTools')}</Button>
|
||||
</div>
|
||||
)}
|
||||
{!isGettingTools && toolList.length > 0 && (
|
||||
{!isUpdating && !isGettingTools && toolList.length > 0 && (
|
||||
<>
|
||||
<div className='flex shrink-0 justify-between gap-2 px-4 pb-1 pt-2'>
|
||||
<div className='flex h-6 items-center'>
|
||||
@ -228,7 +227,7 @@ const MCPDetailContent: FC<Props> = ({
|
||||
</>
|
||||
)}
|
||||
|
||||
{!detail.is_team_authorization && (
|
||||
{!isUpdating && !detail.is_team_authorization && (
|
||||
<div className='flex h-full w-full flex-col items-center justify-center'>
|
||||
{!isAuthorizing && <div className='system-md-medium mb-1 text-text-secondary'>{t('tools.mcp.authorizingRequired')}</div>}
|
||||
{isAuthorizing && <div className='system-md-medium mb-1 text-text-secondary'>{t('tools.mcp.authorizing')}</div>}
|
||||
|
@ -70,7 +70,6 @@ const MCPList = ({
|
||||
setCurrentProviderID(provider.id)
|
||||
await authorizeMcp({
|
||||
provider_id: provider.id,
|
||||
server_url: provider.server_url!,
|
||||
})
|
||||
await refetch() // update authorization in list
|
||||
await updateTools(provider.id)
|
||||
@ -84,7 +83,6 @@ const MCPList = ({
|
||||
if (!targetProvider) return
|
||||
await updateMCPAuthorizationToken({
|
||||
provider_id: providerID,
|
||||
server_url: targetProvider.server_url!,
|
||||
authorization_code: code,
|
||||
})
|
||||
await refetch()
|
||||
|
@ -101,7 +101,7 @@ const MCPCard = ({
|
||||
)}
|
||||
</div>
|
||||
<div className='system-xs-regular text-divider-deep'>/</div>
|
||||
<div className='system-xs-regular truncate text-text-tertiary'>{`${t('tools.mcp.updateTime')} ${formatTimeFromNow(data.updated_at!)}`}</div>
|
||||
<div className='system-xs-regular truncate text-text-tertiary'>{`${t('tools.mcp.updateTime')} ${formatTimeFromNow(data.updated_at! * 1000)}`}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -140,7 +140,7 @@ export const useDeleteMCP = ({
|
||||
export const useAuthorizeMCP = () => {
|
||||
return useMutation({
|
||||
mutationKey: [NAME_SPACE, 'authorize-mcp'],
|
||||
mutationFn: (payload: { provider_id: string; server_url: string }) => {
|
||||
mutationFn: (payload: { provider_id: string; }) => {
|
||||
return post<{ result?: string; authorization_url?: string }>('/workspaces/current/tool-provider/mcp/auth', {
|
||||
body: payload,
|
||||
})
|
||||
@ -151,7 +151,7 @@ export const useAuthorizeMCP = () => {
|
||||
export const useUpdateMCPAuthorizationToken = () => {
|
||||
return useMutation({
|
||||
mutationKey: [NAME_SPACE, 'refresh-mcp-server-code'],
|
||||
mutationFn: (payload: { provider_id: string; server_url: string; authorization_code: string }) => {
|
||||
mutationFn: (payload: { provider_id: string; authorization_code: string }) => {
|
||||
return get<MCPServerDetail>('/workspaces/current/tool-provider/mcp/token', {
|
||||
params: {
|
||||
...payload,
|
||||
|
Loading…
x
Reference in New Issue
Block a user