@xuda.io/ai_module 1.1.5147 → 1.1.5149
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 +13 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4050,6 +4050,9 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4050
4050
|
const account_profile_info = await get_active_account_profile_info(uid, profile_id);
|
|
4051
4051
|
let { prompt, conversation_doc, attachments = [], ai_agents, output_format = 'md', stream = true, with_context = true, ai_model = _conf.default_ai_model } = req;
|
|
4052
4052
|
|
|
4053
|
+
const reference_type = conversation_doc.reference_type;
|
|
4054
|
+
const reference_id = conversation_doc.reference_id;
|
|
4055
|
+
|
|
4053
4056
|
const activate_prompt_suggestions = (typeof ai_agents === 'undefined' || ai_agents.length > 0) && conversation_doc.reference_type !== 'ai_agents';
|
|
4054
4057
|
|
|
4055
4058
|
let model = ai_model;
|
|
@@ -4162,12 +4165,13 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4162
4165
|
let prompt_suggestions = [];
|
|
4163
4166
|
setTimeout(async () => {
|
|
4164
4167
|
debugger;
|
|
4168
|
+
if (!activate_prompt_suggestions) return;
|
|
4165
4169
|
const prompt_suggestions_ret = await get_chat_suggestions(uid, ai_agents, out_conversation_item_save_ret.data.id);
|
|
4166
4170
|
if (prompt_suggestions_ret.code > -1) prompt_suggestions = prompt_suggestions_ret.data;
|
|
4167
4171
|
}, 1);
|
|
4168
4172
|
// let conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|
|
4169
|
-
const reference_type = conversation_doc.reference_type;
|
|
4170
|
-
const reference_id = conversation_doc.reference_id;
|
|
4173
|
+
// const reference_type = conversation_doc.reference_type;
|
|
4174
|
+
// const reference_id = conversation_doc.reference_id;
|
|
4171
4175
|
|
|
4172
4176
|
conversation_doc.stat = 2;
|
|
4173
4177
|
conversation_doc.ts = Date.now();
|
|
@@ -4661,12 +4665,14 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4661
4665
|
await attachment_handler(uid, app_id, conversation_id, attachments, account_profile_info);
|
|
4662
4666
|
}
|
|
4663
4667
|
////////////
|
|
4664
|
-
if (
|
|
4665
|
-
|
|
4666
|
-
|
|
4668
|
+
if (activate_prompt_suggestions) {
|
|
4669
|
+
if (!prompt_suggestions.length) {
|
|
4670
|
+
await _utils.delay(5000);
|
|
4671
|
+
}
|
|
4667
4672
|
|
|
4668
|
-
|
|
4669
|
-
|
|
4673
|
+
if (prompt_suggestions.length) {
|
|
4674
|
+
await render_suggestions();
|
|
4675
|
+
}
|
|
4670
4676
|
}
|
|
4671
4677
|
///////////
|
|
4672
4678
|
|