@xuda.io/ai_module 1.1.5431 → 1.1.5441
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 +19 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3661,9 +3661,20 @@ const process_conversation = async function (uid, conversation_id, account_profi
|
|
|
3661
3661
|
conversation_doc.process_stat = 'full';
|
|
3662
3662
|
await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
|
|
3663
3663
|
|
|
3664
|
-
|
|
3665
|
-
|
|
3664
|
+
//enable_thumbnail_avatar_generation
|
|
3665
|
+
const { data: account_doc } = await db_module.get_couch_doc('xuda_accounts', account_profile_info.uid);
|
|
3666
|
+
let thumbnail_type = 'conversation_category';
|
|
3667
|
+
if ((conversation_type === 'chat' && account_doc?.preferences?.enable_thumbnail_avatar_generation) || !category_info.category) {
|
|
3668
|
+
thumbnail_type = 'conversation_title';
|
|
3666
3669
|
}
|
|
3670
|
+
|
|
3671
|
+
await update_thumbnail(thumbnail_type, conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
|
|
3672
|
+
|
|
3673
|
+
// if ((conversation_type === 'chat' && enable_thumbnail_avatar_generation) || !category_info.category) {
|
|
3674
|
+
// await update_thumbnail('conversation_title', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
|
|
3675
|
+
// } else if (category_info.category) {
|
|
3676
|
+
// await update_thumbnail('conversation_category', conversation_doc, account_profile_info.app_id, uid, job_id, headers, null, null, account_profile_info);
|
|
3677
|
+
// }
|
|
3667
3678
|
};
|
|
3668
3679
|
|
|
3669
3680
|
const contactGuardrailAgent = new Agent({
|
|
@@ -4151,6 +4162,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4151
4162
|
|
|
4152
4163
|
const app_id = await get_account_default_project_id(uid);
|
|
4153
4164
|
const app_obj = await get_app_obj(account_profile_info.app_id);
|
|
4165
|
+
|
|
4154
4166
|
const userName = await account_ms.get_user_name(uid);
|
|
4155
4167
|
const account_info = (await get_account_name({ uid })).data;
|
|
4156
4168
|
let context = { ...{ app_id: account_profile_info.app_id, uid, userName, account_info, app_obj, account_id: uid }, ...extractClientInfo(headers) };
|
|
@@ -4189,7 +4201,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4189
4201
|
let prompt_selected_suggestion;
|
|
4190
4202
|
|
|
4191
4203
|
const get_prompt_suggestions = async function () {
|
|
4192
|
-
emitToDashboard('stream_phase', 'Deep thinking...', { allow_skip: true });
|
|
4204
|
+
emitToDashboard('stream_phase', 'Deep thinking...', { allow_skip: true, update: true });
|
|
4193
4205
|
return new Promise(async (resolve, reject) => {
|
|
4194
4206
|
let interval = setInterval(async function () {
|
|
4195
4207
|
const job_info = await jobs_ms.get_job_info({ job_id });
|
|
@@ -4243,7 +4255,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4243
4255
|
await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
|
|
4244
4256
|
|
|
4245
4257
|
// await update_job('analyzing request');
|
|
4246
|
-
emitToDashboard('stream_phase', 'Analyzing request');
|
|
4258
|
+
emitToDashboard('stream_phase', 'Analyzing request', { update: true });
|
|
4247
4259
|
|
|
4248
4260
|
const init_agent_hooks = function (agent) {
|
|
4249
4261
|
agent.on('agent_start', (context, agent) => {
|
|
@@ -4262,7 +4274,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4262
4274
|
agent.on('agent_tool_start', (context, tool, details) => {
|
|
4263
4275
|
debugger;
|
|
4264
4276
|
// emitToDashboard('agent_tool_start', tool.name);
|
|
4265
|
-
emitToDashboard('stream_phase', `Starting ${tool
|
|
4277
|
+
emitToDashboard('stream_phase', `Starting ${tool?.name?.replaceAll('_', ' ')} tool`, { update: true });
|
|
4266
4278
|
});
|
|
4267
4279
|
|
|
4268
4280
|
agent.on('agent_tool_end', (context, tool, result, details) => {
|
|
@@ -4826,13 +4838,13 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4826
4838
|
let _agent = [];
|
|
4827
4839
|
|
|
4828
4840
|
// await update_job('preparing tools');
|
|
4829
|
-
emitToDashboard('stream_phase', 'Preparing tools');
|
|
4841
|
+
emitToDashboard('stream_phase', 'Preparing tools', { update: true });
|
|
4830
4842
|
let agents = await get_agents();
|
|
4831
4843
|
|
|
4832
4844
|
/////////////
|
|
4833
4845
|
if (attachments?.length) {
|
|
4834
4846
|
// await update_job('analyzing attachments');
|
|
4835
|
-
emitToDashboard('stream_phase', 'Analyzing attachments');
|
|
4847
|
+
emitToDashboard('stream_phase', 'Analyzing attachments', { update: true });
|
|
4836
4848
|
await attachment_handler(uid, app_id, conversation_id, attachments, account_profile_info);
|
|
4837
4849
|
}
|
|
4838
4850
|
////////////
|