@xuda.io/ai_module 1.1.4182 → 1.1.4184

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 +16 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1893,6 +1893,11 @@ export const get_ai_chats = async function (req, job_id, headers) {
1893
1893
 
1894
1894
  doc.user_contact = await account_module.get_user_card(uid, doc.uid);
1895
1895
 
1896
+ doc.privilage = doc.uid;
1897
+ if (prog_doc.uid !== uid && prog_doc?.account_profile_info?.uid !== uid) {
1898
+ throw new Error('Operation not allowed');
1899
+ }
1900
+
1896
1901
  if (reference_id) {
1897
1902
  // only valid for contacts conversation
1898
1903
  doc.background = get_conversation_background(doc);
@@ -1960,7 +1965,7 @@ export const archive_ai_chat = async function (req) {
1960
1965
  await team_module.validate_share_exist(uid, 'chat', conversation_id);
1961
1966
 
1962
1967
  let conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
1963
- debugger;
1968
+
1964
1969
  if (conversation_doc.uid !== uid && conversation_doc?.account_profile_info?.uid !== uid) {
1965
1970
  throw new Error('Operation not allowed');
1966
1971
  }
@@ -2658,6 +2663,11 @@ export const archive_ai_agent = async function (req) {
2658
2663
  await team_module.validate_share_exist(uid, 'ai_agent', agent_id);
2659
2664
 
2660
2665
  let agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, agent_id);
2666
+
2667
+ if (agent_doc.uid !== uid && agent_doc?.account_profile_info?.uid !== uid) {
2668
+ throw new Error('Operation not allowed');
2669
+ }
2670
+
2661
2671
  agent_doc.stat = 5;
2662
2672
  agent_doc.ts = Date.now();
2663
2673
  const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, agent_doc);
@@ -2678,6 +2688,11 @@ export const archive_mini_app = async function (req) {
2678
2688
  await team_module.validate_share_exist(uid, 'miniapp', prog_id);
2679
2689
 
2680
2690
  let prog_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, prog_id);
2691
+
2692
+ if (prog_doc.uid !== uid && prog_doc?.account_profile_info?.uid !== uid) {
2693
+ throw new Error('Operation not allowed');
2694
+ }
2695
+
2681
2696
  prog_doc.stat = 5;
2682
2697
  prog_doc.ts = Date.now();
2683
2698
  const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, prog_doc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4182",
3
+ "version": "1.1.4184",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",