-
Notifications
You must be signed in to change notification settings - Fork 765
Add WiFi Scan Tool, System Info Tool, and Moonshot Provider Support #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,14 +80,16 @@ | |
| #define MIMI_AGENT_SEND_WORKING_STATUS 1 | ||
|
|
||
| /* Timezone (POSIX TZ format) */ | ||
| #define MIMI_TIMEZONE "PST8PDT,M3.2.0,M11.1.0" | ||
| #define MIMI_TIMEZONE "CST-8" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't change the global default timezone in this PR.
🤖 Prompt for AI Agents |
||
|
|
||
| /* LLM */ | ||
| #define MIMI_LLM_DEFAULT_MODEL "claude-opus-4-5" | ||
| #define MIMI_LLM_PROVIDER_DEFAULT "anthropic" | ||
| #define MIMI_LLM_MAX_TOKENS 4096 | ||
| #define MIMI_LLM_API_URL "https://api.anthropic.com/v1/messages" | ||
| #define MIMI_OPENAI_API_URL "https://api.openai.com/v1/chat/completions" | ||
| #define MIMI_MOONSHOT_API_URL "https://api.moonshot.cn/v1/chat/completions" | ||
| #define MIMI_HUNYUAN_API_URL "https://api.hunyuan.cloud.tencent.com/v1/chat/completions" | ||
| #define MIMI_LLM_API_VERSION "2023-06-01" | ||
| #define MIMI_LLM_STREAM_BUF_SIZE (32 * 1024) | ||
| #define MIMI_LLM_LOG_VERBOSE_PAYLOAD 0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| #include "tool_system_info.h" | ||
| #include "mimi_config.h" | ||
|
|
||
| #include <string.h> | ||
| #include <stdlib.h> | ||
| #include "esp_log.h" | ||
| #include "esp_system.h" | ||
| #include "esp_heap_caps.h" | ||
| #include "esp_chip_info.h" | ||
| #include "esp_timer.h" | ||
| #include "esp_wifi.h" | ||
| #include "esp_flash.h" | ||
| #include "freertos/FreeRTOS.h" | ||
| #include "freertos/task.h" | ||
|
|
||
| static const char *TAG = "system_info"; | ||
|
|
||
| esp_err_t tool_system_info_init(void) | ||
| { | ||
| ESP_LOGI(TAG, "System info tool initialized"); | ||
| return ESP_OK; | ||
| } | ||
|
|
||
| esp_err_t tool_system_info_execute(const char *input_json, char *output, size_t output_size) | ||
| { | ||
| ESP_LOGI(TAG, "Getting system info..."); | ||
|
|
||
| /* Get chip info */ | ||
| esp_chip_info_t chip_info; | ||
| esp_chip_info(&chip_info); | ||
|
|
||
| /* Get heap info */ | ||
| size_t free_heap = heap_caps_get_free_size(MALLOC_CAP_DEFAULT); | ||
| size_t free_psram = heap_caps_get_free_size(MALLOC_CAP_SPIRAM); | ||
| size_t total_heap = heap_caps_get_total_size(MALLOC_CAP_DEFAULT); | ||
| size_t total_psram = heap_caps_get_total_size(MALLOC_CAP_SPIRAM); | ||
|
|
||
| /* Get system uptime */ | ||
| int64_t uptime_ms = esp_timer_get_time() / 1000; | ||
| int uptime_hours = uptime_ms / (1000 * 60 * 60); | ||
| int uptime_minutes = (uptime_ms / (1000 * 60)) % 60; | ||
| int uptime_seconds = (uptime_ms / 1000) % 60; | ||
|
|
||
| /* Get WiFi status */ | ||
| wifi_ap_record_t ap_info; | ||
| wifi_sta_list_t sta_list; | ||
| char wifi_status[256] = "Disconnected"; | ||
|
|
||
| esp_wifi_ap_get_sta_list(&sta_list); | ||
| if (esp_wifi_sta_get_ap_info(&ap_info) == ESP_OK) { | ||
| snprintf(wifi_status, sizeof(wifi_status), "Connected to %s (RSSI: %d dBm, Channel: %d)", | ||
| (char*)ap_info.ssid, ap_info.rssi, ap_info.primary); | ||
| } | ||
|
|
||
| /* Get task info */ | ||
| UBaseType_t uxHighWaterMark = uxTaskGetStackHighWaterMark(NULL); | ||
|
|
||
| /* Get flash size */ | ||
| uint32_t flash_size; | ||
| esp_flash_get_size(NULL, &flash_size); | ||
|
|
||
| /* Format the result */ | ||
| int written = snprintf(output, output_size, | ||
| "=== System Information ===\n" | ||
| "Chip: ESP32-S3\n" | ||
| "Features: %s%s%s%s\n" | ||
| "Flash Size: %u MB\n" | ||
| "RAM: %u KB free / %u KB total\n" | ||
| "PSRAM: %u KB free / %u KB total\n" | ||
| "Uptime: %d:%02d:%02d\n" | ||
| "WiFi: %s\n" | ||
| "Stack High Water Mark: %u bytes\n" | ||
| "FreeRTOS Version: %s\n" | ||
| "ESP-IDF Version: %s\n" | ||
| "MimiClaw Version: v0.1.0", | ||
| (chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi " : "", | ||
| (chip_info.features & CHIP_FEATURE_BLE) ? "BLE " : "", | ||
| (chip_info.features & CHIP_FEATURE_BT) ? "BT " : "", | ||
| (chip_info.features & CHIP_FEATURE_EMB_PSRAM) ? "PSRAM" : "", | ||
| (unsigned int)(flash_size / (1024 * 1024)), | ||
| (unsigned int)(free_heap / 1024), (unsigned int)(total_heap / 1024), | ||
| (unsigned int)(free_psram / 1024), (unsigned int)(total_psram / 1024), | ||
| uptime_hours, uptime_minutes, uptime_seconds, | ||
| wifi_status, | ||
| (unsigned int)uxHighWaterMark, | ||
| tskKERNEL_VERSION_NUMBER, | ||
| IDF_VER); | ||
|
|
||
| if (written < 0 || (size_t)written >= output_size) { | ||
| ESP_LOGE(TAG, "Output buffer too small"); | ||
| return ESP_ERR_NO_MEM; | ||
| } | ||
|
|
||
| ESP_LOGI(TAG, "System info collected"); | ||
| return ESP_OK; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #pragma once | ||
|
|
||
| #include <stddef.h> | ||
| #include "esp_err.h" | ||
|
|
||
| esp_err_t tool_system_info_execute(const char *input_json, char *output, size_t output_size); | ||
| esp_err_t tool_system_info_init(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tools table is missing
system_info, so docs are now incomplete.system_infois registered and exposed (seemain/tools/tool_registry.c, Lines 212-218), but it is not listed in this table. Please add it here (and mirror in localized READMEs) so users discover all available tools.📝 Proposed doc patch
| `cron_remove` | Remove a cron job by ID | | `wifi_scan` | Scan for nearby WiFi networks and return details like SSID, signal strength, and security status | +| `system_info` | Get system diagnostics including chip details, memory usage, WiFi status, and uptime |📝 Committable suggestion
🤖 Prompt for AI Agents