@xuda.io/ai_module 1.1.5145 → 1.1.5147
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 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4050,6 +4050,8 @@ 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 activate_prompt_suggestions = (typeof ai_agents === 'undefined' || ai_agents.length > 0) && conversation_doc.reference_type !== 'ai_agents';
|
|
4054
|
+
|
|
4053
4055
|
let model = ai_model;
|
|
4054
4056
|
if (!_conf.ai_models[model]) {
|
|
4055
4057
|
throw new Error('model not supported');
|
|
@@ -4659,8 +4661,8 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4659
4661
|
await attachment_handler(uid, app_id, conversation_id, attachments, account_profile_info);
|
|
4660
4662
|
}
|
|
4661
4663
|
////////////
|
|
4662
|
-
if (!prompt_suggestions.length) {
|
|
4663
|
-
await _utils.delay(
|
|
4664
|
+
if ((typeof ai_agents === 'undefined' || ai_agents.length > 0) && !prompt_suggestions.length) {
|
|
4665
|
+
await _utils.delay(5000);
|
|
4664
4666
|
}
|
|
4665
4667
|
|
|
4666
4668
|
if (prompt_suggestions.length) {
|
|
@@ -10976,8 +10978,10 @@ export const get_chat_suggestions = async function (uid, ai_agents, conversation
|
|
|
10976
10978
|
};
|
|
10977
10979
|
|
|
10978
10980
|
const agents_docs = await get_agents();
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
+
let suggestions = [];
|
|
10982
|
+
if (agents_docs.length) {
|
|
10983
|
+
suggestions = await get_suggestions();
|
|
10984
|
+
}
|
|
10981
10985
|
return { code: 44, data: suggestions };
|
|
10982
10986
|
} catch (err) {
|
|
10983
10987
|
return { code: -44, data: err.message || String(err) };
|