()
| 211 | * Handles hosted vs self-hosted environments and excludes providers that don't need API key. |
| 212 | */ |
| 213 | export function getApiKeyCondition() { |
| 214 | return (values?: Record<string, unknown>) => { |
| 215 | const model = typeof values?.model === 'string' ? values.model : '' |
| 216 | const shouldShow = shouldRequireApiKeyForModel(model) |
| 217 | return buildModelVisibilityCondition(model, shouldShow) |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * Visibility condition for the Cohere reranker API key field on the Knowledge block. |