feat: add working indicator and get_current_time to system prompt
Send "mimi😗is working..." to user when processing starts. List get_current_time in system prompt available tools so the agent knows to call it for time/date queries. Remove auto time fetch from system prompt builder — agent calls the tool on demand. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -149,6 +149,7 @@ MimiClaw uses Anthropic's tool use protocol — Claude can call tools during a c
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `web_search` | Search the web via Brave Search API for current information |
|
||||
| `get_current_time` | Fetch current date/time via HTTP and set the system clock |
|
||||
|
||||
To enable web search, set a [Brave Search API key](https://brave.com/search/api/) in your config file or via CLI (`set_search_key`).
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ MimiClaw 使用 Anthropic 的 tool use 协议 — Claude 在对话中可以调
|
||||
| 工具 | 说明 |
|
||||
|------|------|
|
||||
| `web_search` | 通过 Brave Search API 搜索网页,获取实时信息 |
|
||||
| `get_current_time` | 通过 HTTP 获取当前日期和时间,并设置系统时钟 |
|
||||
|
||||
启用网页搜索需要设置 [Brave Search API key](https://brave.com/search/api/),在配置文件或 CLI(`set_search_key`)中设置。
|
||||
|
||||
|
||||
@@ -100,6 +100,15 @@ static void agent_loop_task(void *arg)
|
||||
|
||||
ESP_LOGI(TAG, "Processing message from %s:%s", msg.channel, msg.chat_id);
|
||||
|
||||
/* Send "working" indicator */
|
||||
{
|
||||
mimi_msg_t status = {0};
|
||||
strncpy(status.channel, msg.channel, sizeof(status.channel) - 1);
|
||||
strncpy(status.chat_id, msg.chat_id, sizeof(status.chat_id) - 1);
|
||||
status.content = strdup("mimi\xF0\x9F\x98\x97is working...");
|
||||
if (status.content) message_bus_push_outbound(&status);
|
||||
}
|
||||
|
||||
/* 1. Build system prompt */
|
||||
context_build_system_prompt(system_prompt, MIMI_CONTEXT_BUF_SIZE);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "esp_log.h"
|
||||
#include "cJSON.h"
|
||||
|
||||
@@ -30,26 +29,18 @@ esp_err_t context_build_system_prompt(char *buf, size_t size)
|
||||
{
|
||||
size_t off = 0;
|
||||
|
||||
/* Identity header */
|
||||
time_t now;
|
||||
time(&now);
|
||||
struct tm tm;
|
||||
localtime_r(&now, &tm);
|
||||
char time_str[64];
|
||||
strftime(time_str, sizeof(time_str), "%Y-%m-%d %H:%M (%A)", &tm);
|
||||
|
||||
off += snprintf(buf + off, size - off,
|
||||
"# MimiClaw\n\n"
|
||||
"You are MimiClaw, a personal AI assistant running on an ESP32-S3 device.\n"
|
||||
"You communicate through Telegram and WebSocket.\n\n"
|
||||
"## Current Time\n%s\n\n"
|
||||
"Be helpful, accurate, and concise.\n\n"
|
||||
"## Available Tools\n"
|
||||
"You have access to the following tools:\n"
|
||||
"- web_search: Search the web for current information. "
|
||||
"Use this when you need up-to-date facts, news, weather, or anything beyond your training data.\n\n"
|
||||
"Use tools when needed. Provide your final answer as text after using tools.\n",
|
||||
time_str);
|
||||
"Use this when you need up-to-date facts, news, weather, or anything beyond your training data.\n"
|
||||
"- get_current_time: Get the current date and time. "
|
||||
"You do NOT have an internal clock — always use this tool when you need to know the time or date.\n\n"
|
||||
"Use tools when needed. Provide your final answer as text after using tools.\n");
|
||||
|
||||
/* Bootstrap files */
|
||||
off = append_file(buf, size, off, MIMI_SOUL_FILE, "Personality");
|
||||
|
||||
Reference in New Issue
Block a user