@xuda.io/ai_module 1.1.4502 → 1.1.4504
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 +39 -6
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1683,20 +1683,46 @@ const check_studio_doc_tool = tool({
|
|
|
1683
1683
|
// }
|
|
1684
1684
|
// };
|
|
1685
1685
|
|
|
1686
|
+
// export const get_chat_conversation = async function (req) {
|
|
1687
|
+
// let { conversation_id, order = 'asc', limit, after, _id, uid } = req;
|
|
1688
|
+
|
|
1689
|
+
// const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
1690
|
+
|
|
1691
|
+
// if (_id) {
|
|
1692
|
+
|
|
1693
|
+
// let data = await db_module.get_app_couch_doc(account_profile_info.app_id, _id);
|
|
1694
|
+
// return data;
|
|
1695
|
+
// }
|
|
1696
|
+
|
|
1697
|
+
// try {
|
|
1698
|
+
// // const project_db = await get_account_project_db(uid);
|
|
1699
|
+
// // let conversation_doc = await project_db.get(conversation_id);
|
|
1700
|
+
// let conversation_doc = await db_module.get_app_couch_doc(account_profile_info.app_id, conversation_id);
|
|
1701
|
+
// let reference_doc;
|
|
1702
|
+
// if (conversation_doc.shared_from_uid) {
|
|
1703
|
+
// reference_doc = _.cloneDeep(conversation_doc);
|
|
1704
|
+
// conversation_doc = await db_module.get_app_couch_doc_native(reference_doc.shared_from_app_id, reference_doc.share_item_id);
|
|
1705
|
+
// conversation_doc.reference_doc = reference_doc;
|
|
1706
|
+
// }
|
|
1707
|
+
// let conversation = await client.conversations.items.list(conversation_id, { limit, order, after });
|
|
1708
|
+
|
|
1709
|
+
// return { code: 15, data: { conversation, ...conversation_doc } };
|
|
1710
|
+
// } catch (err) {
|
|
1711
|
+
// return { code: -15, data: err.message };
|
|
1712
|
+
// }
|
|
1713
|
+
// };
|
|
1714
|
+
|
|
1686
1715
|
export const get_chat_conversation = async function (req) {
|
|
1687
1716
|
let { conversation_id, order = 'asc', limit, after, _id, uid } = req;
|
|
1688
1717
|
|
|
1689
1718
|
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
1690
1719
|
|
|
1691
1720
|
if (_id) {
|
|
1692
|
-
// const app_id = await account_module.get_account_default_project_id(uid);
|
|
1693
1721
|
let data = await db_module.get_app_couch_doc(account_profile_info.app_id, _id);
|
|
1694
1722
|
return data;
|
|
1695
1723
|
}
|
|
1696
1724
|
|
|
1697
1725
|
try {
|
|
1698
|
-
// const project_db = await get_account_project_db(uid);
|
|
1699
|
-
// let conversation_doc = await project_db.get(conversation_id);
|
|
1700
1726
|
let conversation_doc = await db_module.get_app_couch_doc(account_profile_info.app_id, conversation_id);
|
|
1701
1727
|
let reference_doc;
|
|
1702
1728
|
if (conversation_doc.shared_from_uid) {
|
|
@@ -1704,7 +1730,12 @@ export const get_chat_conversation = async function (req) {
|
|
|
1704
1730
|
conversation_doc = await db_module.get_app_couch_doc_native(reference_doc.shared_from_app_id, reference_doc.share_item_id);
|
|
1705
1731
|
conversation_doc.reference_doc = reference_doc;
|
|
1706
1732
|
}
|
|
1707
|
-
let conversation = await
|
|
1733
|
+
let conversation = await db_module.find_app_couch_query(account_profile_info.app_id, {
|
|
1734
|
+
selector: {
|
|
1735
|
+
docType: 'chat_conversation_item',
|
|
1736
|
+
stat: 3,
|
|
1737
|
+
},
|
|
1738
|
+
});
|
|
1708
1739
|
|
|
1709
1740
|
return { code: 15, data: { conversation, ...conversation_doc } };
|
|
1710
1741
|
} catch (err) {
|
|
@@ -3175,7 +3206,9 @@ export const create_ai_agent = async function (req, job_id, headers) {
|
|
|
3175
3206
|
|
|
3176
3207
|
export const update_ai_agent_properties = async function (doc, app_id, uid, fields_changed = {}) {
|
|
3177
3208
|
const db_doc = await db_module.get_app_couch_doc_native(app_id, doc._id);
|
|
3178
|
-
const { account_profile_info } = doc.studio_meta;
|
|
3209
|
+
// const { account_profile_info } = doc.studio_meta;
|
|
3210
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
3211
|
+
|
|
3179
3212
|
const get_agent_assistant_name = async function () {
|
|
3180
3213
|
const ret = await submit_chat_gpt_prompt({
|
|
3181
3214
|
uid,
|
|
@@ -4145,7 +4178,7 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4145
4178
|
|
|
4146
4179
|
const conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_obj.id);
|
|
4147
4180
|
|
|
4148
|
-
const recipient_account_profile_info = await
|
|
4181
|
+
const recipient_account_profile_info = await ac3180count_module.get_active_account_profile_info(recipient_uid);
|
|
4149
4182
|
let recipient_conversation_doc = await db_module.get_app_couch_doc_native(recipient_account_profile_info.app_id, conversation_obj.id);
|
|
4150
4183
|
recipient_conversation_doc.title = conversation_doc.title;
|
|
4151
4184
|
|