@xuda.io/ai_module 1.1.4138 → 1.1.4139
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 +8 -8
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1724,7 +1724,7 @@ export const get_chat_conversation = async function (req) {
|
|
|
1724
1724
|
export const get_ai_chats = async function (req, job_id, headers) {
|
|
1725
1725
|
let { uid, reference_id, _id, search, filter_type = 'all', conversation_type, limit, skip, conversation_id } = req;
|
|
1726
1726
|
|
|
1727
|
-
const
|
|
1727
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
1728
1728
|
|
|
1729
1729
|
const get_conversation_background = function (doc) {
|
|
1730
1730
|
let deg = 145;
|
|
@@ -1863,7 +1863,7 @@ export const get_ai_chats = async function (req, job_id, headers) {
|
|
|
1863
1863
|
let ai_chats = { docs: [], total_docs: 0 };
|
|
1864
1864
|
|
|
1865
1865
|
if (filter_type !== 'pending') {
|
|
1866
|
-
ai_chats = await db_module.find_app_couch_query(
|
|
1866
|
+
ai_chats = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
|
|
1867
1867
|
if (!limit || conversation_id) {
|
|
1868
1868
|
ai_chats.total_docs = ai_chats.docs.length;
|
|
1869
1869
|
} else {
|
|
@@ -1872,7 +1872,7 @@ export const get_ai_chats = async function (req, job_id, headers) {
|
|
|
1872
1872
|
opt.limit = 9999;
|
|
1873
1873
|
opt.fields = ['_id'];
|
|
1874
1874
|
|
|
1875
|
-
const counter = await db_module.find_app_couch_query(
|
|
1875
|
+
const counter = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
|
|
1876
1876
|
ai_chats.total_docs = counter.docs.length;
|
|
1877
1877
|
}
|
|
1878
1878
|
}
|
|
@@ -1966,7 +1966,7 @@ export const archive_ai_chat = async function (req) {
|
|
|
1966
1966
|
|
|
1967
1967
|
let conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|
|
1968
1968
|
debugger;
|
|
1969
|
-
if (conversation_doc.uid !== uid && conversation_doc?.
|
|
1969
|
+
if (conversation_doc.uid !== uid && conversation_doc?.account_profile_info?.account_profile_obj?.shared_from_uid !== uid) {
|
|
1970
1970
|
throw new Error('Operation not allowed');
|
|
1971
1971
|
}
|
|
1972
1972
|
|
|
@@ -4175,7 +4175,7 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4175
4175
|
const { uid, prompt } = req;
|
|
4176
4176
|
let { reference_type, reference_id = '', conversation_type } = req;
|
|
4177
4177
|
|
|
4178
|
-
const
|
|
4178
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
4179
4179
|
|
|
4180
4180
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
4181
4181
|
|
|
@@ -4196,10 +4196,10 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4196
4196
|
conversation_obj,
|
|
4197
4197
|
conversation_type,
|
|
4198
4198
|
initiator_uid: uid,
|
|
4199
|
-
// account_profile_id:
|
|
4200
|
-
|
|
4199
|
+
// account_profile_id: account_profile_info.account_profile_id,
|
|
4200
|
+
account_profile_info,
|
|
4201
4201
|
};
|
|
4202
|
-
const save_ret = await db_module.save_app_couch_doc(
|
|
4202
|
+
const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_doc);
|
|
4203
4203
|
|
|
4204
4204
|
let contact_uid_chat_conversation, receiver_contact_id, receiver_contact_doc;
|
|
4205
4205
|
|