@xuda.io/account_module 1.2.1835 → 1.2.1837

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.
Files changed (2) hide show
  1. package/index.mjs +73 -72
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1158,82 +1158,82 @@ const get_contact_pattern = async function (doc) {
1158
1158
  } else if (doc.is_spam) {
1159
1159
  ret = `spam-pattern.png`;
1160
1160
  } else {
1161
- if (doc.account_type === 'business') {
1162
- // if (doc?.is_real_person) {
1163
- ret = doc.profile_picture;
1164
- // }
1165
- } else {
1166
- // if (doc.my_contact) {
1167
- // if (doc.account_type === 'business') {
1168
- // ret = doc.profile_picture;
1169
- // } else {
1170
- // switch (doc.avatar_source) {
1171
- // case 'fictional':
1172
- // ret = `fictional-avatar-pattern.png`;
1173
- // break;
1174
-
1175
- // case 'ai profile':
1176
- // ret = `fictional-avatar-pattern.png`;
1177
- // break;
1178
-
1179
- // case 'authentic profile':
1180
- // ret = `authentic-avatar-pattern.png`;
1181
- // break;
1182
-
1183
- // default:
1184
- // ret = `xu-pattern.png`;
1185
- // break;
1186
- // }
1187
- // }
1188
- // } else
1189
-
1190
- // if (doc?.shared_from_uid) {
1191
- // //&& (doc.pending || (doc.team_req_id && doc.contact_share_copy))) {
1192
- // // pending or active share request
1193
- // const shared_from_uid_ret = await get_account_name({ uid_query: doc.shared_from_uid });
1194
- // ret = shared_from_uid_ret.data.profile_avatar;
1195
- // }
1161
+ // if (doc.account_type === 'business') {
1162
+ // // if (doc?.is_real_person) {
1163
+ // ret = doc.profile_picture;
1164
+ // // }
1165
+ // } else {
1166
+ // if (doc.my_contact) {
1167
+ // if (doc.account_type === 'business') {
1168
+ // ret = doc.profile_picture;
1169
+ // } else {
1170
+ // switch (doc.avatar_source) {
1171
+ // case 'fictional':
1172
+ // ret = `fictional-avatar-pattern.png`;
1173
+ // break;
1174
+
1175
+ // case 'ai profile':
1176
+ // ret = `fictional-avatar-pattern.png`;
1177
+ // break;
1178
+
1179
+ // case 'authentic profile':
1180
+ // ret = `authentic-avatar-pattern.png`;
1181
+ // break;
1182
+
1183
+ // default:
1184
+ // ret = `xu-pattern.png`;
1185
+ // break;
1186
+ // }
1187
+ // }
1188
+ // } else
1196
1189
 
1197
- // else if (doc?.reference_doc?.shared_from_uid) {
1198
- // //active share
1199
- // const shared_from_uid_ret = await get_account_name({ uid_query: doc.reference_doc.shared_from_uid });
1200
- // ret = shared_from_uid_ret.data.profile_avatar;
1201
- // }
1202
- // else
1203
- if (doc.contact_uid) {
1204
- switch (doc.avatar_source) {
1205
- case 'fictional':
1206
- ret = `fictional-avatar-pattern.png`;
1207
- break;
1208
-
1209
- case 'ai profile':
1210
- ret = `fictional-avatar-pattern.png`;
1211
- break;
1212
-
1213
- case 'authentic profile':
1214
- ret = `authentic-avatar-pattern.png`;
1215
- break;
1216
-
1217
- default:
1218
- ret = `xu-pattern.png`;
1219
- break;
1220
- }
1221
- } else {
1222
- switch (doc.source) {
1223
- case 'read emails': {
1224
- ret = `email-pattern.png`;
1225
- break;
1226
- }
1227
- case 'web': {
1228
- ret = `web-pattern.png`;
1229
- break;
1230
- }
1190
+ // if (doc?.shared_from_uid) {
1191
+ // //&& (doc.pending || (doc.team_req_id && doc.contact_share_copy))) {
1192
+ // // pending or active share request
1193
+ // const shared_from_uid_ret = await get_account_name({ uid_query: doc.shared_from_uid });
1194
+ // ret = shared_from_uid_ret.data.profile_avatar;
1195
+ // }
1196
+
1197
+ // else if (doc?.reference_doc?.shared_from_uid) {
1198
+ // //active share
1199
+ // const shared_from_uid_ret = await get_account_name({ uid_query: doc.reference_doc.shared_from_uid });
1200
+ // ret = shared_from_uid_ret.data.profile_avatar;
1201
+ // }
1202
+ // else
1203
+ if (doc.contact_uid) {
1204
+ switch (doc.avatar_source) {
1205
+ case 'fictional':
1206
+ ret = `fictional-avatar-pattern.png`;
1207
+ break;
1208
+
1209
+ case 'ai profile':
1210
+ ret = `fictional-avatar-pattern.png`;
1211
+ break;
1212
+
1213
+ case 'authentic profile':
1214
+ ret = `authentic-avatar-pattern.png`;
1215
+ break;
1231
1216
 
1232
- default:
1233
- break;
1217
+ default:
1218
+ ret = `xu-pattern.png`;
1219
+ break;
1220
+ }
1221
+ } else {
1222
+ switch (doc.source) {
1223
+ case 'read emails': {
1224
+ ret = `email-pattern.png`;
1225
+ break;
1226
+ }
1227
+ case 'web': {
1228
+ ret = `web-pattern.png`;
1229
+ break;
1234
1230
  }
1231
+
1232
+ default:
1233
+ break;
1235
1234
  }
1236
1235
  }
1236
+ // }
1237
1237
  }
1238
1238
  return ret;
1239
1239
  };
@@ -3373,7 +3373,7 @@ export const save_cache_hit = async function (_id) {
3373
3373
  }
3374
3374
  };
3375
3375
 
3376
- export const record_ai_usage = async function (uid, input_tokens, output_tokens, source, prompt, model, metadata = {}, account_profile_info) {
3376
+ export const record_ai_usage = async function (uid, input_tokens, output_tokens, source, prompt, model, metadata = {}, account_profile_info, tools) {
3377
3377
  try {
3378
3378
  if (!account_profile_info) throw new Error('missing account_profile_info');
3379
3379
 
@@ -3397,6 +3397,7 @@ export const record_ai_usage = async function (uid, input_tokens, output_tokens,
3397
3397
  model,
3398
3398
  cost,
3399
3399
  account_profile_info,
3400
+ tools,
3400
3401
  };
3401
3402
  const save_ret = await db_module.save_couch_doc('xuda_usage', usage_doc);
3402
3403
  // console.log(save_ret);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1835",
3
+ "version": "1.2.1837",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {