@xuda.io/ai_module 1.1.4566 → 1.1.4568

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 +5 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4119,7 +4119,7 @@ export const create_conversation = async function (req, job_id, headers) {
4119
4119
  const conversation_obj = await client.conversations.create();
4120
4120
  const t = Date.now();
4121
4121
  let conversation_doc = {
4122
- _id: conversation_obj.id,
4122
+ _id: await _common.xuda_get_uuid('chat_conversation'),
4123
4123
  docType: 'chat_conversation',
4124
4124
  title: conversation_type !== 'email' ? getFirstNWords(prompt, 10) : prompt,
4125
4125
  date_created_ts: t,
@@ -4134,6 +4134,7 @@ export const create_conversation = async function (req, job_id, headers) {
4134
4134
  initiator_uid: uid,
4135
4135
  email_direction,
4136
4136
  email_id,
4137
+ reference_conversation_id: conversation_obj.id,
4137
4138
 
4138
4139
  account_profiles: [account_profile_obj._id],
4139
4140
  };
@@ -4531,19 +4532,17 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4531
4532
  const conversation_id = conversation_doc._id;
4532
4533
 
4533
4534
  const obj = { id: output.state._lastTurnResponse.responseId, ts: Date.now(), ai_agent_id: output.state._currentAgent.name, attachments, conversation_type: 'ai_chat' };
4534
- let conversation_item_obj = {
4535
- _id: obj.id,
4535
+ let out_conversation_item_obj = {
4536
+ _id: await _common.xuda_get_uuid('chat_conversation_item'),
4536
4537
  stat: 1,
4537
4538
  docType: 'chat_conversation_item',
4538
4539
  uid,
4539
- conversation_type: obj.conversation_type,
4540
+ conversation_type: 'ai_chat',
4540
4541
  type: obj.conversation_type,
4541
4542
  date_created_ts: Date.now(),
4542
4543
  ts: Date.now(),
4543
4544
  conversation_id,
4544
-
4545
4545
  text: prompt,
4546
-
4547
4546
  reference_id: conversation_doc.reference_id,
4548
4547
  direction: 'out',
4549
4548
  role: 'user',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4566",
3
+ "version": "1.1.4568",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",