Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicarq committed Dec 31, 2024
1 parent a0dc4fc commit 4548767
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
5 changes: 3 additions & 2 deletions libs/shinkai-message-ts/src/api/jobs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export type JobMessageRequest = {
content: string;
parent: string | null;
tool_key?: string;
files?: string[];
fs_files_paths?: string[];
job_filenames?: string[];
};
};
export type JobMessageResponse = {
Expand Down Expand Up @@ -170,7 +171,7 @@ export type AddFileToInboxRequest = {
};
export type AddFileToInboxResponse = {
message: string;
path: string;
filename: string;
};

export type LLMProvider = {
Expand Down
7 changes: 3 additions & 4 deletions libs/shinkai-message-ts/src/api/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,15 @@ export const sendTextMessageWithFilesToJob = async (
);

// Extract file paths from the upload responses
const filePaths = uploadResponses.map(response => response.path);

console.log('filePaths: ', filePaths);
const filenames = uploadResponses.map(response => response.filename);

// Prepare the message payload
const messagePayload = {
job_message: {
job_id,
content: text_message,
files: filePaths,
fs_files_paths: [],
job_filenames: filenames,
},
};

Expand Down
7 changes: 4 additions & 3 deletions libs/shinkai-node-state/src/v2/mutations/createJob/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export const createJob = async ({
});
}

let filePaths: string[] = [];
let filenames: string[] = [];
if (files && files.length > 0) {
const uploadResponses = await uploadFilesToJob(nodeAddress, token, jobId, files);
filePaths = uploadResponses.map(response => response.path);
filenames = uploadResponses.map(response => response.filename);
}

await sendMessageToJob(nodeAddress, token, {
Expand All @@ -51,7 +51,8 @@ export const createJob = async ({
job_id: jobId,
parent: '',
tool_key: toolKey,
files: filePaths,
fs_files_paths: [],
job_filenames: filenames,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export const sendMessageToJob = async ({
files,
toolKey,
}: SendMessageToJobInput) => {
let filePaths: string[] = [];
let filenames: string[] = [];
if (files && files.length > 0) {
const uploadResponses = await uploadFilesToJob(nodeAddress, token, jobId, files);
filePaths = uploadResponses.map(response => response.path);
filenames = uploadResponses.map(response => response.filename);
}

return await sendMessageToJobApi(nodeAddress, token, {
Expand All @@ -26,7 +26,8 @@ export const sendMessageToJob = async ({
job_id: jobId,
parent: parent,
tool_key: toolKey,
files: filePaths,
fs_files_paths: [],
job_filenames: filenames,
},
});
};

0 comments on commit 4548767

Please sign in to comment.