@xuda.io/ai_module 1.1.5212 → 1.1.5214
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 +22 -10
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4195,7 +4195,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4195
4195
|
resolve({ code: -1, data: 'skipped' });
|
|
4196
4196
|
clearInterval(interval);
|
|
4197
4197
|
}
|
|
4198
|
-
},
|
|
4198
|
+
}, 500);
|
|
4199
4199
|
const ret = await get_chat_suggestions({ uid, ai_agents, conversation_item_id: out_conversation_item_save_ret.data.id, context: prompt });
|
|
4200
4200
|
clearInterval(interval);
|
|
4201
4201
|
resolve(ret);
|
|
@@ -4707,12 +4707,23 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4707
4707
|
};
|
|
4708
4708
|
|
|
4709
4709
|
const render_suggestions = async function () {
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4710
|
+
return new Promise(async (resolve, reject) => {
|
|
4711
|
+
let interval = setInterval(async function () {
|
|
4712
|
+
const job_info = await jobs_ms.get_job_info({ job_id });
|
|
4713
|
+
|
|
4714
|
+
if (job_info.code < 0 || job_info.data.stat === 4) {
|
|
4715
|
+
resolve({ code: -1, data: 'aborted' });
|
|
4716
|
+
clearInterval(interval);
|
|
4717
|
+
}
|
|
4718
|
+
if (job_info?.data?.payload?.skip_suggestions) {
|
|
4719
|
+
resolve({ code: -1, data: 'skipped' });
|
|
4720
|
+
clearInterval(interval);
|
|
4721
|
+
}
|
|
4722
|
+
}, 500);
|
|
4723
|
+
emitToDashboard('suggestions', JSON.stringify(prompt_suggestions));
|
|
4724
|
+
clearInterval(interval);
|
|
4725
|
+
resolve(ret);
|
|
4726
|
+
});
|
|
4716
4727
|
};
|
|
4717
4728
|
|
|
4718
4729
|
const run_agent = function (_agent, prompt, opt) {
|
|
@@ -4724,7 +4735,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4724
4735
|
reject(new Error('aborted'));
|
|
4725
4736
|
clearInterval(interval);
|
|
4726
4737
|
}
|
|
4727
|
-
},
|
|
4738
|
+
}, 500);
|
|
4728
4739
|
const ret = await runner.run(_agent, prompt, opt);
|
|
4729
4740
|
clearInterval(interval);
|
|
4730
4741
|
resolve(ret);
|
|
@@ -4747,7 +4758,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4747
4758
|
|
|
4748
4759
|
if (activate_prompt_suggestions) {
|
|
4749
4760
|
// 2. Now wait for it specifically
|
|
4750
|
-
|
|
4761
|
+
|
|
4751
4762
|
const prompt_suggestions_ret = await get_prompt_suggestions(); // suggestionsPromise;
|
|
4752
4763
|
|
|
4753
4764
|
if (prompt_suggestions_ret && prompt_suggestions_ret.code > -1) {
|
|
@@ -4760,7 +4771,8 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4760
4771
|
const job_info = await jobs_ms.get_job_info({ job_id });
|
|
4761
4772
|
|
|
4762
4773
|
if (job_info.code < 0 || job_info.data.stat === 4) {
|
|
4763
|
-
return { code: 5, data: 'aborted' };
|
|
4774
|
+
// return { code: 5, data: 'aborted' };
|
|
4775
|
+
throw 'aborted';
|
|
4764
4776
|
}
|
|
4765
4777
|
if (job_info?.data?.payload?.ai_agents) {
|
|
4766
4778
|
prompt_suggestion_activated = true;
|