@xuda.io/ai_module 1.1.4503 → 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 +35 -4
- 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) {
|