@xuda.io/ai_module 1.1.3747 → 1.1.3749

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 +10 -7
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1700,7 +1700,9 @@ 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) {
1704
+ return await get_studio_doc({ uid, _id });
1705
+ }
1704
1706
 
1705
1707
  try {
1706
1708
  const project_db = await get_account_project_db(uid);
@@ -1756,7 +1758,7 @@ export const get_ai_chats = async function (req, job_id, headers) {
1756
1758
  };
1757
1759
 
1758
1760
  try {
1759
- if (_id) return await get_ai_doc({ _id, uid });
1761
+ if (_id) return await get_studio_doc({ _id, uid });
1760
1762
 
1761
1763
  let opt = {
1762
1764
  selector: {
@@ -2061,12 +2063,13 @@ const create_image = async function (prompt, model = 'gpt-image-1-mini', size =
2061
2063
  }
2062
2064
  };
2063
2065
 
2064
- const get_ai_doc = async function (req) {
2066
+ const get_studio_doc = async function (req) {
2065
2067
  let { uid, _id } = req;
2066
2068
 
2067
- const project_db = await get_account_project_db(uid);
2069
+ const app_id = await account_module.get_account_default_project_id(uid);
2068
2070
  try {
2069
- let data = await project_db.get(_id);
2071
+ let data = await db_module.get_app_couch_doc_native(app_id, _id);
2072
+
2070
2073
  if (data?.studio_meta?.createdByUid !== uid) delete data.agentConfig; //throw new Error('doctype not supported');
2071
2074
  return { code: 7, data };
2072
2075
  } catch (err) {
@@ -2380,7 +2383,7 @@ export const get_ai_agents = async function (req, job_id, headers) {
2380
2383
 
2381
2384
  try {
2382
2385
  if (_id) {
2383
- let doc_ret = await get_ai_doc({ _id, uid });
2386
+ let doc_ret = await get_studio_doc({ _id, uid });
2384
2387
  doc_ret.data._id = _id;
2385
2388
  // const doc = await get_ai_agent_info(uid, job_id, headers, doc_ret.data);
2386
2389
  // return doc;
@@ -2728,7 +2731,7 @@ export const get_apps = async function (req, job_id, headers) {
2728
2731
  let { uid, _id, search, filter_type = 'all', limit, skip, mini_app_id } = req;
2729
2732
 
2730
2733
  try {
2731
- if (_id) return await get_ai_doc({ _id, uid });
2734
+ if (_id) return await get_studio_doc({ _id, uid });
2732
2735
  ///////////////
2733
2736
  let opt = {
2734
2737
  selector: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3747",
3
+ "version": "1.1.3749",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",