Skip to content

Commit df3b2ff

Browse files
committed
address bugbot comments
1 parent 51409ba commit df3b2ff

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

apps/sim/lib/copilot/tools/server/workflow/edit-workflow/validation.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,17 +352,16 @@ export function validateValueForSubBlockType(
352352
case 'short-input':
353353
case 'long-input':
354354
case 'combobox': {
355-
let stringValue: string
356-
if (typeof value !== 'string' && typeof value !== 'number') {
357-
stringValue = String(value)
358-
} else {
359-
stringValue = typeof value === 'number' ? String(value) : value
360-
}
361-
362355
const usesProviderCatalog =
363356
fieldName === 'model' && subBlockConfig.options === getModelOptions
364357

365358
if (usesProviderCatalog) {
359+
const stringValue =
360+
typeof value === 'string'
361+
? value
362+
: typeof value === 'number'
363+
? String(value)
364+
: String(value)
366365
const trimmed = stringValue.trim()
367366
if (trimmed !== '' && !isKnownModelId(trimmed)) {
368367
const suggestions = suggestModelIdsForUnknownModel(trimmed)
@@ -382,7 +381,10 @@ export function validateValueForSubBlockType(
382381
return { valid: true, value: trimmed }
383382
}
384383

385-
return { valid: true, value: typeof value === 'string' ? value : stringValue }
384+
if (typeof value !== 'string' && typeof value !== 'number') {
385+
return { valid: true, value: String(value) }
386+
}
387+
return { valid: true, value }
386388
}
387389

388390
// Selector types - allow strings (IDs) or arrays of strings

apps/sim/providers/models.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2711,7 +2711,7 @@ export function getProviderModels(providerId: string): string[] {
27112711

27122712
export const DYNAMIC_MODEL_PROVIDERS = ['ollama', 'vllm', 'openrouter', 'fireworks'] as const
27132713

2714-
export function getAllStaticModelIds(): string[] {
2714+
function getAllStaticModelIds(): string[] {
27152715
const ids: string[] = []
27162716
for (const [providerId, provider] of Object.entries(PROVIDER_DEFINITIONS)) {
27172717
if ((DYNAMIC_MODEL_PROVIDERS as readonly string[]).includes(providerId)) continue
@@ -2737,7 +2737,7 @@ export function isKnownModelId(modelId: string): boolean {
27372737
return false
27382738
}
27392739

2740-
export function getRecommendedModels(): string[] {
2740+
function getRecommendedModels(): string[] {
27412741
const models: string[] = []
27422742
for (const [providerId, provider] of Object.entries(PROVIDER_DEFINITIONS)) {
27432743
if ((DYNAMIC_MODEL_PROVIDERS as readonly string[]).includes(providerId)) continue

0 commit comments

Comments
 (0)