@xuda.io/ai_module 1.1.3822 → 1.1.3824
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 +4 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3992,7 +3992,7 @@ export const submit_chat_gpt_prompt = async function (req) {
|
|
|
3992
3992
|
format: formattedParams,
|
|
3993
3993
|
},
|
|
3994
3994
|
});
|
|
3995
|
-
|
|
3995
|
+
record_chat_usage(uid, response.usage.input_tokens, response.usage.output_tokens, 'submit chat', prompt);
|
|
3996
3996
|
return { code: 5, data: response.output_text };
|
|
3997
3997
|
} catch (err) {
|
|
3998
3998
|
return { code: -5, data: err.message };
|
|
@@ -4870,7 +4870,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4870
4870
|
|
|
4871
4871
|
const attachment_handler = async function () {
|
|
4872
4872
|
if (!attachments?.length) return;
|
|
4873
|
-
|
|
4873
|
+
debugger;
|
|
4874
4874
|
const get_transcript = async function (filename) {
|
|
4875
4875
|
async function streamToBuffer(fileStream) {
|
|
4876
4876
|
const chunks = [];
|
|
@@ -6242,7 +6242,7 @@ const create_ai_agent_image = async function (req, job_id, headers) {
|
|
|
6242
6242
|
}
|
|
6243
6243
|
};
|
|
6244
6244
|
|
|
6245
|
-
const record_chat_usage = async function (uid, input_tokens, output_tokens, source,
|
|
6245
|
+
const record_chat_usage = async function (uid, input_tokens, output_tokens, source, prompt) {
|
|
6246
6246
|
try {
|
|
6247
6247
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
6248
6248
|
|
|
@@ -6250,7 +6250,7 @@ const record_chat_usage = async function (uid, input_tokens, output_tokens, sour
|
|
|
6250
6250
|
let usage_doc = {
|
|
6251
6251
|
_id: await _common.xuda_get_uuid('chat_usage'),
|
|
6252
6252
|
docType: 'chat_usage',
|
|
6253
|
-
|
|
6253
|
+
prompt: prompt.substr(0, 40),
|
|
6254
6254
|
date_created_ts: t,
|
|
6255
6255
|
uid,
|
|
6256
6256
|
source,
|