mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
improvement(setup): complete knowledge and update flows (#6521)
This commit is contained in:
@@ -2,11 +2,12 @@ import { describe, expect, it } from 'bun:test'
|
||||
import {
|
||||
EMAIL_CAPABILITY,
|
||||
inspectCapability,
|
||||
KNOWLEDGE_EMBEDDINGS_CAPABILITY,
|
||||
requireCapability,
|
||||
STORAGE_CAPABILITY,
|
||||
validateCapabilityFieldInput,
|
||||
} from '../../apps/sim/lib/core/config/env-capabilities.ts'
|
||||
import { EMAIL_SETUP, STORAGE_SETUP } from './capability-config.ts'
|
||||
import { EMAIL_SETUP, KNOWLEDGE_EMBEDDINGS_SETUP, STORAGE_SETUP } from './capability-config.ts'
|
||||
import {
|
||||
buildCapabilitySetupTransition,
|
||||
resolveCurrentCapabilitySetupOptionId,
|
||||
@@ -41,6 +42,15 @@ describe('setup provider reconciliation', () => {
|
||||
).toBe('smtp')
|
||||
})
|
||||
|
||||
it('allows setup when no knowledge embedding provider is configured', () => {
|
||||
expect(resolveCurrentCapabilitySetupOptionId(KNOWLEDGE_EMBEDDINGS_SETUP, {})).toBeUndefined()
|
||||
expect(
|
||||
resolveCurrentCapabilitySetupOptionId(KNOWLEDGE_EMBEDDINGS_SETUP, {
|
||||
OPENROUTER_API_KEY: 'openrouter-key',
|
||||
})
|
||||
).toBe('openrouter')
|
||||
})
|
||||
|
||||
it('uses canonical storage selection for setup defaults', () => {
|
||||
expect(
|
||||
resolveCurrentCapabilitySetupOptionId(STORAGE_SETUP, new Map([['AWS_REGION', 'us-east-1']]))
|
||||
@@ -79,6 +89,20 @@ describe('setup provider reconciliation', () => {
|
||||
expect(inspectCapability(EMAIL_CAPABILITY, reconciled).providerIds).toEqual(['resend', 'smtp'])
|
||||
})
|
||||
|
||||
it('configures a knowledge embedding provider from an empty state', () => {
|
||||
const result = buildCapabilitySetupTransition(
|
||||
KNOWLEDGE_EMBEDDINGS_SETUP,
|
||||
'openrouter',
|
||||
{ OPENROUTER_API_KEY: 'openrouter-key' },
|
||||
{}
|
||||
)
|
||||
const reconciled = applyResult({}, result)
|
||||
|
||||
expect(inspectCapability(KNOWLEDGE_EMBEDDINGS_CAPABILITY, reconciled).providerIds).toEqual([
|
||||
'openrouter',
|
||||
])
|
||||
})
|
||||
|
||||
it('clears stale SMTP auth for an unauthenticated relay', () => {
|
||||
const result = buildCapabilitySetupTransition(
|
||||
EMAIL_SETUP,
|
||||
|
||||
Reference in New Issue
Block a user