forked from xiaozhi/xiaozhi-esp32
Bump to v1.9.0 (#1157)
* update v2 partition table readme * feat: Add user only tool * Add image cache * smaller cache and buffer, more heap * use MAIN_EVENT_CLOCK_TICK to avoid audio glitches * fix: esp_psram_get_size not found in c3 * Bump to 1.9.0
This commit is contained in:
@@ -29,12 +29,17 @@ McpServer::~McpServer() {
|
||||
}
|
||||
|
||||
void McpServer::AddCommonTools() {
|
||||
// To speed up the response time, we add the common tools to the beginning of
|
||||
// *Important* To speed up the response time, we add the common tools to the beginning of
|
||||
// the tools list to utilize the prompt cache.
|
||||
// **重要** 为了提升响应速度,我们把常用的工具放在前面,利用 prompt cache 的特性。
|
||||
|
||||
// Backup the original tools list and restore it after adding the common tools.
|
||||
auto original_tools = std::move(tools_);
|
||||
auto& board = Board::GetInstance();
|
||||
|
||||
// Do not add custom tools here.
|
||||
// Custom tools must be added in the board's InitializeTools function.
|
||||
|
||||
AddTool("self.get_device_status",
|
||||
"Provides the real-time information of the device, including the current status of the audio speaker, screen, battery, network, etc.\n"
|
||||
"Use this tool for: \n"
|
||||
@@ -122,6 +127,12 @@ void McpServer::AddTool(const std::string& name, const std::string& description,
|
||||
AddTool(new McpTool(name, description, properties, callback));
|
||||
}
|
||||
|
||||
void McpServer::AddUserOnlyTool(const std::string& name, const std::string& description, const PropertyList& properties, std::function<ReturnValue(const PropertyList&)> callback) {
|
||||
auto tool = new McpTool(name, description, properties, callback);
|
||||
tool->set_user_only(true);
|
||||
AddTool(tool);
|
||||
}
|
||||
|
||||
void McpServer::ParseMessage(const std::string& message) {
|
||||
cJSON* json = cJSON_Parse(message.c_str());
|
||||
if (json == nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user