@xuda.io/ai_module 1.1.4843 → 1.1.4845
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
|
@@ -5200,12 +5200,19 @@ export const get_profile_avatar = async function (profile_picture, uid, prompt,
|
|
|
5200
5200
|
let avatar_source = '';
|
|
5201
5201
|
if (prompt) {
|
|
5202
5202
|
const model = 'chatgpt-image-latest';
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5203
|
+
let ai_avatar_response;
|
|
5204
|
+
try {
|
|
5205
|
+
ai_avatar_response = await client.images.edit({
|
|
5206
|
+
model,
|
|
5207
|
+
image: image_blob_ret.image_blob, //base photo
|
|
5208
|
+
prompt,
|
|
5209
|
+
background: 'transparent',
|
|
5210
|
+
});
|
|
5211
|
+
report_ai_status(model);
|
|
5212
|
+
} catch (err) {
|
|
5213
|
+
report_ai_status(model, err);
|
|
5214
|
+
throw err;
|
|
5215
|
+
}
|
|
5209
5216
|
imageBase64 = ai_avatar_response.data[0].b64_json;
|
|
5210
5217
|
account_module.record_ai_usage(uid, ai_avatar_response.usage.input_tokens, ai_avatar_response.usage.output_tokens, 'profile avatar', prompt, model, { profile_picture }, account_profile_info);
|
|
5211
5218
|
} else {
|
|
@@ -5999,16 +6006,22 @@ const attachment_handler = async function (uid, app_id, conversation_id, attachm
|
|
|
5999
6006
|
} catch (error) {
|
|
6000
6007
|
process_stat = 'partial';
|
|
6001
6008
|
}
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
items
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
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
|
+
}
|
|
6012
6025
|
|
|
6013
6026
|
let out_conversation_item_obj = {
|
|
6014
6027
|
_id: await _common.xuda_get_uuid('chat_conversation_item'),
|