@xuda.io/ai_module 1.1.5414 → 1.1.5416

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 +36 -35
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1274,7 +1274,7 @@ export const get_ai_chats = async function (req, job_id, headers) {
1274
1274
  ],
1275
1275
  };
1276
1276
  }
1277
- debugger;
1277
+
1278
1278
  let ai_chats = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
1279
1279
  if (!limit || conversation_id) {
1280
1280
  ai_chats.total_docs = ai_chats.docs.length;
@@ -2062,7 +2062,7 @@ export const get_ai_agents = async function (req, job_id, headers) {
2062
2062
 
2063
2063
  ////// FROM - IN
2064
2064
  let requests_from = { docs: [], total_docs: 0 };
2065
- if (filter_type === 'pending') {
2065
+ if (filter_type === 'pending' && account_profile_info.is_main) {
2066
2066
  const from_opt = { selector: { docType: 'team_request', access_type: 'ai_agent', 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'] };
2067
2067
  const requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
2068
2068
 
@@ -2440,7 +2440,7 @@ export const get_apps = async function (req, job_id, headers) {
2440
2440
 
2441
2441
  let requests_from = { docs: [], total_docs: 0 };
2442
2442
  if (!mini_app_id) {
2443
- if (filter_type === 'pending') {
2443
+ if (filter_type === 'pending' && account_profile_info.is_main) {
2444
2444
  const from_opt = { selector: { docType: 'team_request', access_type: 'miniapp', 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'] };
2445
2445
  const requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
2446
2446
 
@@ -6137,48 +6137,49 @@ export const modify_profile_avatar = async function (req, job_id, headers) {
6137
6137
 
6138
6138
  export const get_ai_workspace_pending_counts = async function (req, job_id, headers) {
6139
6139
  const { uid } = req;
6140
-
6140
+ const account_profile_info = await get_active_account_profile_info(uid);
6141
6141
  try {
6142
- const workspace_pending_counts_ret = await db_module.get_couch_view('xuda_team', 'pending_workspace_requests_count', {
6143
- startkey: [uid, ''],
6144
- endkey: [uid, 'zzzz'],
6145
- reduce: true,
6146
- group_level: 999,
6147
- });
6148
-
6149
6142
  let data = {};
6150
- for (const item of workspace_pending_counts_ret.data.rows) {
6151
- switch (item.key[1]) {
6152
- case 'chat':
6153
- data['ai_chats'] = item.value;
6154
- break;
6143
+ if (!account_profile_info.is_main) {
6144
+ const workspace_pending_counts_ret = await db_module.get_couch_view('xuda_team', 'pending_workspace_requests_count', {
6145
+ startkey: [uid, ''],
6146
+ endkey: [uid, 'zzzz'],
6147
+ reduce: true,
6148
+ group_level: 999,
6149
+ });
6155
6150
 
6156
- case 'ai_agent':
6157
- data['ai_agents'] = item.value;
6158
- break;
6151
+ for (const item of workspace_pending_counts_ret.data.rows) {
6152
+ switch (item.key[1]) {
6153
+ case 'chat':
6154
+ data['ai_chats'] = item.value;
6155
+ break;
6159
6156
 
6160
- case 'miniapp':
6161
- data['apps'] = item.value;
6162
- break;
6157
+ case 'ai_agent':
6158
+ data['ai_agents'] = item.value;
6159
+ break;
6163
6160
 
6164
- case 'contact_connection':
6165
- case 'contact':
6166
- data['contacts'] = item.value;
6167
- break;
6161
+ case 'miniapp':
6162
+ data['apps'] = item.value;
6163
+ break;
6168
6164
 
6169
- case 'account_profile':
6170
- data['account_profiles'] = item.value;
6171
- break;
6165
+ case 'contact_connection':
6166
+ case 'contact':
6167
+ data['contacts'] = item.value;
6168
+ break;
6172
6169
 
6173
- case 'user_drive':
6174
- data['user_drive'] = item.value;
6175
- break;
6170
+ case 'account_profile':
6171
+ data['account_profiles'] = item.value;
6172
+ break;
6176
6173
 
6177
- default:
6178
- break;
6174
+ case 'user_drive':
6175
+ data['user_drive'] = item.value;
6176
+ break;
6177
+
6178
+ default:
6179
+ break;
6180
+ }
6179
6181
  }
6180
6182
  }
6181
-
6182
6183
  return { code: 111, data };
6183
6184
  } catch (err) {
6184
6185
  return { code: -111, data: err.message };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5414",
3
+ "version": "1.1.5416",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",