diff --git a/components/control_plane/src/multimodal/control_plane_model_command_extractor.c b/components/control_plane/src/multimodal/control_plane_model_command_extractor.c index ea00968..f88ca13 100644 --- a/components/control_plane/src/multimodal/control_plane_model_command_extractor.c +++ b/components/control_plane/src/multimodal/control_plane_model_command_extractor.c @@ -6,6 +6,7 @@ #include "control_plane_internal.h" +#include #include #include "cJSON.h" @@ -31,6 +32,25 @@ static bool is_supported_model_direction(const char *value) return false; } +static const char *find_command_prefix(const char *text) +{ + const char *cursor = text; + + if (cursor == NULL) { + return NULL; + } + + while (*cursor != '\0' && isspace((unsigned char)*cursor)) { + cursor++; + } + + if (cursor[0] == '/' && cursor[1] == '*') { + return cursor; + } + + return strstr(cursor, "/*{"); +} + bool control_plane_extract_model_command(const char *text, control_plane_model_command_type_t *out_command_type, char *out_value, @@ -44,11 +64,12 @@ bool control_plane_extract_model_command(const char *text, *out_command_type = CONTROL_PLANE_MODEL_COMMAND_UNKNOWN; out_value[0] = '\0'; - if (text[0] != '/' || text[1] != '*') { + const char *command_start = find_command_prefix(text); + if (command_start == NULL || command_start[0] != '/' || command_start[1] != '*') { return false; } - const char *json_start = text + 2; + const char *json_start = command_start + 2; const char *json_end = strstr(json_start, "*/"); if (json_end == NULL) { return false; diff --git a/components/control_plane/src/runtime/control_plane_connectivity_runtime.c b/components/control_plane/src/runtime/control_plane_connectivity_runtime.c index dd80438..45b15f2 100644 --- a/components/control_plane/src/runtime/control_plane_connectivity_runtime.c +++ b/components/control_plane/src/runtime/control_plane_connectivity_runtime.c @@ -30,6 +30,7 @@ #define CONTROL_PLANE_STA_RETRY_BASE_DELAY_MS 300 static const char *TAG = "control_plane_rt"; +static bool s_wifi_success_prompt_played; static int elapsed_ms_since(TickType_t start_tick) { @@ -80,6 +81,11 @@ static int control_plane_normalize_connect_timeout_ms(int timeout_ms, int min_ti static void control_plane_play_wifi_success_prompt(void) { + if (s_wifi_success_prompt_played) { + return; + } + s_wifi_success_prompt_played = true; + bool played = false; esp_err_t audio_err = domain_runtime_multimodal_audio_init(); if (audio_err != ESP_OK && audio_err != ESP_ERR_INVALID_STATE) {