Merge branch 'feat/rag-plugin-recommendation-optimization' into deploy/dev

This commit is contained in:
twwu 2025-10-27 18:50:39 +08:00
commit 4a797ab2d8
4 changed files with 14 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import {
import { useGetApi } from './use-get-api'
import type { PluginPayload } from '../types'
import type { CredentialTypeEnum } from '../types'
import { useInvalidToolsByType } from '@/service/use-tools'
export const useGetPluginCredentialInfoHook = (pluginPayload: PluginPayload, enable?: boolean) => {
const apiMap = useGetApi(pluginPayload)
@ -29,8 +30,14 @@ export const useDeletePluginCredentialHook = (pluginPayload: PluginPayload) => {
export const useInvalidPluginCredentialInfoHook = (pluginPayload: PluginPayload) => {
const apiMap = useGetApi(pluginPayload)
const invalidPluginCredentialInfo = useInvalidPluginCredentialInfo(apiMap.getCredentialInfo)
const providerType = pluginPayload.providerType
const invalidToolsByType = useInvalidToolsByType(providerType)
return useInvalidPluginCredentialInfo(apiMap.getCredentialInfo)
return () => {
invalidPluginCredentialInfo()
invalidToolsByType()
}
}
export const useSetPluginDefaultCredentialHook = (pluginPayload: PluginPayload) => {

View File

@ -1,3 +1,5 @@
import type { CollectionType } from '../../tools/types'
export type { AddApiKeyButtonProps } from './authorize/add-api-key-button'
export type { AddOAuthButtonProps } from './authorize/add-oauth-button'
@ -10,6 +12,7 @@ export enum AuthCategory {
export type PluginPayload = {
category: AuthCategory
provider: string
providerType: CollectionType | string
}
export enum CredentialTypeEnum {

View File

@ -504,6 +504,7 @@ const BasePanel: FC<BasePanelProps> = ({
className='px-4 pb-2'
pluginPayload={{
provider: currCollection?.name || '',
providerType: currCollection?.type || '',
category: AuthCategory.tool,
}}
>
@ -515,6 +516,7 @@ const BasePanel: FC<BasePanelProps> = ({
<AuthorizedInNode
pluginPayload={{
provider: currCollection?.name || '',
providerType: currCollection?.type || '',
category: AuthCategory.tool,
}}
onAuthorizationItemClick={handleAuthorizationItemClick}

View File

@ -84,7 +84,7 @@ const useInvalidToolsKeyMap: Record<string, QueryKey> = {
[CollectionType.workflow]: useAllWorkflowToolsKey,
[CollectionType.mcp]: useAllMCPToolsKey,
}
export const useInvalidToolsByType = (type: CollectionType) => {
export const useInvalidToolsByType = (type: CollectionType | string) => {
return useInvalid(useInvalidToolsKeyMap[type])
}