Fix LLM validation and dashboard health hot paths

This commit is contained in:
2026-03-15 13:18:51 +03:00
parent d867f52ae5
commit 4efce79df5
24 changed files with 1398 additions and 83 deletions

View File

@@ -142,10 +142,15 @@
togglingProviderIds = new Set(togglingProviderIds);
try {
await requestApi(`/llm/providers/${provider.id}`, "PUT", {
...provider,
const updatePayload = {
id: provider.id,
name: provider.name,
provider_type: provider.provider_type,
base_url: provider.base_url,
default_model: provider.default_model,
is_active: provider.is_active,
});
};
await requestApi(`/llm/providers/${provider.id}`, "PUT", updatePayload);
} catch (err) {
provider.is_active = previousState;
providers = [...providers];

View File

@@ -46,6 +46,15 @@ describe('ProviderConfig edit interaction contract', () => {
expect(source).toContain('await requestApi(`/llm/providers/${provider.id}`, "DELETE")');
expect(source).toContain('onclick={() => handleDelete(provider)}');
});
it('does not forward masked api_key when toggling provider activation', () => {
const source = fs.readFileSync(COMPONENT_PATH, 'utf-8');
expect(source).toContain('const updatePayload = {');
expect(source).toContain('provider_type: provider.provider_type');
expect(source).toContain('default_model: provider.default_model');
expect(source).not.toContain('await requestApi(`/llm/providers/${provider.id}`, "PUT", {\n ...provider,');
});
});
// [/DEF:provider_config_edit_contract_tests:Function]
// [/DEF:frontend.src.components.llm.__tests__.provider_config_integration:Module]