@xuda.io/ai_module 1.1.4545 → 1.1.4547

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.
Files changed (2) hide show
  1. package/index.mjs +3 -5
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4450,13 +4450,11 @@ const chat_email = async function (req, job_id, headers) {
4450
4450
  sort: [{ date_created_ts: 'desc' }],
4451
4451
  });
4452
4452
 
4453
- if (chat_conversation_item.docs.length) {
4454
- throw new Error('the email already processed');
4455
- }
4453
+ const last_email_item = chat_conversation_item.docs[0];
4456
4454
 
4457
4455
  //////////
4458
4456
 
4459
- let subject = _thread_reentry ? '' : body;
4457
+ let subject = last_email_item?.subject ? '' : body;
4460
4458
  if (body.split(' ').length > 10) {
4461
4459
  const subject_ret = await submit_chat_gpt_prompt({ uid, prompt: `create title for the prompt return 5 words result maximum text only without options : ${body}`, model: 'gpt-5-nano', metadata: { conversation_id: conversation_doc._id, func: 'chat_email' }, account_profile_info });
4462
4460
  if (subject_ret.code < 0) {
@@ -4498,7 +4496,7 @@ const chat_email = async function (req, job_id, headers) {
4498
4496
  sender_conversation_doc.messages.push(obj);
4499
4497
  await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4500
4498
 
4501
- const save_ret = await db_module.save_app_couch_doc_native(sender_app_id, { _id: obj.id, stat: 3, docType: 'chat_conversation_item', sent_email_result, ts: obj.ts, uid, conversation_type: obj.conversation_type, date_created_ts: obj.ts, conversation_id, body, email_id });
4499
+ const save_ret = await db_module.save_app_couch_doc_native(sender_app_id, { _id: obj.id, stat: 3, docType: 'chat_conversation_item', sent_email_result, ts: obj.ts, uid, conversation_type: obj.conversation_type, date_created_ts: obj.ts, conversation_id, body, email_id, subject });
4502
4500
 
4503
4501
  return save_ret;
4504
4502
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4545",
3
+ "version": "1.1.4547",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",