@xuda.io/ai_module 1.1.3825 → 1.1.3827
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 +29 -27
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -423,10 +423,7 @@ const create_landing_page_tool = tool({
|
|
|
423
423
|
throw new Error(`table have at least one index id`);
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
-
const title_ret = await submit_chat_gpt_prompt({
|
|
427
|
-
prompt: `create title for ${subject} return 5 words result maximum text only without options `,
|
|
428
|
-
model: 'gpt-5-nano',
|
|
429
|
-
});
|
|
426
|
+
const title_ret = await submit_chat_gpt_prompt({ uid, prompt: `create title for ${subject} return 5 words result maximum text only without options `, model: 'gpt-5-nano' });
|
|
430
427
|
|
|
431
428
|
const menuType = 'component';
|
|
432
429
|
const parentId = 'programs';
|
|
@@ -480,6 +477,7 @@ const create_landing_page_tool = tool({
|
|
|
480
477
|
}
|
|
481
478
|
|
|
482
479
|
const html_ret = await submit_chat_gpt_prompt({
|
|
480
|
+
uid,
|
|
483
481
|
prompt: `Create a single-page landing layout with a Tailwind-styled contact form (fields: ${JSON.stringify(contactFormFields)}, subject: ${subject}). No navigation. Return only the <body> content. contact info:${JSON.stringify(account_info)} ${JSON.stringify(app_obj.app_general_prop)}`,
|
|
484
482
|
model: 'gpt-5-nano',
|
|
485
483
|
});
|
|
@@ -2003,23 +2001,22 @@ export const unarchive_ai_chat = async function (req) {
|
|
|
2003
2001
|
}
|
|
2004
2002
|
};
|
|
2005
2003
|
|
|
2006
|
-
export const create_studio_app = async function (subject) {
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
1. list all tables and screens to build an ${subject} app.
|
|
2011
|
-
2. return object array for each item (name,type,description)
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
`;
|
|
2004
|
+
// export const create_studio_app = async function (subject) {
|
|
2005
|
+
// try {
|
|
2006
|
+
// let prompt = `
|
|
2015
2007
|
|
|
2016
|
-
|
|
2008
|
+
// 1. list all tables and screens to build an ${subject} app.
|
|
2009
|
+
// 2. return object array for each item (name,type,description)
|
|
2017
2010
|
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
};
|
|
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
|
+
// };
|
|
2023
2020
|
|
|
2024
2021
|
const create_image = async function (prompt, model = 'gpt-image-1-mini', size = '1024x1024', n = 1, width = 256, height = 256) {
|
|
2025
2022
|
try {
|
|
@@ -2699,7 +2696,7 @@ export const update_ai_agent = async function (req, job_id, headers) {
|
|
|
2699
2696
|
|
|
2700
2697
|
setTimeout(async () => {
|
|
2701
2698
|
if (!name_changed) return;
|
|
2702
|
-
await update_ai_agent_properties(agent_doc, app_id);
|
|
2699
|
+
await update_ai_agent_properties(agent_doc, app_id, uid);
|
|
2703
2700
|
await update_thumbnail('ai_agent', agent_doc, app_id, uid, job_id, headers);
|
|
2704
2701
|
}, 500);
|
|
2705
2702
|
|
|
@@ -2903,6 +2900,7 @@ const upload_agent_files = async function (uid, agent_doc) {
|
|
|
2903
2900
|
const arrayBuffer = await response.arrayBuffer();
|
|
2904
2901
|
const base64Image = Buffer.from(arrayBuffer).toString('base64');
|
|
2905
2902
|
const ret = await submit_chat_gpt_prompt({
|
|
2903
|
+
uid,
|
|
2906
2904
|
prompt: [
|
|
2907
2905
|
{
|
|
2908
2906
|
role: 'user',
|
|
@@ -3051,7 +3049,7 @@ export const create_ai_agent = async function (req, job_id, headers) {
|
|
|
3051
3049
|
|
|
3052
3050
|
const data = await db_module.save_app_couch_doc_native(app_id, agent_doc);
|
|
3053
3051
|
setTimeout(async () => {
|
|
3054
|
-
await update_ai_agent_properties(agent_doc, app_id);
|
|
3052
|
+
await update_ai_agent_properties(agent_doc, app_id, uid);
|
|
3055
3053
|
await update_thumbnail('ai_agent', agent_doc, app_id, uid, job_id, headers);
|
|
3056
3054
|
}, 500);
|
|
3057
3055
|
|
|
@@ -3062,11 +3060,12 @@ export const create_ai_agent = async function (req, job_id, headers) {
|
|
|
3062
3060
|
}
|
|
3063
3061
|
};
|
|
3064
3062
|
|
|
3065
|
-
export const update_ai_agent_properties = async function (doc, app_id) {
|
|
3063
|
+
export const update_ai_agent_properties = async function (doc, app_id, uid) {
|
|
3066
3064
|
const db_doc = await db_module.get_app_couch_doc_native(app_id, doc._id);
|
|
3067
3065
|
|
|
3068
3066
|
const get_agent_assistant_name = async function () {
|
|
3069
3067
|
const ret = await submit_chat_gpt_prompt({
|
|
3068
|
+
uid,
|
|
3070
3069
|
prompt: `Generate a professional assistant name (e.g., “Data Analyst Assistant”) for the AI agent titled:
|
|
3071
3070
|
“${doc.properties.menuName}” and also base on the instructions : "${doc.agentConfig.agent_instructions}"
|
|
3072
3071
|
Output one option 3 words max.`,
|
|
@@ -3078,6 +3077,7 @@ export const update_ai_agent_properties = async function (doc, app_id) {
|
|
|
3078
3077
|
|
|
3079
3078
|
const get_agent_category = async function () {
|
|
3080
3079
|
const ret = await submit_chat_gpt_prompt({
|
|
3080
|
+
uid,
|
|
3081
3081
|
prompt: `Generate agent category for the AI agent titled:
|
|
3082
3082
|
“${doc.properties.menuName}” choose only one from the list:
|
|
3083
3083
|
Personal Productivity
|
|
@@ -3100,6 +3100,7 @@ export const update_ai_agent_properties = async function (doc, app_id) {
|
|
|
3100
3100
|
|
|
3101
3101
|
const get_agent_industry = async function () {
|
|
3102
3102
|
const ret = await submit_chat_gpt_prompt({
|
|
3103
|
+
uid,
|
|
3103
3104
|
prompt: `Generate agent industry for the AI agent titled:
|
|
3104
3105
|
“${doc.properties.menuName}” choose only one from the list:
|
|
3105
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`,
|
|
@@ -3977,7 +3978,7 @@ export const delete_prompt_attachment = async function (req, job_id, headers, fi
|
|
|
3977
3978
|
};
|
|
3978
3979
|
|
|
3979
3980
|
export const submit_chat_gpt_prompt = async function (req) {
|
|
3980
|
-
const { model = 'gpt-5-mini', prompt, response_format } = req;
|
|
3981
|
+
const { model = 'gpt-5-mini', prompt, response_format, uid } = req;
|
|
3981
3982
|
|
|
3982
3983
|
let formattedParams;
|
|
3983
3984
|
if (response_format) {
|
|
@@ -4052,10 +4053,7 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4052
4053
|
|
|
4053
4054
|
setTimeout(async () => {
|
|
4054
4055
|
// Ask GPT for title
|
|
4055
|
-
const title = await submit_chat_gpt_prompt({
|
|
4056
|
-
prompt: `create title for the prompt return 5 words result maximum text only without options : ${prompt}`,
|
|
4057
|
-
model: 'gpt-5-nano',
|
|
4058
|
-
});
|
|
4056
|
+
const title = await submit_chat_gpt_prompt({ uid, prompt: `create title for the prompt return 5 words result maximum text only without options : ${prompt}`, model: 'gpt-5-nano' });
|
|
4059
4057
|
|
|
4060
4058
|
conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_obj.id);
|
|
4061
4059
|
conversation_doc.title = title.data;
|
|
@@ -4148,6 +4146,7 @@ const update_conversation_mood_level = async function (conversation_id, prompt,
|
|
|
4148
4146
|
try {
|
|
4149
4147
|
// analyze the mood of the conversation
|
|
4150
4148
|
const mood_level = await submit_chat_gpt_prompt({
|
|
4149
|
+
uid,
|
|
4151
4150
|
prompt: `analyze the mood of the following prompt: ${prompt}. return -2: very negative,-1: negative 0:natural 1:positive 2: very positive.`,
|
|
4152
4151
|
model: 'gpt-5-nano',
|
|
4153
4152
|
response_format: z.object({
|
|
@@ -4901,6 +4900,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4901
4900
|
const base64 = fileBuffer.toString('base64');
|
|
4902
4901
|
|
|
4903
4902
|
const ret = await submit_chat_gpt_prompt({
|
|
4903
|
+
uid,
|
|
4904
4904
|
prompt: [
|
|
4905
4905
|
{
|
|
4906
4906
|
role: 'user',
|
|
@@ -4932,6 +4932,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4932
4932
|
const base64 = fileBuffer.toString('base64');
|
|
4933
4933
|
|
|
4934
4934
|
const ret = await submit_chat_gpt_prompt({
|
|
4935
|
+
uid,
|
|
4935
4936
|
prompt: [
|
|
4936
4937
|
{
|
|
4937
4938
|
role: 'user',
|
|
@@ -5590,6 +5591,7 @@ export const convert_profile_image_to_avatar = async function (req, job_id, head
|
|
|
5590
5591
|
|
|
5591
5592
|
const detect_real_person_in_image = async function (base64) {
|
|
5592
5593
|
const ret = await submit_chat_gpt_prompt({
|
|
5594
|
+
uid,
|
|
5593
5595
|
model: 'gpt-5-nano',
|
|
5594
5596
|
prompt: [
|
|
5595
5597
|
{
|