mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-13 07:55:09 -05:00
Handle required fields correctly for hosted keys
This commit is contained in:
@@ -243,11 +243,7 @@ export interface SubBlockConfig {
|
||||
hidden?: boolean
|
||||
hideFromPreview?: boolean // Hide this subblock from the workflow block preview
|
||||
requiresFeature?: string // Environment variable name that must be truthy for this subblock to be visible
|
||||
/**
|
||||
* Hide this subblock when running on hosted Sim (isHosted is true).
|
||||
* Used for tool API key fields that should be hidden when Sim provides hosted keys.
|
||||
*/
|
||||
hideWhenHosted?: boolean
|
||||
hideWhenHosted?: boolean // Hide this subblock when running on hosted sim
|
||||
description?: string
|
||||
tooltip?: string // Tooltip text displayed via info icon next to the title
|
||||
value?: (params: Record<string, any>) => string
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
isCanonicalPair,
|
||||
isNonEmptyValue,
|
||||
isSubBlockFeatureEnabled,
|
||||
isSubBlockHiddenByHostedKey,
|
||||
resolveCanonicalMode,
|
||||
} from '@/lib/workflows/subblocks/visibility'
|
||||
import { getBlock } from '@/blocks'
|
||||
@@ -49,6 +50,7 @@ function shouldSerializeSubBlock(
|
||||
canonicalModeOverrides?: CanonicalModeOverrides
|
||||
): boolean {
|
||||
if (!isSubBlockFeatureEnabled(subBlockConfig)) return false
|
||||
if (isSubBlockHiddenByHostedKey(subBlockConfig)) return false
|
||||
|
||||
if (subBlockConfig.mode === 'trigger') {
|
||||
if (!isTriggerContext && !isTriggerCategory) return false
|
||||
|
||||
@@ -3,6 +3,7 @@ import { generateInternalToken } from '@/lib/auth/internal'
|
||||
import { getBYOKKey } from '@/lib/api-key/byok'
|
||||
import { logFixedUsage } from '@/lib/billing/core/usage-log'
|
||||
import { env } from '@/lib/core/config/env'
|
||||
import { isHosted } from '@/lib/core/config/feature-flags'
|
||||
import { DEFAULT_EXECUTION_TIMEOUT_MS } from '@/lib/core/execution-limits'
|
||||
import {
|
||||
secureFetchWithPinnedIP,
|
||||
@@ -61,6 +62,7 @@ async function injectHostedKeyIfNeeded(
|
||||
requestId: string
|
||||
): Promise<boolean> {
|
||||
if (!tool.hosting) return false
|
||||
if (!isHosted) return false
|
||||
|
||||
const { envKeys, apiKeyParam, byokProviderId } = tool.hosting
|
||||
const userProvidedKey = params[apiKeyParam]
|
||||
|
||||
@@ -43,7 +43,7 @@ export const searchTool: ToolConfig<SearchParams, SearchResponse> = {
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Serper API Key',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user