@xuda.io/ai_module 1.1.4844 → 1.1.4846
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 +29 -16
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -6006,16 +6006,22 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
|
|
|
6006
6006
|
} catch (error) {
|
|
6007
6007
|
process_stat = 'partial';
|
|
6008
6008
|
}
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
items
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6009
|
+
let items;
|
|
6010
|
+
try {
|
|
6011
|
+
items = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
|
|
6012
|
+
items: [
|
|
6013
|
+
{
|
|
6014
|
+
type: 'message',
|
|
6015
|
+
role: 'system',
|
|
6016
|
+
content: [{ type: 'input_text', text: `the user attached file name: ${file.filename} with content: ${transcript?.data || transcript || ''}` }],
|
|
6017
|
+
},
|
|
6018
|
+
],
|
|
6019
|
+
});
|
|
6020
|
+
report_ai_status('conversations');
|
|
6021
|
+
} catch (err) {
|
|
6022
|
+
report_ai_status('conversations', err);
|
|
6023
|
+
throw err;
|
|
6024
|
+
}
|
|
6019
6025
|
|
|
6020
6026
|
let out_conversation_item_obj = {
|
|
6021
6027
|
_id: await _common.xuda_get_uuid('chat_conversation_item'),
|
|
@@ -6281,12 +6287,19 @@ export const get_profile_picture = async function (uid, account_type = 'business
|
|
|
6281
6287
|
const prompt = `
|
|
6282
6288
|
extract the logo from the image
|
|
6283
6289
|
`;
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
+
let image_response;
|
|
6291
|
+
try {
|
|
6292
|
+
image_response = await client.images.edit({
|
|
6293
|
+
model,
|
|
6294
|
+
image: image_blob_ret.image_blob,
|
|
6295
|
+
prompt,
|
|
6296
|
+
background: 'transparent',
|
|
6297
|
+
});
|
|
6298
|
+
report_ai_status(model);
|
|
6299
|
+
} catch (err) {
|
|
6300
|
+
report_ai_status(model, err);
|
|
6301
|
+
throw err;
|
|
6302
|
+
}
|
|
6290
6303
|
|
|
6291
6304
|
imageBase64 = await normalizeBase64To1024(image_response.data[0].b64_json, resize);
|
|
6292
6305
|
account_module.record_ai_usage(uid, image_response.usage.input_tokens, image_response.usage.output_tokens, 'profile image', prompt, model, { url }, account_profile_info);
|