local cmd_id = jarvis.context.command_id or "" -- map command id suffix → profile name local target = cmd_id:gsub("^profile%.", "") if target == "" then jarvis.audio.play_error() return { chain = false } end local ok, err = pcall(function() local p = jarvis.profile.set(target) if p and p.greeting and p.greeting ~= "" then jarvis.speak(p.greeting) else local icon = (p and p.icon) or "" jarvis.speak(string.format("Режим %s %s.", target, icon)) end end) if not ok then jarvis.log("warn", "profile switch failed: " .. tostring(err)) jarvis.speak("Не удалось переключить режим.") jarvis.audio.play_error() return { chain = false } end jarvis.audio.play_ok() return { chain = true }