@xuda.io/ai_module 1.1.4142 → 1.1.4144

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 +9 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1698,15 +1698,18 @@ export const submit_agentic_studio_chat_gpt_prompt = async function (req) {
1698
1698
  export const get_chat_conversation = async function (req) {
1699
1699
  let { conversation_id, order = 'asc', limit, after, _id, uid } = req;
1700
1700
 
1701
+ const account_profile_info = await account_module.get_active_account_profile_info(uid);
1702
+
1701
1703
  if (_id) {
1702
- const app_id = await account_module.get_account_default_project_id(uid);
1703
- let data = await db_module.get_app_couch_doc(app_id, _id);
1704
+ // const app_id = await account_module.get_account_default_project_id(uid);
1705
+ let data = await db_module.get_app_couch_doc(account_profile_info.app_id, _id);
1704
1706
  return data;
1705
1707
  }
1706
1708
 
1707
1709
  try {
1708
- const project_db = await get_account_project_db(uid);
1709
- let conversation_doc = await project_db.get(conversation_id);
1710
+ // const project_db = await get_account_project_db(uid);
1711
+ // let conversation_doc = await project_db.get(conversation_id);
1712
+ let conversation_doc = await db_module.get_app_couch_doc(account_profile_info.app_id, conversation_id);
1710
1713
  let reference_doc;
1711
1714
  if (conversation_doc.shared_from_uid) {
1712
1715
  reference_doc = _.cloneDeep(conversation_doc);
@@ -2018,7 +2021,7 @@ export const unarchive_ai_chat = async function (req) {
2018
2021
  // }
2019
2022
  // };
2020
2023
 
2021
- const create_image = async function (uid, prompt, model = 'gpt-image-1-mini', size = '1024x1024', n = 1, width = 256, height = 256, metadata = {}) {
2024
+ const create_image = async function (uid, prompt, model = 'gpt-image-1-mini', size = '1024x1024', n = 1, width = 256, height = 256, metadata = {}, account_profile_info) {
2022
2025
  try {
2023
2026
  const response = await client.images.generate({
2024
2027
  model,
@@ -2062,7 +2065,7 @@ const create_image = async function (uid, prompt, model = 'gpt-image-1-mini', si
2062
2065
 
2063
2066
  const thumbnailBase64 = resized.toString('base64');
2064
2067
 
2065
- record_chat_usage(uid, response.usage.input_tokens, response.usage.output_tokens, 'create image', prompt, model, metadata);
2068
+ record_chat_usage(uid, response.usage.input_tokens, response.usage.output_tokens, 'create image', prompt, model, metadata, account_profile_info);
2066
2069
 
2067
2070
  return thumbnailBase64;
2068
2071
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4142",
3
+ "version": "1.1.4144",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",