@xuda.io/ai_module 1.1.4779 → 1.1.4781
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/index.mjs +16 -14
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -7047,7 +7047,9 @@ export const get_profile_picture = async function (uid, account_type = 'business
|
|
|
7047
7047
|
}
|
|
7048
7048
|
url = '';
|
|
7049
7049
|
}
|
|
7050
|
-
}
|
|
7050
|
+
}
|
|
7051
|
+
|
|
7052
|
+
if (!url) {
|
|
7051
7053
|
// first attempt
|
|
7052
7054
|
if (account_type === 'business') {
|
|
7053
7055
|
url = await get_url();
|
|
@@ -7096,24 +7098,24 @@ export const get_profile_picture = async function (uid, account_type = 'business
|
|
|
7096
7098
|
imageBase64 = await normalizeBase64To1024(image_response.data[0].b64_json, resize);
|
|
7097
7099
|
account_module.record_ai_usage(uid, image_response.usage.input_tokens, image_response.usage.output_tokens, 'profile image', prompt, model, { url }, account_profile_info);
|
|
7098
7100
|
}
|
|
7099
|
-
}
|
|
7100
|
-
const outputBuffer = Buffer.from(imageBase64, 'base64');
|
|
7101
|
-
const outputPath = tempOutputPath;
|
|
7102
|
-
await fs.promises.writeFile(outputPath, outputBuffer);
|
|
7103
7101
|
|
|
7104
|
-
|
|
7102
|
+
const outputBuffer = Buffer.from(imageBase64, 'base64');
|
|
7103
|
+
const outputPath = tempOutputPath;
|
|
7104
|
+
await fs.promises.writeFile(outputPath, outputBuffer);
|
|
7105
7105
|
|
|
7106
|
-
|
|
7106
|
+
console.log('Success! Saved →', outputPath);
|
|
7107
7107
|
|
|
7108
|
-
|
|
7109
|
-
originalname,
|
|
7110
|
-
path: outputPath,
|
|
7111
|
-
mimetype: `image/png`,
|
|
7112
|
-
};
|
|
7108
|
+
console.log(file);
|
|
7113
7109
|
|
|
7114
|
-
|
|
7115
|
-
|
|
7110
|
+
const file_obj = {
|
|
7111
|
+
originalname,
|
|
7112
|
+
path: outputPath,
|
|
7113
|
+
mimetype: `image/png`,
|
|
7114
|
+
};
|
|
7116
7115
|
|
|
7116
|
+
let drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
|
|
7117
|
+
drive_ret.profile_picture_source = profile_picture_source;
|
|
7118
|
+
}
|
|
7117
7119
|
return drive_ret;
|
|
7118
7120
|
} catch (err) {
|
|
7119
7121
|
console.error(err);
|