Merge pull request #1444 from hopyky/fix-message-path-parameter
Fix: Support path and filePath parameters in message send action
This commit is contained in:
@@ -340,6 +340,16 @@ export function createMessageTool(options?: MessageToolOptions): AnyAgentTool {
|
|||||||
const action = readStringParam(params, "action", {
|
const action = readStringParam(params, "action", {
|
||||||
required: true,
|
required: true,
|
||||||
}) as ChannelMessageActionName;
|
}) as ChannelMessageActionName;
|
||||||
|
|
||||||
|
// Handle path and filePath parameters: convert to media with file:// URL
|
||||||
|
if (action === "send" && !params.media) {
|
||||||
|
const filePath =
|
||||||
|
(params.path as string | undefined) || (params.filePath as string | undefined);
|
||||||
|
if (filePath) {
|
||||||
|
params.media = filePath.startsWith("file://") ? filePath : `file://${filePath}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const accountId = readStringParam(params, "accountId") ?? agentAccountId;
|
const accountId = readStringParam(params, "accountId") ?? agentAccountId;
|
||||||
|
|
||||||
const gateway = {
|
const gateway = {
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ async function hydrateSendAttachmentParams(params: {
|
|||||||
action: ChannelMessageActionName;
|
action: ChannelMessageActionName;
|
||||||
dryRun?: boolean;
|
dryRun?: boolean;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
if (params.action !== "sendAttachment") return;
|
if (params.action !== "sendAttachment" && params.action !== "send") return;
|
||||||
|
|
||||||
const mediaHint = readStringParam(params.args, "media", { trim: false });
|
const mediaHint = readStringParam(params.args, "media", { trim: false });
|
||||||
const fileHint =
|
const fileHint =
|
||||||
|
|||||||
Reference in New Issue
Block a user