@xuda.io/ai_module 1.1.5100 → 1.1.5102
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.
- package/index.mjs +49 -1
- package/index_ms.mjs +4 -0
- package/index_msa.mjs +4 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -10854,4 +10854,52 @@ export const open_ai_alive_check = async function () {};
|
|
|
10854
10854
|
// return account_profile_info;
|
|
10855
10855
|
// };
|
|
10856
10856
|
|
|
10857
|
-
const
|
|
10857
|
+
export const get_chat_suggestions = async function (uid, conversation_item_id, ai_agents, ai_model = _conf.default_ai_model) {
|
|
10858
|
+
let ret = [];
|
|
10859
|
+
try {
|
|
10860
|
+
const get_agents = async function () {
|
|
10861
|
+
if (typeof ai_agents === 'undefined') {
|
|
10862
|
+
// no agents
|
|
10863
|
+
ai_agents = [];
|
|
10864
|
+
} else if (!ai_agents.length) {
|
|
10865
|
+
// auto agent mode
|
|
10866
|
+
const ai_agents_ret = await get_user_ai_agents(uid);
|
|
10867
|
+
for (const doc of ai_agents_ret.docs) {
|
|
10868
|
+
ai_agents.push(doc._id);
|
|
10869
|
+
}
|
|
10870
|
+
}
|
|
10871
|
+
|
|
10872
|
+
const list = [];
|
|
10873
|
+
|
|
10874
|
+
for (const agent_id of ai_agents) {
|
|
10875
|
+
try {
|
|
10876
|
+
let ai_agent_doc;
|
|
10877
|
+
try {
|
|
10878
|
+
ai_agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, agent_id);
|
|
10879
|
+
if (ai_agent_doc.studio_meta.shared_from_uid) {
|
|
10880
|
+
const reference_doc = _.cloneDeep(ai_agent_doc);
|
|
10881
|
+
const app_id = await get_account_default_project_id(ai_agent_doc.studio_meta.shared_from_uid);
|
|
10882
|
+
ai_agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, ai_agent_doc.studio_meta.share_item_id);
|
|
10883
|
+
ai_agent_doc.reference_doc = reference_doc;
|
|
10884
|
+
} else if (ai_agent_doc.studio_meta.installed_from_uid) {
|
|
10885
|
+
const reference_doc = _.cloneDeep(ai_agent_doc);
|
|
10886
|
+
const app_id = await get_account_default_project_id(ai_agent_doc.studio_meta.installed_from_uid);
|
|
10887
|
+
ai_agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, ai_agent_doc.studio_meta.share_item_id);
|
|
10888
|
+
ai_agent_doc.reference_doc = reference_doc;
|
|
10889
|
+
}
|
|
10890
|
+
} catch (err) {
|
|
10891
|
+
throw new Error(err.message);
|
|
10892
|
+
}
|
|
10893
|
+
} catch (err) {
|
|
10894
|
+
console.error(err.message);
|
|
10895
|
+
}
|
|
10896
|
+
}
|
|
10897
|
+
//tell me more on xuda
|
|
10898
|
+
// debugger;
|
|
10899
|
+
|
|
10900
|
+
return list;
|
|
10901
|
+
};
|
|
10902
|
+
} catch (err) {
|
|
10903
|
+
return { code: -44, data: err.message || String(err) };
|
|
10904
|
+
}
|
|
10905
|
+
};
|
package/index_ms.mjs
CHANGED
|
@@ -200,3 +200,7 @@ export const get_person_info = async function (...args) {
|
|
|
200
200
|
export const open_ai_alive_check = async function (...args) {
|
|
201
201
|
return await broker.send_to_queue("open_ai_alive_check", ...args);
|
|
202
202
|
};
|
|
203
|
+
|
|
204
|
+
export const get_chat_suggestions = async function (...args) {
|
|
205
|
+
return await broker.send_to_queue("get_chat_suggestions", ...args);
|
|
206
|
+
};
|
package/index_msa.mjs
CHANGED
|
@@ -200,3 +200,7 @@ export const get_person_info = function (...args) {
|
|
|
200
200
|
export const open_ai_alive_check = function (...args) {
|
|
201
201
|
broker.send_to_queue_async("open_ai_alive_check", ...args);
|
|
202
202
|
};
|
|
203
|
+
|
|
204
|
+
export const get_chat_suggestions = function (...args) {
|
|
205
|
+
broker.send_to_queue_async("get_chat_suggestions", ...args);
|
|
206
|
+
};
|