chore(tool): localize send_file success message and use English Javadoc

This commit is contained in:
matevip 2026-05-22 16:32:10 +08:00
parent f16021690f
commit 773c64bfd7
3 changed files with 10 additions and 8 deletions

View File

@ -16,13 +16,15 @@ import java.nio.file.Path;
import java.util.Map;
/**
* 内置工具将服务器上的现有文件发送给用户
* Built-in tool: send an existing server file to the user.
* <p>
* 读取指定路径的文件放入 {@link GeneratedFileCache} 生成临时下载链接
* 由渠道适配器飞书/钉钉/Telegram 自动检测并作为原生附件发送
* Reads the file at the given path and stores it in {@link GeneratedFileCache}
* to mint a short-lived download link, which channel adapters (Feishu, DingTalk,
* Telegram, etc.) auto-detect and deliver as a native attachment.
* <p>
* {@link ReadFileTool} 不同此工具处理任意文件类型包括二进制文件
* 目标是将文件作为附件发送而非读取其文本内容
* Unlike {@link ReadFileTool}, this handles any file type (including binary
* files): the goal is to deliver the file as an attachment rather than read
* its text content.
*
* @author MateClaw Team
*/
@ -128,9 +130,7 @@ public class SendFileTool {
// adapter's GeneratedFileScrubber detects the URL and sends the
// file as a native attachment. The LLM MUST echo the URL in its
// reply for the scrubber to pick it up.
return displayName + " 已发送:[" + displayName + "](" + url + ")(链接 10 分钟内有效)。\n"
+ "重要:回答用户时**必须**使用上述相对路径 `" + url + "`"
+ "**不要**添加任何 https://、http:// 域名前缀,前端会自动拼接当前主机。";
return i18n.msg("tool.send_file.success", displayName, url);
} catch (Exception e) {
log.error("[SendFile] Failed to send file: {}", e.getMessage(), e);

View File

@ -324,3 +324,4 @@ chat.stopMarker.userAborted=[\u5df2\u88ab\u7528\u6237\u4e2d\u6b62]
# --- Tool: send_file ---
tool.send_file.error.too_large=\u6587\u4ef6\u8fc7\u5927\uff1a{0}MB \u8d85\u51fa\u9650\u5236 {1}MB
tool.send_file.error.failed=\u53d1\u9001\u6587\u4ef6\u5931\u8d25\uff1a{0}
tool.send_file.success={0} \u5df2\u53d1\u9001\uff1a[{0}]({1})\uff08\u94fe\u63a5 10 \u5206\u949f\u5185\u6709\u6548\uff09\u3002\n\u91cd\u8981\uff1a\u56de\u7b54\u7528\u6237\u65f6**\u5fc5\u987b**\u4f7f\u7528\u4e0a\u8ff0\u76f8\u5bf9\u8def\u5f84 `{1}`\uff0c**\u4e0d\u8981**\u6dfb\u52a0\u4efb\u4f55 https://\u3001http:// \u57df\u540d\u524d\u7f00\uff0c\u524d\u7aef\u4f1a\u81ea\u52a8\u62fc\u63a5\u5f53\u524d\u4e3b\u673a\u3002

View File

@ -331,3 +331,4 @@ chat.stopMarker.userAborted=[Stopped by user]
# --- Tool: send_file ---
tool.send_file.error.too_large=File too large: {0}MB exceeds limit of {1}MB
tool.send_file.error.failed=Failed to send file: {0}
tool.send_file.success={0} sent: [{0}]({1}) (link valid for 10 minutes).\nIMPORTANT: when replying to the user you **must** use the relative path `{1}` exactly; do **not** prepend any https:// or http:// host. The frontend will prepend the current host automatically.