@mote-farm/sandbox 0.2.0-rc.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/mote-farm-sandbox.mjs +20 -19
- package/dist/pi-extension.js +3 -2
- package/package.json +1 -1
package/dist/pi-extension.js
CHANGED
|
@@ -10,16 +10,17 @@ function moteFarmFiles(pi) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
function keep(event, cwd, part, index) {
|
|
13
|
+
const chinese = process.env.MOTE_FARM_LOCALE === "zh-CN";
|
|
13
14
|
if (part.type === "image") {
|
|
14
15
|
const path2 = event.toolName === "read" && typeof event.input.path === "string" ? resolve(cwd, event.input.path) : save(event, index, part.mimeType.split("/")[1] ?? "bin", Buffer.from(part.data, "base64"));
|
|
15
|
-
return { type: "text", text: `[${part.mimeType} image at ${path2}; images stay out of the conversation, so refer to it by path]` };
|
|
16
|
+
return { type: "text", text: chinese ? `[${part.mimeType} \u56FE\u50CF\u4F4D\u4E8E ${path2}\uFF1B\u56FE\u50CF\u4E0D\u8FDB\u5165\u5BF9\u8BDD\uFF0C\u8BF7\u901A\u8FC7\u8DEF\u5F84\u5F15\u7528]` : `[${part.mimeType} image at ${path2}; images stay out of the conversation, so refer to it by path]` };
|
|
16
17
|
}
|
|
17
18
|
if (part.text.length <= TOOL_TEXT_CHARS) return part;
|
|
18
19
|
const path = save(event, index, "txt", part.text);
|
|
19
20
|
return {
|
|
20
21
|
type: "text",
|
|
21
22
|
text: `${part.text.slice(0, TOOL_TEXT_CHARS)}
|
|
22
|
-
[cut at ${TOOL_TEXT_CHARS} of ${part.text.length} characters; all of it is in ${path}]`
|
|
23
|
+
${chinese ? `[\u5171 ${part.text.length} \u4E2A\u5B57\u7B26\uFF0C\u4FDD\u7559\u524D ${TOOL_TEXT_CHARS} \u4E2A\uFF1B\u5B8C\u6574\u5185\u5BB9\u4F4D\u4E8E ${path}]` : `[cut at ${TOOL_TEXT_CHARS} of ${part.text.length} characters; all of it is in ${path}]`}`
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
function save(event, index, extension, data) {
|