mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-02-18 00:17:39 +01:00
Backend:
- Add smart provider fallback when selected model's provider isn't configured
- Automatically switch to a model from a configured provider instead of failing
- Log warning when fallback occurs for visibility
Frontend (AISettings.tsx):
- Add helper functions to check if model's provider is configured
- Group model dropdown: configured providers first, unconfigured marked with ⚠️
- Add inline warning when selecting model from unconfigured provider
- Validate on save that model's provider is configured (or being added)
- Warn before clearing last configured provider (would disable AI)
- Warn before clearing provider that current model uses
- Add patrol interval validation (must be 0 or >= 10 minutes)
- Show red border + inline error for invalid patrol intervals 1-9
- Update patrol interval hint: '(0=off, 10+ to enable)'
These changes prevent confusing '500 Internal Server Error' and
'AI is not enabled or configured' errors when model/provider mismatch.
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import { spawn } from 'node:child_process';
|
|
|
|
const truthy = (value) => {
|
|
if (!value) return false;
|
|
return ['1', 'true', 'yes', 'on'].includes(String(value).trim().toLowerCase());
|
|
};
|
|
|
|
if (truthy(process.env.PULSE_E2E_SKIP_DOCKER)) {
|
|
console.log('[integration] PULSE_E2E_SKIP_DOCKER enabled, skipping docker compose down');
|
|
process.exit(0);
|
|
}
|
|
|
|
const run = (command, args, options = {}) =>
|
|
new Promise((resolve, reject) => {
|
|
const child = spawn(command, args, { stdio: 'inherit', ...options });
|
|
child.on('error', reject);
|
|
child.on('close', (code) => {
|
|
if (code === 0) resolve();
|
|
else reject(new Error(`${command} ${args.join(' ')} exited with code ${code}`));
|
|
});
|
|
});
|
|
|
|
const canRun = async (command, args) => {
|
|
try {
|
|
await run(command, args, { stdio: 'ignore' });
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
const useDockerCompose = !(await canRun('docker', ['compose', 'version']));
|
|
|
|
try {
|
|
if (useDockerCompose) {
|
|
await run('docker-compose', ['-f', 'docker-compose.test.yml', 'down', '-v']);
|
|
} else {
|
|
await run('docker', ['compose', '-f', 'docker-compose.test.yml', 'down', '-v']);
|
|
}
|
|
} catch (err) {
|
|
// Avoid masking test failures with cleanup errors
|
|
console.warn('[integration] docker compose down failed:', err?.message || err);
|
|
}
|
|
|