fix: auto resetting of cloud models on startup

This commit is contained in:
haritabh-z01 2025-12-03 23:53:13 +05:30
parent 88dd84330a
commit ce76b59cbb

View file

@ -1081,8 +1081,14 @@ class ModelService extends EventEmitter {
const defaultSpeechModel =
await this.settingsService.getDefaultSpeechModel();
if (defaultSpeechModel) {
const exists = await modelExists("local-whisper", defaultSpeechModel);
if (!exists) {
const availableModel = AVAILABLE_MODELS.find(
(m) => m.id === defaultSpeechModel,
);
const isAmicalModel = availableModel?.provider === "Amical Cloud";
const existsInDb = await modelExists("local-whisper", defaultSpeechModel);
// Amical cloud models are always valid; local models must exist in DB
if (!isAmicalModel && !existsInDb) {
logger.main.info("Clearing invalid default speech model", {
modelId: defaultSpeechModel,
});