@xuda.io/ai_module 1.1.4803 → 1.1.4805

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 (3) hide show
  1. package/index.mjs +2 -0
  2. package/old.mjs +655 -0
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -11373,3 +11373,5 @@ export const get_person_info = async function (uid, name, email, account_profile
11373
11373
  return getDefaultPersonInfo(name, email, email_context, error.message);
11374
11374
  }
11375
11375
  };
11376
+
11377
+ export const open_ai_alive_check = async function () {};
package/old.mjs CHANGED
@@ -4788,3 +4788,658 @@ for await (let account_profile of profile_requests_from_res.docs) {
4788
4788
 
4789
4789
  // return normalizedBuffer.toString('base64'); // Return normalized base64 string
4790
4790
  // }
4791
+
4792
+
4793
+ /////////////////////
4794
+
4795
+
4796
+
4797
+ // export const submit_agentic_studio_chat_gpt_prompt = async function (req) {
4798
+ // try {
4799
+ // const { user_prompt, object_unit = 'app', uid, app_id } = req;
4800
+ // // const model = 'ft:gpt-4o-2024-08-06:xuda-io:vps-hosting-plans:CDaxQiXo'; // 'gpt-4o'; //'gpt-4.1'; //
4801
+
4802
+ // const app_obj = await get_app_obj(app_id);
4803
+
4804
+ // // let check_results = {};
4805
+ // const auth = async function () {
4806
+ // if (app_obj.app_uId !== uid) {
4807
+ // const db_team = get_xuda_couch('xuda_team');
4808
+ // let master_auth_users = await db_team.view('xuda', 'user_active_shares', {
4809
+ // key: [uid, app_id],
4810
+ // });
4811
+ // if (!master_auth_users.rows.includes(uid)) {
4812
+ // throw new Error('user unauthorized');
4813
+ // }
4814
+ // }
4815
+ // };
4816
+
4817
+ // await auth();
4818
+
4819
+ // const userName = await get_user_name(uid);
4820
+
4821
+ // const get_zod_unit_schema = function (type) {
4822
+ // init(app_obj, {}, _, true, null, null, UglifyJS, JSON5, _conf, false, z);
4823
+ // const schema = get_zod_schema(type);
4824
+ // const jsonSchema = zodToJsonSchema(schema);
4825
+ // return JSON.stringify(jsonSchema, null, 2);
4826
+ // };
4827
+
4828
+ // const get_app_instructions = function (object_unit) {
4829
+ // return `
4830
+ // ### context ###
4831
+ // uid=${uid}
4832
+ // app_id=${app_id}
4833
+
4834
+ // ### Persona & Role ###
4835
+ // - You are a helpful and professional technical assistant named ${object_unit} builder.
4836
+
4837
+ // ### Tasks ###
4838
+
4839
+ // Your job is to assist the user with creating a ${user_prompt} that includes all tasks needed.
4840
+
4841
+ // ### workflow ###
4842
+
4843
+ // Steps:
4844
+ // 1. list all the tables needed for the task.
4845
+ // 2. prefix each table with the subject of the ${user_prompt} (e.g: CRM - Tasks).
4846
+ // 3. iterate the table list and build tables array using the Table builder tool, add the Table builder tool results and the table name in array RESULTS_ARR.
4847
+
4848
+ // ### Additional information ###
4849
+
4850
+ // ### Output ###
4851
+ // return the RESULTS_ARR Array.
4852
+
4853
+ // ### Examples ###
4854
+
4855
+ // `;
4856
+ // };
4857
+
4858
+ // const get_table_instructions = function (object_unit) {
4859
+ // return `
4860
+ // ### context ###
4861
+ // uid=${uid}
4862
+ // app_id=${app_id}
4863
+
4864
+ // ### Persona & Role ###
4865
+ // - You are a helpful and professional technical assistant named ${object_unit} builder.
4866
+
4867
+ // ### Tasks ###
4868
+
4869
+ // Your job is to assist the user with creating a ${user_prompt} that includes a full set of fields according to the provided ${object_unit} structure.
4870
+
4871
+ // - You must include all relevant fields a typical ${user_prompt} would require
4872
+ // - Add **multiple entries** in the "tableFields" array as needed to fully represent the structure.
4873
+ // - Follow the format and conventions shown in the ${object_unit} structure example.
4874
+ // - use uid for "createdByUid" and "checkedInUserId"
4875
+
4876
+ // ### workflow ###
4877
+
4878
+ // Steps:
4879
+ // 1. Use create_initial_studio_doc_tool to create the initial doc assign the return result in "doc" variable.
4880
+
4881
+ // 3. Use check_studio_doc_tool to check the ${object_unit} send the ${object_unit} as the doc, fix the issues if needed. if the check fail for 3 times the throw error, skip **Save Doc** tool if errors exist
4882
+ // 4. Use **Save Doc** tool to save the ${object_unit} doc and update the result in save_result variable,NEVER save if errors exist after check_studio_doc_tool
4883
+
4884
+ // ### Output ###
4885
+ // if success: {code:1,data:save_result}
4886
+ // if fail: {code:-1,data:error}
4887
+
4888
+ // ### EXAMPLE
4889
+
4890
+ // {
4891
+ // "_id": "5b1_tbl_47f0ac6059ca",
4892
+ // "app_id": "prj3937cb6f9a31c8c7dea25055bba845b1",
4893
+ // "stat": 3,
4894
+ // "docType": "studio",
4895
+ // "docDate": 1714916369797,
4896
+ // "ts": 1762953659001,
4897
+ // "order_ts": 1714916369797,
4898
+ // "studio_meta": {
4899
+ // "created": 1714916369797,
4900
+ // "createdByUid": "341cf2d32991a68e4d8aaba6c16e15cc",
4901
+ // "checkedInUserId": "341cf2d32991a68e4d8aaba6c16e15cc",
4902
+ // "checkedInUserName": "Ioshka Media",
4903
+ // "parentId": "database",
4904
+ // "savedByUid": "341cf2d32991a68e4d8aaba6c16e15cc"
4905
+ // },
4906
+ // "properties": {
4907
+ // "menuType": "table",
4908
+ // "menuName": "PT - Practice Table",
4909
+ // "databaseSocket": "@xuda.io/xuda-dbs-plugin-xuda",
4910
+ // "menuTitle": "PT - Practice Table"
4911
+ // },
4912
+ // "tableIndexes": [
4913
+ // {
4914
+ // "id": "76bbf201-997e-402c-b435-0649cc25d117",
4915
+ // "data": {
4916
+ // "name": "Primary_Index",
4917
+ // "unique": true,
4918
+ // "keys": [
4919
+ // "PT_Id"
4920
+ // ]
4921
+ // },
4922
+ // "props": {} <-- must appear even if empty
4923
+ // },
4924
+ // {
4925
+ // "id": "89f1609d-de4e-4b61-9357-284b1261314c",
4926
+ // "data": {
4927
+ // "name": "Index_2",
4928
+ // "unique": false,
4929
+ // "keys": [
4930
+ // "PT_Stat",
4931
+ // "PT_Group_Id"
4932
+ // ]
4933
+ // },
4934
+ // "props": {} <-- must appear even if empty
4935
+ // }
4936
+ // ],
4937
+ // "tableFields": [
4938
+ // {
4939
+ // "id": "b41aa880-56ec-4029-a21b-60c89a52b62e",
4940
+ // "data": {
4941
+ // "field_id": "PT_Id"
4942
+ // },
4943
+ // "props": {
4944
+ // "label":"Practice Id",
4945
+ // "fieldType": "string",
4946
+ // "mandatory": true
4947
+ // }
4948
+
4949
+ // },
4950
+ // {
4951
+ // "id": "8aec82db-35d9-4828-9fc7-49373c531cc3",
4952
+ // "data": {
4953
+ // "field_id": "PT_Type"
4954
+ // },
4955
+ // "props": {
4956
+ // "label":"Practice Type",
4957
+ // "fieldType": "string",
4958
+ // "mandatory": true
4959
+ // }
4960
+
4961
+ // },
4962
+ // {
4963
+ // "id": "d27c56e5-faec-4a0a-ad42-7bf55f8c67b3",
4964
+ // "data": {
4965
+ // "field_id": "PT_Stat"
4966
+ // },
4967
+ // "props": {
4968
+ // "label":"Practice Status",
4969
+ // "fieldType": "number",
4970
+ // "fieldComment": "1 = Draft\n2 = Private\n3 = Public\n4 = Deleted",
4971
+ // "mandatory": true
4972
+ // }
4973
+
4974
+ // },
4975
+ // {
4976
+ // "id": "659fbfb3-7dcc-4ea0-b1e9-5dd9553a99fc",
4977
+ // "data": {
4978
+ // "field_id": "PT_Question"
4979
+ // },
4980
+ // "props": {
4981
+ // "label":"Practice Question",
4982
+ // "fieldType": "string"
4983
+ // }
4984
+
4985
+ // },
4986
+ // {
4987
+ // "id": "080c8ceb-5a51-437b-8ad1-9fc005c79011",
4988
+ // "data": {
4989
+ // "field_id": "PT_Options"
4990
+ // },
4991
+ // "props": {
4992
+ // "label":"Practice Options",
4993
+ // "fieldType": "array"
4994
+ // }
4995
+
4996
+ // },
4997
+ // {
4998
+ // "id": "72c04aac-b3e7-4e7a-8a74-31075de3dbec",
4999
+ // "data": {
5000
+ // "field_id": "PT_Answer"
5001
+ // },
5002
+ // "props": {
5003
+ // "label":"Practice Answer",
5004
+ // "fieldType": "string"
5005
+ // }
5006
+
5007
+ // },
5008
+ // {
5009
+ // "id": "e37b08c6-f340-425a-bf01-809b28a486d3",
5010
+ // "data": {
5011
+ // "field_id": "PT_Matching_Answer"
5012
+ // },
5013
+ // "props": {
5014
+ // "label":"Practice Matching Answer",
5015
+ // "fieldType": "object"
5016
+ // },
5017
+
5018
+ // },
5019
+ // {
5020
+ // "id": "8ca4ace1-2010-45be-b7aa-2672ce0e6fea",
5021
+ // "data": {
5022
+ // "field_id": "PT_Group_Id"
5023
+ // },
5024
+ // "props": {
5025
+ // "label":"Practice Group Id",
5026
+ // "fieldType": "string"
5027
+ // }
5028
+
5029
+ // },
5030
+ // {
5031
+ // "id": "ae749c6d-1f39-4750-b79e-f016d50b8a11",
5032
+ // "data": {
5033
+ // "field_id": "PT_Difficulty"
5034
+ // },
5035
+ // "props": {
5036
+ // "label":"Practice Difficulty",
5037
+ // "fieldType": "number"
5038
+ // },
5039
+
5040
+ // },
5041
+ // {
5042
+ // "id": "5c5e7cb5-feee-4bc7-9d94-0ccd04a5eb06",
5043
+ // "data": {
5044
+ // "field_id": "PT_Uid"
5045
+ // },
5046
+ // "props": {
5047
+ // "label":"Practice User Id",
5048
+ // "fieldType": "string"
5049
+ // }
5050
+
5051
+ // }
5052
+ // ]
5053
+ // }
5054
+ // `;
5055
+ // };
5056
+
5057
+ // const get_folder_instructions = function (object_unit) {
5058
+ // return `
5059
+ // ### context ###
5060
+ // uid=${uid}
5061
+ // app_id=${app_id}
5062
+
5063
+ // ### Persona & Role ###
5064
+ // - You are a helpful and professional technical assistant named ${object_unit} builder.
5065
+
5066
+ // ### Tasks ###
5067
+
5068
+ // Your job is to assist the user with creating a ${user_prompt}.
5069
+
5070
+ // - Follow the format and conventions shown in the ${object_unit} structure example.
5071
+ // - use uid for "createdByUid" and "checkedInUserId"
5072
+
5073
+ // ### workflow ###
5074
+
5075
+ // Steps:
5076
+ // 1. Use create_initial_studio_doc_tool to create the initial doc assign the return result in "doc" variable.
5077
+ // 2. Get the ${object_unit} structure example from ### Structure and Examples ### section.
5078
+ // 3. Build the ${object_unit} and validate against vs_68af4c84631c81919709268c2d0f1687
5079
+ // 4. Use check_studio_doc_tool to check the ${object_unit} send the ${object_unit} as the doc, fix the issues if needed. if the check fail for 3 times the throw error, skip **Save Doc** tool if errors exist
5080
+ // 5. Use **Save Doc** tool to save the ${object_unit} doc and update the result in save_result variable,NEVER save if errors exist after check_studio_doc_tool
5081
+
5082
+ // ### Additional information ###
5083
+ // ${studio_units[object_unit].short}
5084
+
5085
+ // ### Output ###
5086
+ // if success: {code:1,data:save_result}
5087
+ // if fail: {code:-1,data:error}
5088
+ // `;
5089
+ // };
5090
+
5091
+ // const get_component_instructions = function (object_unit) {
5092
+ // return `
5093
+ // ### context ###
5094
+ // uid=${uid}
5095
+ // app_id=${app_id}
5096
+
5097
+ // ### Persona & Role ###
5098
+ // - You are a helpful and professional technical assistant named ${object_unit} builder.
5099
+
5100
+ // ### Tasks ###
5101
+
5102
+ // Your job is to assist the user with creating a ${user_prompt} that includes modern ui using Tailwind
5103
+
5104
+ // - You must include all relevant fields a typical ${user_prompt} would require
5105
+
5106
+ // - Follow the format and conventions shown in the ${object_unit} structure example.
5107
+ // - use uid for "createdByUid" and "checkedInUserId"
5108
+
5109
+ // ### workflow ###
5110
+
5111
+ // Steps:
5112
+ // 1. Use create_initial_studio_doc_tool to create the initial doc assign the return result in "doc" variable.
5113
+
5114
+ // 2. use ### Structure and Examples ### section to build the object
5115
+ // 3. Use check_studio_doc_tool to check the ${object_unit} send the ${object_unit} as the doc, fix the issues if needed. if the check fail for 10 times the throw error, skip **Save Doc** tool if errors exist
5116
+ // 4. Use **Save Doc** tool to save the ${object_unit} doc and update the result in save_result variable,NEVER save if errors exist after check_studio_doc_tool
5117
+
5118
+ // ### Additional information ###
5119
+ // ${studio_units[object_unit].short}
5120
+
5121
+ // ### Structure and Examples ###
5122
+
5123
+ // ${get_zod_unit_schema('component')}
5124
+
5125
+ // ### Output ###
5126
+ // if success: {code:1,data:save_result}
5127
+ // if fail: {code:-1,data:error}
5128
+ // `;
5129
+ // };
5130
+ // const get_get_data_instructions = function (object_unit) {
5131
+ // return `
5132
+ // ### context ###
5133
+ // uid=${uid}
5134
+ // app_id=${app_id}
5135
+
5136
+ // ### Persona & Role ###
5137
+ // - You are a helpful and professional technical assistant named ${object_unit} builder.
5138
+
5139
+ // ### Tasks ###
5140
+
5141
+ // Your job is to assist the user with creating a ${user_prompt}.
5142
+
5143
+ // - You must include all relevant fields a typical ${user_prompt} would require
5144
+
5145
+ // - Follow the format and conventions shown in the ${object_unit} structure example.
5146
+ // - use uid for "createdByUid" and "checkedInUserId"
5147
+
5148
+ // ### workflow ###
5149
+
5150
+ // Steps:
5151
+ // 1. Use create_initial_studio_doc_tool to create the initial doc assign the return result in "doc" variable.
5152
+ // 2. Get the ${object_unit} structure example from ### Structure and Examples ### section.
5153
+ // 3. Build the ${object_unit} and validate against vs_68af4c84631c81919709268c2d0f1687
5154
+ // 4. Use check_studio_doc_tool to check the ${object_unit} send the ${object_unit} as the doc, fix the issues if needed. if the check fail for 10 times the throw error, skip **Save Doc** tool if errors exist
5155
+ // 5. Use **Save Doc** tool to save the ${object_unit} doc and update the result in save_result variable,NEVER save if errors exist after check_studio_doc_tool
5156
+
5157
+ // ### Additional information ###
5158
+ // ${studio_units[object_unit].short}
5159
+
5160
+ // ### Output ###
5161
+ // if success: {code:1,data:save_result}
5162
+ // if fail: {code:-1,data:error}
5163
+ // `;
5164
+ // };
5165
+
5166
+ // const get_agents_as_a_tool = function (agent_list = []) {
5167
+ // let _tools = [];
5168
+ // for (const agent of agent_list) {
5169
+ // const _agent = new Agent(studio_agents_obj[agent]);
5170
+ // const tool = _agent.asTool({
5171
+ // toolName: studio_agents_obj[agent].name,
5172
+ // toolDescription: `Generate a ${agent} of the supplied text.`,
5173
+ // });
5174
+
5175
+ // _tools.push(tool);
5176
+ // }
5177
+
5178
+ // return _tools;
5179
+ // };
5180
+
5181
+ // let studio_agents_obj = {
5182
+ // app: {
5183
+ // name: 'App builder',
5184
+ // instructions: get_app_instructions(),
5185
+ // tools: [get_user_name_tool],
5186
+ // model,
5187
+ // modelSettings: {
5188
+ // toolChoice: 'required', // ← this enables tool use
5189
+ // responseFormat: {
5190
+ // text: {
5191
+ // format: {
5192
+ // type: 'array', // or "markdown" if needed
5193
+ // },
5194
+ // },
5195
+ // },
5196
+ // outputType: z.array(z.object()),
5197
+ // },
5198
+ // },
5199
+ // table: {
5200
+ // name: 'Table builder',
5201
+ // instructions: get_table_instructions('table'),
5202
+ // tools: [get_user_name_tool, create_initial_studio_doc_tool, check_studio_doc_tool, save_doc_tool], //fileSearchTool('vs_68af4c84631c81919709268c2d0f1687'), fileSearchTool('vs_68af473196a88191afc6610fddfe4a62')
5203
+ // model,
5204
+ // modelSettings: {
5205
+ // toolChoice: 'required', // ← this enables tool use
5206
+ // responseFormat: {
5207
+ // text: {
5208
+ // format: {
5209
+ // type: 'array', // or "markdown" if needed
5210
+ // },
5211
+ // },
5212
+ // },
5213
+ // outputType: z.array(
5214
+ // z.object({
5215
+ // _id: z.string(),
5216
+ // stat: z.number(),
5217
+ // docType: z.string(),
5218
+ // docDate: z.number(),
5219
+ // ts: z.number(),
5220
+ // order_ts: z.number(),
5221
+ // studio_meta: z.object({
5222
+ // created: z.number(),
5223
+ // createdByUid: z.string(),
5224
+ // checkedInUserId: z.string(),
5225
+ // savedByUid: z.string(),
5226
+ // checkedInUserName: z.string(),
5227
+ // parentId: z.string(),
5228
+ // source: z.string(),
5229
+ // }),
5230
+ // properties: z.object({
5231
+ // menuName: z.string(),
5232
+ // menuType: z.string(),
5233
+ // databaseSocket: z.string(),
5234
+ // }),
5235
+ // tableIndexes: z.array(
5236
+ // z.object({
5237
+ // id: z.string(),
5238
+ // data: z.object({
5239
+ // name: z.string(),
5240
+ // unique: z.boolean(),
5241
+ // keys: z.array(z.string()),
5242
+ // }),
5243
+ // props: z.object({}),
5244
+ // }),
5245
+ // ),
5246
+ // tableFields: z.array(
5247
+ // z.object({
5248
+ // id: z.string(),
5249
+ // data: z.object({
5250
+ // field_id: z.string(),
5251
+ // }),
5252
+ // props: z.object({
5253
+ // label: z.string(),
5254
+ // fieldType: z.string(),
5255
+ // }),
5256
+ // }),
5257
+ // ),
5258
+ // }),
5259
+ // ),
5260
+ // },
5261
+ // },
5262
+ // folder: {
5263
+ // name: 'Folder builder',
5264
+ // instructions: get_folder_instructions('folder'),
5265
+ // tools: [get_user_name_tool, create_initial_studio_doc_tool, check_studio_doc_tool, save_doc_tool], //fileSearchTool('vs_68af4c84631c81919709268c2d0f1687'), fileSearchTool('vs_68af44989e4881918fc8bf8e84c6ce03')
5266
+ // model, //: 'gpt-4o'
5267
+ // modelSettings: {
5268
+ // toolChoice: 'required', // ← this enables tool use
5269
+ // responseFormat: {
5270
+ // text: {
5271
+ // format: {
5272
+ // type: 'array', // or "markdown" if needed
5273
+ // },
5274
+ // },
5275
+ // },
5276
+ // outputType: z.array(
5277
+ // z.object({
5278
+ // _id: z.string(),
5279
+ // stat: z.number(),
5280
+ // docType: z.string(),
5281
+ // docDate: z.number(),
5282
+ // ts: z.number(),
5283
+ // order_ts: z.number(),
5284
+ // studio_meta: z.object({
5285
+ // created: z.number(),
5286
+ // createdByUid: z.string(),
5287
+ // checkedInUserId: z.string(),
5288
+ // savedByUid: z.string(),
5289
+ // checkedInUserName: z.string(),
5290
+ // parentId: z.string(),
5291
+ // source: z.string(),
5292
+ // }),
5293
+ // properties: z.object({
5294
+ // menuName: z.string(),
5295
+ // menuType: z.string(),
5296
+ // databaseSocket: z.string(),
5297
+ // }),
5298
+ // }),
5299
+ // ),
5300
+ // },
5301
+ // },
5302
+ // component: {
5303
+ // name: 'Component builder',
5304
+ // instructions: get_component_instructions('component'),
5305
+ // tools: [get_user_name_tool, create_initial_studio_doc_tool, check_studio_doc_tool, save_doc_tool], //, fileSearchTool('vs_68af48a65cf88191a48a0f530d7e3919')
5306
+ // model,
5307
+ // modelSettings: {
5308
+ // toolChoice: 'required', // ← this enables tool use
5309
+ // responseFormat: {
5310
+ // text: {
5311
+ // format: {
5312
+ // type: 'array', // or "markdown" if needed
5313
+ // },
5314
+ // },
5315
+ // },
5316
+ // outputType: z.array(
5317
+ // z.object({
5318
+ // _id: z.string(),
5319
+ // stat: z.number(),
5320
+ // docType: z.string(),
5321
+ // docDate: z.number(),
5322
+ // ts: z.number(),
5323
+ // order_ts: z.number(),
5324
+ // studio_meta: z.object({
5325
+ // created: z.number(),
5326
+ // createdByUid: z.string(),
5327
+ // checkedInUserId: z.string(),
5328
+ // savedByUid: z.string(),
5329
+ // checkedInUserName: z.string(),
5330
+ // parentId: z.string(),
5331
+ // source: z.string(),
5332
+ // }),
5333
+ // properties: z.object({
5334
+ // menuName: z.string(),
5335
+ // menuType: z.string(),
5336
+ // databaseSocket: z.string(),
5337
+ // }),
5338
+ // progDataSource: z.object({}),
5339
+ // progFields: z.array(z.object({})),
5340
+ // progEvents: z.array(z.object({})),
5341
+ // progUi: z.array(z.object({})),
5342
+ // }),
5343
+ // ),
5344
+ // },
5345
+ // },
5346
+ // get_data: {
5347
+ // name: 'Get data builder',
5348
+ // instructions: get_get_data_instructions('get_data'),
5349
+ // tools: [get_user_name_tool, create_initial_studio_doc_tool, check_studio_doc_tool, save_doc_tool], //fileSearchTool('vs_68af4c84631c81919709268c2d0f1687'), fileSearchTool('vs_68af530d4ba081919ca57eabb5ae117a')
5350
+ // model,
5351
+ // modelSettings: {
5352
+ // toolChoice: 'required', // ← this enables tool use
5353
+ // responseFormat: {
5354
+ // text: {
5355
+ // format: {
5356
+ // type: 'array', // or "markdown" if needed
5357
+ // },
5358
+ // },
5359
+ // },
5360
+ // outputType: z.array(
5361
+ // z.object({
5362
+ // _id: z.string(),
5363
+ // stat: z.number(),
5364
+ // docType: z.string(),
5365
+ // docDate: z.number(),
5366
+ // ts: z.number(),
5367
+ // order_ts: z.number(),
5368
+ // studio_meta: z.object({
5369
+ // created: z.number(),
5370
+ // createdByUid: z.string(),
5371
+ // checkedInUserId: z.string(),
5372
+ // savedByUid: z.string(),
5373
+ // checkedInUserName: z.string(),
5374
+ // parentId: z.string(),
5375
+ // source: z.string(),
5376
+ // }),
5377
+ // properties: z.object({
5378
+ // menuName: z.string(),
5379
+ // menuType: z.string(),
5380
+ // databaseSocket: z.string(),
5381
+ // }),
5382
+ // progDataSource: z.object({}),
5383
+ // progFields: z.array(z.object({})),
5384
+ // progEvents: z.array(z.object({})),
5385
+ // }),
5386
+ // ),
5387
+ // },
5388
+ // },
5389
+ // };
5390
+
5391
+ // if (object_unit === 'app') {
5392
+ // const agents_as_a_tool_arr = get_agents_as_a_tool(['table', 'folder', 'component', 'get_data']);
5393
+ // studio_agents_obj.app.tools = [...studio_agents_obj.app.tools, ...agents_as_a_tool_arr];
5394
+ // }
5395
+
5396
+ // const run = async function (user_prompt, object_unit) {
5397
+ // const _agent = new Agent(studio_agents_obj[object_unit]);
5398
+ // const runner = new Runner();
5399
+
5400
+ // const result = await runner.run(_agent, user_prompt, {
5401
+ // context: { uid, app_id, userName },
5402
+ // });
5403
+
5404
+ // return result;
5405
+ // };
5406
+
5407
+ // const result = await run(user_prompt, object_unit);
5408
+
5409
+ // return { code: 100, data: result.finalOutput };
5410
+ // } catch (err) {
5411
+ // debugger;
5412
+ // console.error('>>>>> AI:', err);
5413
+ // console.error('Cause:', err?.cause?.message);
5414
+ // return { code: -100, data: err.message };
5415
+ // }
5416
+ // };
5417
+
5418
+ // export const get_chat_conversation = async function (req) {
5419
+ // let { conversation_id, order = 'asc', limit, after, _id, uid } = req;
5420
+
5421
+ // const account_profile_info = await account_module.get_active_account_profile_info(uid);
5422
+
5423
+ // if (_id) {
5424
+
5425
+ // let data = await db_module.get_app_couch_doc(account_profile_info.app_id, _id);
5426
+ // return data;
5427
+ // }
5428
+
5429
+ // try {
5430
+ // // const project_db = await get_account_project_db(uid);
5431
+ // // let conversation_doc = await project_db.get(conversation_id);
5432
+ // let conversation_doc = await db_module.get_app_couch_doc(account_profile_info.app_id, conversation_id);
5433
+ // let reference_doc;
5434
+ // if (conversation_doc.shared_from_uid) {
5435
+ // reference_doc = _.cloneDeep(conversation_doc);
5436
+ // conversation_doc = await db_module.get_app_couch_doc_native(reference_doc.shared_from_app_id, reference_doc.share_item_id);
5437
+ // conversation_doc.reference_doc = reference_doc;
5438
+ // }
5439
+ // let conversation = await client.conversations.items.list(conversation_id, { limit, order, after });
5440
+
5441
+ // return { code: 15, data: { conversation, ...conversation_doc } };
5442
+ // } catch (err) {
5443
+ // return { code: -15, data: err.message };
5444
+ // }
5445
+ // };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4803",
3
+ "version": "1.1.4805",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",