@resolveio/server-lib 22.2.22 → 22.2.24
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/managers/openai-usage-ledger.manager.d.ts +1 -1
- package/managers/openai-usage-ledger.manager.js +4 -3
- package/managers/openai-usage-ledger.manager.js.map +1 -1
- package/managers/subscription.manager.d.ts +1 -0
- package/managers/subscription.manager.js +33 -7
- package/managers/subscription.manager.js.map +1 -1
- package/methods/ai-terminal.js +10 -17
- package/methods/ai-terminal.js.map +1 -1
- package/methods/mongo-explorer.js +2 -2
- package/methods/mongo-explorer.js.map +1 -1
- package/methods/report-builder.js +11 -13
- package/methods/report-builder.js.map +1 -1
- package/package.json +1 -1
package/methods/ai-terminal.js
CHANGED
|
@@ -1479,9 +1479,8 @@ function executeAiTerminalRun(payload, context) {
|
|
|
1479
1479
|
return [4 /*yield*/, resolveClientId(conversation, input.id_client, context === null || context === void 0 ? void 0 : context.id_user)];
|
|
1480
1480
|
case 18:
|
|
1481
1481
|
idClient = _b.sent();
|
|
1482
|
-
if (!idClient) return [3 /*break*/, 20];
|
|
1483
1482
|
return [4 /*yield*/, (0, openai_usage_ledger_manager_1.recordOpenAIUsage)({
|
|
1484
|
-
id_client: idClient,
|
|
1483
|
+
id_client: idClient || '',
|
|
1485
1484
|
model: codexModel || 'unknown',
|
|
1486
1485
|
input_tokens: usage.inputTokens,
|
|
1487
1486
|
output_tokens: usage.outputTokens,
|
|
@@ -1491,8 +1490,6 @@ function executeAiTerminalRun(payload, context) {
|
|
|
1491
1490
|
})];
|
|
1492
1491
|
case 19:
|
|
1493
1492
|
_b.sent();
|
|
1494
|
-
_b.label = 20;
|
|
1495
|
-
case 20:
|
|
1496
1493
|
userDoc = {
|
|
1497
1494
|
id_conversation: conversation._id,
|
|
1498
1495
|
role: 'user',
|
|
@@ -1517,20 +1514,20 @@ function executeAiTerminalRun(payload, context) {
|
|
|
1517
1514
|
updatedAt: now
|
|
1518
1515
|
};
|
|
1519
1516
|
return [4 /*yield*/, ai_terminal_message_collection_1.AiTerminalMessages.insertOne(userDoc)];
|
|
1520
|
-
case
|
|
1517
|
+
case 20:
|
|
1521
1518
|
_b.sent();
|
|
1522
1519
|
return [4 /*yield*/, ai_terminal_message_collection_1.AiTerminalMessages.insertOne(assistantDoc)];
|
|
1523
|
-
case
|
|
1520
|
+
case 21:
|
|
1524
1521
|
insertResult = _b.sent();
|
|
1525
1522
|
return [4 /*yield*/, touchConversation(conversation._id, now, insertResult._id)];
|
|
1526
|
-
case
|
|
1523
|
+
case 22:
|
|
1527
1524
|
_b.sent();
|
|
1528
|
-
if (!(input.delete_files_after_run !== false)) return [3 /*break*/,
|
|
1525
|
+
if (!(input.delete_files_after_run !== false)) return [3 /*break*/, 24];
|
|
1529
1526
|
return [4 /*yield*/, cleanupAttachments(attachmentData.attachments)];
|
|
1530
|
-
case
|
|
1527
|
+
case 23:
|
|
1531
1528
|
_b.sent();
|
|
1532
|
-
_b.label =
|
|
1533
|
-
case
|
|
1529
|
+
_b.label = 24;
|
|
1530
|
+
case 24: return [2 /*return*/, {
|
|
1534
1531
|
conversation: conversation,
|
|
1535
1532
|
message: assistantDoc,
|
|
1536
1533
|
usage: assistantDoc.usage
|
|
@@ -1591,9 +1588,8 @@ function executeAiFormPatch(payload, context) {
|
|
|
1591
1588
|
return [4 /*yield*/, resolveClientIdFromConfig(input.id_client, context === null || context === void 0 ? void 0 : context.id_user)];
|
|
1592
1589
|
case 2:
|
|
1593
1590
|
idClient = _b.sent();
|
|
1594
|
-
if (!idClient) return [3 /*break*/, 4];
|
|
1595
1591
|
return [4 /*yield*/, (0, openai_usage_ledger_manager_1.recordOpenAIUsage)({
|
|
1596
|
-
id_client: idClient,
|
|
1592
|
+
id_client: idClient || '',
|
|
1597
1593
|
model: codexModel || 'unknown',
|
|
1598
1594
|
input_tokens: usage.inputTokens,
|
|
1599
1595
|
output_tokens: usage.outputTokens,
|
|
@@ -1602,8 +1598,6 @@ function executeAiFormPatch(payload, context) {
|
|
|
1602
1598
|
})];
|
|
1603
1599
|
case 3:
|
|
1604
1600
|
_b.sent();
|
|
1605
|
-
_b.label = 4;
|
|
1606
|
-
case 4:
|
|
1607
1601
|
parsed = parseJsonObject(responseText);
|
|
1608
1602
|
if (!parsed || typeof parsed !== 'object') {
|
|
1609
1603
|
throw new Error('AI form patch response was not valid JSON.');
|
|
@@ -2968,12 +2962,11 @@ function executeAiAssistantCodexRun(payload, context) {
|
|
|
2968
2962
|
return [4 /*yield*/, resolveClientId(conversation, input.id_client, context === null || context === void 0 ? void 0 : context.id_user)];
|
|
2969
2963
|
case 72:
|
|
2970
2964
|
usageClientId = _22.sent();
|
|
2971
|
-
if (!usageClientId) return [3 /*break*/, 76];
|
|
2972
2965
|
_22.label = 73;
|
|
2973
2966
|
case 73:
|
|
2974
2967
|
_22.trys.push([73, 75, , 76]);
|
|
2975
2968
|
return [4 /*yield*/, (0, openai_usage_ledger_manager_1.recordOpenAIUsage)({
|
|
2976
|
-
id_client: usageClientId,
|
|
2969
|
+
id_client: usageClientId || '',
|
|
2977
2970
|
model: finalUsage.model,
|
|
2978
2971
|
input_tokens: finalUsage.input_tokens,
|
|
2979
2972
|
output_tokens: finalUsage.output_tokens,
|