@xuda.io/ai_module 1.1.3746 → 1.1.3748

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 +13 -8
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1700,7 +1700,7 @@ export const submit_agentic_studio_chat_gpt_prompt = async function (req) {
1700
1700
  export const get_chat_conversation = async function (req) {
1701
1701
  let { conversation_id, order = 'asc', limit, after, _id, uid } = req;
1702
1702
 
1703
- if (_id) return await get_ai_doc({ uid, _id });
1703
+ if (_id) return await get_studio_doc({ uid, _id });
1704
1704
 
1705
1705
  try {
1706
1706
  const project_db = await get_account_project_db(uid);
@@ -1756,7 +1756,7 @@ export const get_ai_chats = async function (req, job_id, headers) {
1756
1756
  };
1757
1757
 
1758
1758
  try {
1759
- if (_id) return await get_ai_doc({ _id, uid });
1759
+ if (_id) return await get_studio_doc({ _id, uid });
1760
1760
 
1761
1761
  let opt = {
1762
1762
  selector: {
@@ -2061,12 +2061,13 @@ const create_image = async function (prompt, model = 'gpt-image-1-mini', size =
2061
2061
  }
2062
2062
  };
2063
2063
 
2064
- const get_ai_doc = async function (req) {
2064
+ const get_studio_doc = async function (req) {
2065
2065
  let { uid, _id } = req;
2066
2066
 
2067
- const project_db = await get_account_project_db(uid);
2067
+ const app_id = await account_module.get_account_default_project_id(uid);
2068
2068
  try {
2069
- let data = await project_db.get(_id);
2069
+ let data = await db_module.get_app_couch_doc_native(app_id, _id);
2070
+
2070
2071
  if (data?.studio_meta?.createdByUid !== uid) delete data.agentConfig; //throw new Error('doctype not supported');
2071
2072
  return { code: 7, data };
2072
2073
  } catch (err) {
@@ -2380,7 +2381,7 @@ export const get_ai_agents = async function (req, job_id, headers) {
2380
2381
 
2381
2382
  try {
2382
2383
  if (_id) {
2383
- let doc_ret = await get_ai_doc({ _id, uid });
2384
+ let doc_ret = await get_studio_doc({ _id, uid });
2384
2385
  doc_ret.data._id = _id;
2385
2386
  // const doc = await get_ai_agent_info(uid, job_id, headers, doc_ret.data);
2386
2387
  // return doc;
@@ -2725,10 +2726,10 @@ export const install_ai_agent = async function (req) {
2725
2726
  };
2726
2727
 
2727
2728
  export const get_apps = async function (req, job_id, headers) {
2728
- let { uid, _id, search, filter_type = 'all', limit, skip } = req;
2729
+ let { uid, _id, search, filter_type = 'all', limit, skip, mini_app_id } = req;
2729
2730
 
2730
2731
  try {
2731
- if (_id) return await get_ai_doc({ _id, uid });
2732
+ if (_id) return await get_studio_doc({ _id, uid });
2732
2733
  ///////////////
2733
2734
  let opt = {
2734
2735
  selector: {
@@ -2783,6 +2784,10 @@ export const get_apps = async function (req, job_id, headers) {
2783
2784
  ],
2784
2785
  };
2785
2786
  }
2787
+
2788
+ if (mini_app_id) {
2789
+ opt._id = mini_app_id;
2790
+ }
2786
2791
  //////////////
2787
2792
 
2788
2793
  const app_id = await account_module.get_account_default_project_id(uid);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3746",
3
+ "version": "1.1.3748",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",