@xuda.io/ai_module 1.1.5601 → 1.1.5602

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 +20 -5
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4302,6 +4302,7 @@ const contactGuardrailAgent = new Agent({
4302
4302
  // };
4303
4303
 
4304
4304
  export const submit_chat_conversation = async function (req, job_id, headers) {
4305
+ debugger;
4305
4306
  const { profile_id, uid, metadata = {}, accepted_plan_item_id } = req;
4306
4307
  let { conversation_id } = req;
4307
4308
  try {
@@ -4387,7 +4388,7 @@ export const submit_chat_conversation = async function (req, job_id, headers) {
4387
4388
  }
4388
4389
 
4389
4390
  case 'dashboard': {
4390
- ret = await dashboard_chat(req, job_id, headers);
4391
+ ret = conversation_doc.conversation_type === 'ai_chat' ? await ai_chat_conversation(req, job_id, headers) : await dashboard_chat(req, job_id, headers);
4391
4392
  break;
4392
4393
  }
4393
4394
 
@@ -5073,13 +5074,27 @@ const get_dashboard_cpi_zod_item = function (key, val = {}, options = {}) {
5073
5074
  if (val.enum?.length) {
5074
5075
  const enum_values = val.enum.filter((item) => typeof item !== 'undefined');
5075
5076
  if (!enum_values.length) {
5076
- schema = z.any();
5077
+ schema = z.string();
5077
5078
  } else if (enum_values.length === 1) {
5078
- schema = z.literal(enum_values[0]);
5079
+ switch (typeof enum_values[0]) {
5080
+ case 'number':
5081
+ schema = z.number();
5082
+ break;
5083
+ case 'boolean':
5084
+ schema = z.boolean();
5085
+ break;
5086
+ default:
5087
+ schema = z.string();
5088
+ break;
5089
+ }
5079
5090
  } else if (enum_values.every((item) => typeof item === 'string')) {
5080
5091
  schema = z.enum(enum_values);
5092
+ } else if (enum_values.every((item) => typeof item === 'number')) {
5093
+ schema = z.number();
5094
+ } else if (enum_values.every((item) => typeof item === 'boolean')) {
5095
+ schema = z.boolean();
5081
5096
  } else {
5082
- schema = z.union(enum_values.map((item) => z.literal(item)));
5097
+ schema = z.string();
5083
5098
  }
5084
5099
  } else {
5085
5100
  switch (val.type) {
@@ -5108,7 +5123,7 @@ const get_dashboard_cpi_zod_item = function (key, val = {}, options = {}) {
5108
5123
  break;
5109
5124
  }
5110
5125
  default:
5111
- schema = z.any();
5126
+ schema = z.string();
5112
5127
  break;
5113
5128
  }
5114
5129
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5601",
3
+ "version": "1.1.5602",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",