chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动
演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
60158935f4
commit
6519682885
15831 files changed
+3063428
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import type { Collection } from '@/app/components/tools/types'
|
||||
import { CollectionType } from '@/app/components/tools/types'
|
||||
import { canFindTool } from './index'
|
||||
|
||||
type ProviderLike = Pick<Collection, 'id' | 'type'> & { server_identifier?: string }
|
||||
|
||||
/**
|
||||
* The identifier to persist when a node, agent config or prompt mention points at a
|
||||
* provider. MCP providers are resolved by `server_identifier` at runtime because it
|
||||
* survives a DSL export/import into another workspace; the primary key does not.
|
||||
*/
|
||||
export const getProviderReference = (provider: ProviderLike) => {
|
||||
if (provider.type === CollectionType.mcp && provider.server_identifier)
|
||||
return provider.server_identifier
|
||||
return provider.id
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a persisted reference points at this provider.
|
||||
* Use idOrServerIdentifier for backward compatibility. Previous id content could be non-deterministic,
|
||||
* we will support both primary key or server_identifier as reference
|
||||
*/
|
||||
export const matchesProviderReference = (provider: ProviderLike, idOrServerIdentifier?: string) => {
|
||||
if (!idOrServerIdentifier) return false
|
||||
if (provider.type === CollectionType.mcp && provider.server_identifier === idOrServerIdentifier)
|
||||
return true
|
||||
return canFindTool(provider.id, idOrServerIdentifier)
|
||||
}
|
||||
Reference in new issue
Block a user