@xuda.io/ai_module 1.1.3609 → 1.1.3611

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 +18 -19
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1809,25 +1809,25 @@ export const get_ai_chats = async function (req, job_id, headers) {
1809
1809
  let requests_from = { docs: [] };
1810
1810
 
1811
1811
  if (!reference_id) {
1812
- const from_opt = { selector: { docType: 'team_request', access_type: 'chat', team_req_stat: 2, team_req_to_uid: uid }, fields: ['_id', 'team_req_date', 'sender_account_info.email', 'team_req_from_uid', 'share_item_id'] };
1813
- const requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
1814
-
1815
- for await (let e of requests_from_res.docs) {
1816
- //account_info
1812
+ if (filter_type === 'pending') {
1813
+ const from_opt = { selector: { docType: 'team_request', access_type: 'chat', team_req_stat: 2, team_req_to_uid: uid }, fields: ['_id', 'team_req_date', 'sender_account_info.email', 'team_req_from_uid', 'share_item_id'] };
1814
+ const requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
1817
1815
 
1818
- let doc = { date_created: e.team_req_date, pending: true, uid: e.team_req_from_uid, team_req_id: e._id };
1816
+ for await (let e of requests_from_res.docs) {
1817
+ let doc = { date_created: e.team_req_date, pending: true, uid: e.team_req_from_uid, team_req_id: e._id };
1819
1818
 
1820
- if (e.team_req_from_uid) {
1821
- doc.user_contact = await account_module.get_user_card(uid, e.team_req_from_uid);
1822
- }
1819
+ if (e.team_req_from_uid) {
1820
+ doc.user_contact = await account_module.get_user_card(uid, e.team_req_from_uid);
1821
+ }
1823
1822
 
1824
- //share_item_id
1825
- const app_id = await account_module.get_account_default_project_id(e.team_req_from_uid);
1826
- const chat_ret = await db_module.get_app_couch_doc_native(app_id, e.share_item_id);
1827
- doc.title = chat_ret.title;
1828
- doc.chat_image = chat_ret.chat_image;
1823
+ //share_item_id
1824
+ const app_id = await account_module.get_account_default_project_id(e.team_req_from_uid);
1825
+ const chat_ret = await db_module.get_app_couch_doc_native(app_id, e.share_item_id);
1826
+ doc.title = chat_ret.title;
1827
+ doc.chat_image = chat_ret.chat_image;
1829
1828
 
1830
- requests_from.docs.push(doc);
1829
+ requests_from.docs.push(doc);
1830
+ }
1831
1831
  }
1832
1832
  }
1833
1833
 
@@ -1840,9 +1840,8 @@ export const get_ai_chats = async function (req, job_id, headers) {
1840
1840
  ai_chats = await db_module.find_app_couch_query(app_id, opt);
1841
1841
  }
1842
1842
  let docs = [];
1843
- // for (let row of ai_chats.rows) {
1843
+
1844
1844
  for (let doc of ai_chats.docs || []) {
1845
- // let doc = row.value;
1846
1845
  doc.notifications = 0;
1847
1846
  doc.interactions = doc?.messages?.length || 0;
1848
1847
  for (let msg of doc.messages) {
@@ -5443,7 +5442,7 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
5443
5442
  if (prompt) {
5444
5443
  const ai_avatar_response = await client.images.edit({
5445
5444
  model: 'chatgpt-image-latest', // 'gpt-image-1',
5446
- image: images[0].image_blob, // only one image allowed
5445
+ image: images[0].image_blob, //base photo
5447
5446
  prompt,
5448
5447
  background: 'transparent',
5449
5448
  });
@@ -5463,7 +5462,7 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
5463
5462
  // });
5464
5463
  const ai_avatar_response = await client.images.edit({
5465
5464
  model: 'chatgpt-image-latest',
5466
- image: images[0].image_blob, // only one image allowed
5465
+ image: images[0].image_blob, //base photo
5467
5466
  prompt: `Create a transparent PNG profile image for a business account featuring building branded as ${business_name}.
5468
5467
  Display the attached logo clearly as prominent exterior signage.
5469
5468
  The building’s architecture and overall atmosphere should reflect the nature of the business, aligning with ${mainCategory} and ${subCategory}.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3609",
3
+ "version": "1.1.3611",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",