@xuda.io/ai_module 1.1.3826 → 1.1.3828

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 +21 -19
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2001,23 +2001,22 @@ export const unarchive_ai_chat = async function (req) {
2001
2001
  }
2002
2002
  };
2003
2003
 
2004
- export const create_studio_app = async function (subject) {
2005
- try {
2006
- let prompt = `
2007
-
2008
- 1. list all tables and screens to build an ${subject} app.
2009
- 2. return object array for each item (name,type,description)
2010
-
2011
-
2012
- `;
2004
+ // export const create_studio_app = async function (subject) {
2005
+ // try {
2006
+ // let prompt = `
2013
2007
 
2014
- const data = await submit_chat_gpt_prompt({ prompt });
2008
+ // 1. list all tables and screens to build an ${subject} app.
2009
+ // 2. return object array for each item (name,type,description)
2015
2010
 
2016
- return { code: 6, data };
2017
- } catch (err) {
2018
- return { code: -6, data: err.message };
2019
- }
2020
- };
2011
+ // `;
2012
+
2013
+ // const data = await submit_chat_gpt_prompt({ prompt });
2014
+
2015
+ // return { code: 6, data };
2016
+ // } catch (err) {
2017
+ // return { code: -6, data: err.message };
2018
+ // }
2019
+ // };
2021
2020
 
2022
2021
  const create_image = async function (prompt, model = 'gpt-image-1-mini', size = '1024x1024', n = 1, width = 256, height = 256) {
2023
2022
  try {
@@ -2697,7 +2696,7 @@ export const update_ai_agent = async function (req, job_id, headers) {
2697
2696
 
2698
2697
  setTimeout(async () => {
2699
2698
  if (!name_changed) return;
2700
- await update_ai_agent_properties(agent_doc, app_id);
2699
+ await update_ai_agent_properties(agent_doc, app_id, uid);
2701
2700
  await update_thumbnail('ai_agent', agent_doc, app_id, uid, job_id, headers);
2702
2701
  }, 500);
2703
2702
 
@@ -3050,7 +3049,7 @@ export const create_ai_agent = async function (req, job_id, headers) {
3050
3049
 
3051
3050
  const data = await db_module.save_app_couch_doc_native(app_id, agent_doc);
3052
3051
  setTimeout(async () => {
3053
- await update_ai_agent_properties(agent_doc, app_id);
3052
+ await update_ai_agent_properties(agent_doc, app_id, uid);
3054
3053
  await update_thumbnail('ai_agent', agent_doc, app_id, uid, job_id, headers);
3055
3054
  }, 500);
3056
3055
 
@@ -3061,11 +3060,12 @@ export const create_ai_agent = async function (req, job_id, headers) {
3061
3060
  }
3062
3061
  };
3063
3062
 
3064
- export const update_ai_agent_properties = async function (doc, app_id) {
3063
+ export const update_ai_agent_properties = async function (doc, app_id, uid) {
3065
3064
  const db_doc = await db_module.get_app_couch_doc_native(app_id, doc._id);
3066
3065
 
3067
3066
  const get_agent_assistant_name = async function () {
3068
3067
  const ret = await submit_chat_gpt_prompt({
3068
+ uid,
3069
3069
  prompt: `Generate a professional assistant name (e.g., “Data Analyst Assistant”) for the AI agent titled:
3070
3070
  “${doc.properties.menuName}” and also base on the instructions : "${doc.agentConfig.agent_instructions}"
3071
3071
  Output one option 3 words max.`,
@@ -3077,6 +3077,7 @@ export const update_ai_agent_properties = async function (doc, app_id) {
3077
3077
 
3078
3078
  const get_agent_category = async function () {
3079
3079
  const ret = await submit_chat_gpt_prompt({
3080
+ uid,
3080
3081
  prompt: `Generate agent category for the AI agent titled:
3081
3082
  “${doc.properties.menuName}” choose only one from the list:
3082
3083
  Personal Productivity
@@ -3099,6 +3100,7 @@ export const update_ai_agent_properties = async function (doc, app_id) {
3099
3100
 
3100
3101
  const get_agent_industry = async function () {
3101
3102
  const ret = await submit_chat_gpt_prompt({
3103
+ uid,
3102
3104
  prompt: `Generate agent industry for the AI agent titled:
3103
3105
  “${doc.properties.menuName}” choose only one from the list:
3104
3106
  Artificial Intelligence,SaaS,Fintech,Healthtech,Edtech,Blockchain/Crypto,Cybersecurity,Gaming,Consulting,Marketing & Advertising,Human Resources,Legal Services,Real Estate,E-commerce,Retail,Fashion & Apparel,Consumer Goods,Healthcare,Medical,Pharmaceutical,Banking,Insurance,Investment,Manufacturing,Logistics & Supply Chain,Construction,Energy,Media,Entertainment,Sports,Education,Travel & Hospitality,Food & Beverage,Non-Profit,Government,Agriculture,Automotive,Telecommunications`,
@@ -5066,7 +5068,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
5066
5068
  conversation_doc.stat = 3;
5067
5069
  conversation_doc.messages.push(obj);
5068
5070
  await db_module.save_app_couch_doc_native(app_id, conversation_doc);
5069
- record_chat_usage(uid, output.state._context.usage.inputTokens, output.state._context.usage.outputTokens, 'submit chat', prompt);
5071
+ record_chat_usage(uid, output.state._context.usage.inputTokens, output.state._context.usage.outputTokens, 'conversation chat', prompt);
5070
5072
  // if (!conversation_doc.chat_image && (!conversation_doc.thumbnail_request_ts || Date.now() - conversation_doc.thumbnail_request_ts > 120000)) {
5071
5073
  // update_thumbnail('conversation', conversation_doc, app_id, uid, job_id, headers);
5072
5074
  // }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3826",
3
+ "version": "1.1.3828",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",