only_ever_generator 8.3.6 → 8.3.7
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/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/helper/get_id_from_title.d.ts.map +1 -1
- package/dist/helper/get_id_from_title.js +2 -1
- package/dist/helper/get_id_from_title.js.map +1 -1
- package/dist/helper/mongo_helper.d.ts +3 -4
- package/dist/helper/mongo_helper.d.ts.map +1 -1
- package/dist/helper/mongo_helper.js +34 -7
- package/dist/helper/mongo_helper.js.map +1 -1
- package/dist/helper/schema_helper/build_card_schema.js +3 -3
- package/dist/helper/schema_helper/build_card_schema.js.map +1 -1
- package/dist/helper/schema_helper/build_classify_summarize_schema.js +2 -2
- package/dist/helper/schema_helper/build_classify_summarize_schema.js.map +1 -1
- package/dist/helper/schema_helper/build_concept_facts_schema.js +2 -2
- package/dist/helper/schema_helper/build_concept_facts_schema.js.map +1 -1
- package/dist/helper/schema_helper/build_summary_schema.js +2 -2
- package/dist/helper/schema_helper/build_summary_schema.js.map +1 -1
- package/dist/logger.js +2 -2
- package/dist/logger.js.map +1 -1
- package/dist/services/get_prompts.d.ts.map +1 -1
- package/dist/services/get_prompts.js +2 -1
- package/dist/services/get_prompts.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +2 -0
- package/src/helper/get_id_from_title.ts +2 -1
- package/src/helper/mongo_helper.ts +27 -9
- package/src/helper/schema_helper/build_card_schema.ts +2 -2
- package/src/helper/schema_helper/build_classify_summarize_schema.ts +2 -2
- package/src/helper/schema_helper/build_concept_facts_schema.ts +2 -2
- package/src/helper/schema_helper/build_summary_schema.ts +2 -2
- package/src/index.ts +1 -1
- package/src/logger.ts +2 -2
- package/src/services/get_prompts.ts +2 -1
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,QAAA,MAAM,MAAM;eAC4B,MAAM;;;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,QAAA,MAAM,MAAM;eAC4B,MAAM;;;WAGf,MAAM;YACJ,MAAM;CACtC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -5,6 +5,8 @@ const config = {
|
|
|
5
5
|
openAIKey: process.env.OPEN_AI_KEY,
|
|
6
6
|
qdrantApiKey: process.env.QDRANT_API_KEY,
|
|
7
7
|
qdrantUrl: process.env.QDRANT_URL,
|
|
8
|
+
dbUri: process.env.DB_URI,
|
|
9
|
+
dbName: process.env.DB_NAME,
|
|
8
10
|
};
|
|
9
11
|
exports.default = config;
|
|
10
12
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;AAAA,yBAAuB;AAEvB,MAAM,MAAM,GAAG;IACb,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,WAAqB;IAC5C,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;IACxC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;AAAA,yBAAuB;AAEvB,MAAM,MAAM,GAAG;IACb,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,WAAqB;IAC5C,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;IACxC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;IACjC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,MAAgB;IACnC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAiB;CACtC,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_id_from_title.d.ts","sourceRoot":"","sources":["../../src/helper/get_id_from_title.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,GAAU,QAAQ,MAAM,EAAE;;;
|
|
1
|
+
{"version":3,"file":"get_id_from_title.d.ts","sourceRoot":"","sources":["../../src/helper/get_id_from_title.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,GAAU,QAAQ,MAAM,EAAE;;;IA8BrD,CAAC"}
|
|
@@ -13,7 +13,8 @@ exports.getIdsForTitles = void 0;
|
|
|
13
13
|
const mongo_helper_1 = require("./mongo_helper");
|
|
14
14
|
const getIdsForTitles = (titles) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
try {
|
|
16
|
-
const
|
|
16
|
+
const database = yield (0, mongo_helper_1.setUpMongoClient)();
|
|
17
|
+
const collection = database.collection("_source");
|
|
17
18
|
const rows = yield collection
|
|
18
19
|
.find({
|
|
19
20
|
$or: [{ title: { $in: titles } }, { slug: { $in: titles } }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_id_from_title.js","sourceRoot":"","sources":["../../src/helper/get_id_from_title.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"get_id_from_title.js","sourceRoot":"","sources":["../../src/helper/get_id_from_title.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAAkD;AAE3C,MAAM,eAAe,GAAG,CAAO,MAAgB,EAAE,EAAE;IACxD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAgB,GAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,MAAM,UAAU;aAC1B,I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|
+
declare function setUpMongoClient(): Promise<Db>;
|
|
3
|
+
export { setUpMongoClient, ObjectId };
|
|
5
4
|
//# sourceMappingURL=mongo_helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongo_helper.d.ts","sourceRoot":"","sources":["../../src/helper/mongo_helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mongo_helper.d.ts","sourceRoot":"","sources":["../../src/helper/mongo_helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAe,QAAQ,EAAE,MAAM,SAAS,CAAC;AAgBpD,iBAAe,gBAAgB,IAAI,OAAO,CAAC,EAAE,CAAC,CAI7C;AAQD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectId =
|
|
15
|
+
exports.ObjectId = void 0;
|
|
16
|
+
exports.setUpMongoClient = setUpMongoClient;
|
|
4
17
|
const mongodb_1 = require("mongodb");
|
|
5
|
-
Object.defineProperty(exports, "Collection", { enumerable: true, get: function () { return mongodb_1.Collection; } });
|
|
6
18
|
Object.defineProperty(exports, "ObjectId", { enumerable: true, get: function () { return mongodb_1.ObjectId; } });
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
const config_1 = __importDefault(require("../config"));
|
|
20
|
+
// One client per Lambda container (module scope)
|
|
21
|
+
const localClient = new mongodb_1.MongoClient(config_1.default.dbUri, {
|
|
22
|
+
maxPoolSize: 30, // tune (20–50 typical for Lambda)
|
|
23
|
+
minPoolSize: 0, // don't pin idle sockets
|
|
24
|
+
maxConnecting: 3, // avoid handshake dogpile
|
|
25
|
+
waitQueueTimeoutMS: 5000, // backpressure instead of pileups
|
|
26
|
+
maxIdleTimeMS: 90000, // drop idle to save ports
|
|
27
|
+
serverSelectionTimeoutMS: 5000,
|
|
28
|
+
connectTimeoutMS: 5000,
|
|
29
|
+
retryWrites: true,
|
|
30
|
+
});
|
|
31
|
+
let client;
|
|
32
|
+
function setUpMongoClient() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if (!client)
|
|
35
|
+
client = localClient;
|
|
36
|
+
return client.db(config_1.default.dbName);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
12
39
|
//# sourceMappingURL=mongo_helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongo_helper.js","sourceRoot":"","sources":["../../src/helper/mongo_helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mongo_helper.js","sourceRoot":"","sources":["../../src/helper/mongo_helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AA4BS,4CAAgB;AA5BzB,qCAAoD;AA4BzB,yFA5BD,kBAAQ,OA4BC;AA3BnC,uDAA+B;AAE/B,iDAAiD;AACjD,MAAM,WAAW,GAAG,IAAI,qBAAW,CAAC,gBAAM,CAAC,KAAK,EAAE;IAChD,WAAW,EAAE,EAAE,EAAE,kCAAkC;IACnD,WAAW,EAAE,CAAC,EAAE,yBAAyB;IACzC,aAAa,EAAE,CAAC,EAAE,0BAA0B;IAC5C,kBAAkB,EAAE,IAAI,EAAE,kCAAkC;IAC5D,aAAa,EAAE,KAAM,EAAE,0BAA0B;IACjD,wBAAwB,EAAE,IAAI;IAC9B,gBAAgB,EAAE,IAAI;IACtB,WAAW,EAAE,IAAI;CAClB,CAAC,CAAC;AAEH,IAAI,MAAmB,CAAC;AACxB,SAAe,gBAAgB;;QAC7B,IAAI,CAAC,MAAM;YAAE,MAAM,GAAG,WAAW,CAAC;QAElC,OAAO,MAAM,CAAC,EAAE,CAAC,gBAAM,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CAAA"}
|
|
@@ -17,9 +17,9 @@ const mongo_helper_1 = require("../mongo_helper");
|
|
|
17
17
|
// mcq:68ef4f095a123c94a835c6ad
|
|
18
18
|
// match:68ef4fae5a123c94a835c6ae
|
|
19
19
|
const buildCardSchema = (concepts, facts, card_generation_types) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
(0, mongo_helper_1.
|
|
20
|
+
const database = yield (0, mongo_helper_1.setUpMongoClient)();
|
|
21
21
|
const objectId = new mongo_helper_1.ObjectId("689c5cbd0d9d3bbda64b9584");
|
|
22
|
-
const schemaObj = yield
|
|
22
|
+
const schemaObj = yield database.collection("_prompts").findOne({
|
|
23
23
|
_id: objectId,
|
|
24
24
|
});
|
|
25
25
|
if (!schemaObj) {
|
|
@@ -42,7 +42,7 @@ const buildCardSchema = (concepts, facts, card_generation_types) => __awaiter(vo
|
|
|
42
42
|
// Only fetch schemas for the requested card types
|
|
43
43
|
for (const cardType of card_generation_types) {
|
|
44
44
|
if (cardTypeObjectIds[cardType]) {
|
|
45
|
-
const cardSchemaObj = yield
|
|
45
|
+
const cardSchemaObj = yield database.collection("_prompts").findOne({
|
|
46
46
|
_id: cardTypeObjectIds[cardType],
|
|
47
47
|
});
|
|
48
48
|
if (cardSchemaObj && cardSchemaObj.schema) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_card_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"build_card_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_card_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAwE;AACxE,kDAA6D;AAE7D,iCAAiC;AACjC,iCAAiC;AACjC,+BAA+B;AAC/B,iCAAiC;AAC1B,MAAM,eAAe,GAAG,CAC7B,QAAkB,EAClB,KAAe,EACf,qBAA+B,EAC/B,EAAE;IACF,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAgB,GAAE,CAAC;IAC1C,MAAM,QAAQ,GAAG,IAAI,uBAAQ,CAAC,0BAA0B,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QAC9D,GAAG,EAAE,QAAQ;KACd,CAAC,CAAC;IACH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAChC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IACD,MAAM,iBAAiB,GAAG,IAAA,2CAAwB,EAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,cAAc,GAAG,IAAA,2CAAwB,EAAC,KAAK,CAAC,CAAC;IAEvD,oEAAoE;IACpE,MAAM,iBAAiB,GAAgC;QACrD,KAAK,EAAE,IAAI,uBAAQ,CAAC,0BAA0B,CAAC;QAC/C,KAAK,EAAE,IAAI,uBAAQ,CAAC,0BAA0B,CAAC;QAC/C,GA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,CAAC,UAAU,CAAC,YAAY;YACxE;gBACE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC;aACtC,CAAC;IACN,CAAC;IAED,OAAO,CAAC,GAAG,CACT,kBAAkB,EAClB,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAC5E,CAAC;IACF,OAAO,eAAe,CAAC;AACzB,CAAC,CAAA,CAAC;AAlEW,QAAA,eAAe,mBAkE1B"}
|
|
@@ -15,9 +15,9 @@ const sanitize_strings_1 = require("../../utils/sanitize_strings");
|
|
|
15
15
|
// Function to populate enums in a parsed schema
|
|
16
16
|
const buildClassifySummarizeSchema = (headings) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
var _a, _b, _c, _d, _e, _f;
|
|
18
|
-
(0, mongo_helper_1.
|
|
18
|
+
const database = yield (0, mongo_helper_1.setUpMongoClient)();
|
|
19
19
|
const objectId = new mongo_helper_1.ObjectId("6895ab99aa1cad73b0018060");
|
|
20
|
-
const schemaObj = yield
|
|
20
|
+
const schemaObj = yield database.collection("_prompts").findOne({
|
|
21
21
|
_id: objectId,
|
|
22
22
|
});
|
|
23
23
|
if (!schemaObj) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_classify_summarize_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_classify_summarize_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"build_classify_summarize_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_classify_summarize_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA6D;AAC7D,mEAAwE;AAExE,gDAAgD;AACzC,MAAM,4BAA4B,GAAG,CAAO,QAAkB,EAAE,EAAE;;IACvE,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAgB,GAAE,CAAC;IAC1C,MAAM,QAAQ,GAAG,IAAI,uBAAQ,CAAC,0BAA0B,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QAC9D,GAAG,EAAE,QAAQ;KACd,CAAC,CAAC;IACH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAChC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IACD,4CAA4C;IAC5C,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3C,mEAAmE;IACnE,MAAM,gBAAgB,GAAG,IAAA,2CAAwB,EAAC,QAAQ,CAAC,CAAC;IAE5D,iEAAiE;IACjE,IACE,MAAA,MAAA,MAAA,MAAA,MAAA,MAAA,eAAe,CAAC,MAAM,0CAAE,UAAU,0CAAE,aAAa,0CAAE,KAAK,0CAAE,UAAU,0CAChE,SAAS,0CAAE,IAAI,EACnB,CAAC;QACD,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI;YAC7E,gBAAgB,CAAC;IACrB,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC,CAAA,CAAC;AA7BW,QAAA,4BAA4B,gCA6BvC;AAEF,wEAAwE;AACxE,4EAA4E;AAC5E,+CAA+C;AAC/C,uEAAuE;AACvE,qCAAqC;AAErC,mBAAmB;AACnB,KAAK"}
|
|
@@ -17,9 +17,9 @@ const sanitize_strings_1 = require("../../utils/sanitize_strings");
|
|
|
17
17
|
function buildConceptFactSchema(headings_1) {
|
|
18
18
|
return __awaiter(this, arguments, void 0, function* (headings, name = "concept_fact_gen_schema", strict = true) {
|
|
19
19
|
var _a, _b, _c, _d, _e, _f;
|
|
20
|
-
(0, mongo_helper_1.
|
|
20
|
+
const database = yield (0, mongo_helper_1.setUpMongoClient)();
|
|
21
21
|
const objectId = new mongodb_1.ObjectId("6895ac4baa1cad73b0018061");
|
|
22
|
-
const schemaObj = yield
|
|
22
|
+
const schemaObj = yield database.collection("_prompts").findOne({
|
|
23
23
|
_id: objectId,
|
|
24
24
|
});
|
|
25
25
|
if (!schemaObj) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_concept_facts_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_concept_facts_schema.ts"],"names":[],"mappings":";;;;;;;;;;;AAKA,wDAuCC;AA5CD,qCAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"build_concept_facts_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_concept_facts_schema.ts"],"names":[],"mappings":";;;;;;;;;;;AAKA,wDAuCC;AA5CD,qCAAmC;AACnC,kDAAmD;AACnD,mEAAwE;AAExE,gDAAgD;AAChD,SAAsB,sBAAsB;yDAC1C,QAAkB,EAClB,OAAe,yBAAyB,EACxC,SAAkB,IAAI;;QAEtB,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAgB,GAAE,CAAC;QAC1C,MAAM,QAAQ,GAAG,IAAI,kBAAQ,CAAC,0BAA0B,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;YAC9D,GAAG,EAAE,QAAQ;SACd,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,4CAA4C;QAC5C,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE3C,8BAA8B;QAC9B,eAAe,CAAC,IAAI,GAAG,IAAI,CAAC;QAC5B,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;QAEhC,MAAM,WAAW,GAAG,CAAC,GAAG,QAAQ,EAAE,EAAE,CAAC,CAAC;QAEtC,mEAAmE;QACnE,MAAM,gBAAgB,GAAG,IAAA,2CAAwB,EAAC,WAAW,CAAC,CAAC;QAE/D,gDAAgD;QAChD,IACE,MAAA,MAAA,MAAA,MAAA,MAAA,MAAA,eAAe,CAAC,MAAM,0CAAE,UAAU,0CAAE,cAAc,0CAAE,KAAK,0CAAE,UAAU,0CACjE,SAAS,0CAAE,IAAI,EACnB,CAAC;YACD,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI;gBAC9E,gBAAgB,CAAC;QACrB,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CAAA"}
|
|
@@ -16,9 +16,9 @@ const mongo_helper_1 = require("../mongo_helper");
|
|
|
16
16
|
function buildSummarySchema(headings_1) {
|
|
17
17
|
return __awaiter(this, arguments, void 0, function* (headings, name = "summary_cards", strict = true) {
|
|
18
18
|
var _a, _b, _c, _d, _e, _f;
|
|
19
|
-
(0, mongo_helper_1.
|
|
19
|
+
const database = yield (0, mongo_helper_1.setUpMongoClient)();
|
|
20
20
|
const objectId = new mongo_helper_1.ObjectId("690ae043116a8c929f3a4cd5");
|
|
21
|
-
const schemaObj = yield
|
|
21
|
+
const schemaObj = yield database.collection("_prompts").findOne({
|
|
22
22
|
_id: objectId,
|
|
23
23
|
});
|
|
24
24
|
if (!schemaObj) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_summary_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_summary_schema.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,gDAsCC;AA1CD,mEAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"build_summary_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_summary_schema.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,gDAsCC;AA1CD,mEAAwE;AACxE,kDAA6D;AAE7D,gDAAgD;AAChD,SAAsB,kBAAkB;yDACtC,QAAkB,EAClB,OAAe,eAAe,EAC9B,SAAkB,IAAI;;QAEtB,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAgB,GAAE,CAAC;QAC1C,MAAM,QAAQ,GAAG,IAAI,uBAAQ,CAAC,0BAA0B,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;YAC9D,GAAG,EAAE,QAAQ;SACd,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,4CAA4C;QAC5C,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE3C,8BAA8B;QAC9B,eAAe,CAAC,IAAI,GAAG,IAAI,CAAC;QAC5B,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;QAEhC,mEAAmE;QACnE,MAAM,gBAAgB,GAAG,IAAA,2CAAwB,EAAC,QAAQ,CAAC,CAAC;QAE5D,uEAAuE;QACvE,yDAAyD;QACzD,IACE,MAAA,MAAA,MAAA,MAAA,MAAA,MAAA,eAAe,CAAC,MAAM,0CAAE,UAAU,0CAAE,aAAa,0CAAE,KAAK,0CAAE,UAAU,0CAChE,SAAS,0CAAE,IAAI,EACnB,CAAC;YACD,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI;gBAC7E,gBAAgB,CAAC;QACrB,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CAAA"}
|
package/dist/logger.js
CHANGED
|
@@ -53,8 +53,8 @@ exports.ErrorLogger = ErrorLogger;
|
|
|
53
53
|
function log_error(error) {
|
|
54
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
55
|
try {
|
|
56
|
-
(0, mongo_helper_1.
|
|
57
|
-
const db =
|
|
56
|
+
const database = yield (0, mongo_helper_1.setUpMongoClient)();
|
|
57
|
+
const db = database.collection("_generation_log");
|
|
58
58
|
const result = yield db.insertOne(error);
|
|
59
59
|
return result;
|
|
60
60
|
}
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA,2FAA2F;AAC3F,oCAAoC;;;;;;;;;;;;;;;AAsDpC,8BASC;AA7DD,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA,2FAA2F;AAC3F,oCAAoC;;;;;;;;;;;;;;;AAsDpC,8BASC;AA7DD,kDAA0B;AAC1B,wDAAyD;AAgBzD,MAAa,YAAa,SAAQ,KAAK;IAErC,YAAY,OAAe,EAAE,QAAa;QACxC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wCAAwC;QACxD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,CAAC,oBAAoB;QAChD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,mBAAmB;QAC7C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,sBAAsB;IAC3E,CAAC;CACF;AARD,oCAQC;AAED,MAAa,WAAW;IAEtB,YAAY,IAAS;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEK,GAAG;;YACP,IAAI,CAAC;gBACH,IAAI,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAC7B,uFAAuF,EACvF;oBACE,IAAI,EAAE,IAAI,CAAC,IAAI;iBAChB,EACD;oBACE,OAAO,EAAE;wBACP,cAAc,EAAE,CAAC,kBAAkB,CAAC;qBACrC;iBACF,CACF,CAAC;gBACF,OAAO,QAAQ,CAAC;YAClB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;KAAA;CACF;AAxBD,kCAwBC;AACD,SAAsB,SAAS,CAAC,KAAe;;QAC7C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAgB,GAAE,CAAC;YAC1C,MAAM,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;YAClD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACzC,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_prompts.d.ts","sourceRoot":"","sources":["../../src/services/get_prompts.ts"],"names":[],"mappings":"AAuDA,eAAO,MAAM,UAAU,GACrB,YAAY,MAAM,EAClB,oBAAoB,MAAM,EAAE;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"get_prompts.d.ts","sourceRoot":"","sources":["../../src/services/get_prompts.ts"],"names":[],"mappings":"AAuDA,eAAO,MAAM,UAAU,GACrB,YAAY,MAAM,EAClB,oBAAoB,MAAM,EAAE;;;;;;;;;;;;EA0G7B,CAAC"}
|
|
@@ -120,7 +120,8 @@ const getPrompts = (sourceType, cardGenerationType) => __awaiter(void 0, void 0,
|
|
|
120
120
|
}
|
|
121
121
|
function getPromptString(promptIds) {
|
|
122
122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
|
|
123
|
+
const database = yield (0, mongo_helper_1.setUpMongoClient)();
|
|
124
|
+
let result = yield database
|
|
124
125
|
.collection("_prompts")
|
|
125
126
|
.aggregate([
|
|
126
127
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_prompts.js","sourceRoot":"","sources":["../../src/services/get_prompts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"get_prompts.js","sourceRoot":"","sources":["../../src/services/get_prompts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAoE;AACpE,MAAM,YAAY,GAAG;IACnB,IAAI,EAAE,0BAA0B;IAChC,KAAK,EAAE,0BAA0B;IACjC,KAAK,EAAE,0BAA0B;IACjC,MAAM,EAAE,0BAA0B;IAClC,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,0BAA0B;IACpC,KAAK,EAAE,0BAA0B;IACjC,QAAQ,EAAE,0BAA0B;IACpC,SAAS,EAAE,0BAA0B;CACtC,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,0BAA0B;IAChC,MAAM,EAAE,0BAA0B;IAClC,KAAK,EAAE,0BAA0B;IACjC,MAAM,EAAE,0BAA0B;IAClC,KAAK,EAAE,0BAA0B;IACjC,KAAK,EAAE,0BAA0B;IACjC,KAAK,EAAE,0BAA0B;IACjC,GAAG,EAAE,0BAA0B;IAC/B,QAAQ,EAAE,0BAA0B;CACrC,CAAC;AAEF,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,0BAA0B;IAChC,MAAM,EAAE,0BAA0B;IAClC,KAAK,EAAE,0BAA0B;IACjC,MAAM,EAAE,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EAAE,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE;6BACvC;yBACF;qBACF;iBACF;aACF,CAAC;iBACD,OAAO,EAAE,CAAC;YACb,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,CAAC;KAAA;AACH,CAAC,CAAA,CAAC;AA5GW,QAAA,UAAU,cA4GrB"}
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { setUpMongoClient } from "./mongo_helper";
|
|
2
2
|
|
|
3
3
|
export const getIdsForTitles = async (titles: string[]) => {
|
|
4
4
|
try {
|
|
5
|
+
const database = await setUpMongoClient();
|
|
5
6
|
const collection = database.collection("_source");
|
|
6
7
|
const rows = await collection
|
|
7
8
|
.find({
|
|
@@ -1,11 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
// dotenv.config();
|
|
1
|
+
import { Db, MongoClient, ObjectId } from "mongodb";
|
|
2
|
+
import config from "../config";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
// One client per Lambda container (module scope)
|
|
5
|
+
const localClient = new MongoClient(config.dbUri, {
|
|
6
|
+
maxPoolSize: 30, // tune (20–50 typical for Lambda)
|
|
7
|
+
minPoolSize: 0, // don't pin idle sockets
|
|
8
|
+
maxConnecting: 3, // avoid handshake dogpile
|
|
9
|
+
waitQueueTimeoutMS: 5000, // backpressure instead of pileups
|
|
10
|
+
maxIdleTimeMS: 90_000, // drop idle to save ports
|
|
11
|
+
serverSelectionTimeoutMS: 5000,
|
|
12
|
+
connectTimeoutMS: 5000,
|
|
13
|
+
retryWrites: true,
|
|
14
|
+
});
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
let client: MongoClient;
|
|
17
|
+
async function setUpMongoClient(): Promise<Db> {
|
|
18
|
+
if (!client) client = localClient;
|
|
19
|
+
|
|
20
|
+
return client.db(config.dbName);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// export function setUpMongoClient(dbUrl: string, dbName: string) {
|
|
24
|
+
// mongoClient = new MongoClient(dbUrl, {});
|
|
25
|
+
// db = mongoClient.db(dbName);
|
|
26
|
+
// // return { mongoClient, db };
|
|
27
|
+
// }
|
|
28
|
+
|
|
29
|
+
export { setUpMongoClient, ObjectId };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sanitizeStringsForSchema } from "../../utils/sanitize_strings";
|
|
2
|
-
import {
|
|
2
|
+
import { setUpMongoClient, ObjectId } from "../mongo_helper";
|
|
3
3
|
|
|
4
4
|
// flash:68ef4e1b5a123c94a835c6ab
|
|
5
5
|
// cloze:68ef4eb45a123c94a835c6ac
|
|
@@ -10,7 +10,7 @@ export const buildCardSchema = async (
|
|
|
10
10
|
facts: string[],
|
|
11
11
|
card_generation_types: string[]
|
|
12
12
|
) => {
|
|
13
|
-
|
|
13
|
+
const database = await setUpMongoClient();
|
|
14
14
|
const objectId = new ObjectId("689c5cbd0d9d3bbda64b9584");
|
|
15
15
|
const schemaObj = await database.collection("_prompts").findOne({
|
|
16
16
|
_id: objectId,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { setUpMongoClient, ObjectId } from "../mongo_helper";
|
|
2
2
|
import { sanitizeStringsForSchema } from "../../utils/sanitize_strings";
|
|
3
3
|
|
|
4
4
|
// Function to populate enums in a parsed schema
|
|
5
5
|
export const buildClassifySummarizeSchema = async (headings: string[]) => {
|
|
6
|
-
|
|
6
|
+
const database = await setUpMongoClient();
|
|
7
7
|
const objectId = new ObjectId("6895ab99aa1cad73b0018060");
|
|
8
8
|
const schemaObj = await database.collection("_prompts").findOne({
|
|
9
9
|
_id: objectId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectId } from "mongodb";
|
|
2
|
-
import {
|
|
2
|
+
import { setUpMongoClient } from "../mongo_helper";
|
|
3
3
|
import { sanitizeStringsForSchema } from "../../utils/sanitize_strings";
|
|
4
4
|
|
|
5
5
|
// Function to populate enums in a parsed schema
|
|
@@ -8,7 +8,7 @@ export async function buildConceptFactSchema(
|
|
|
8
8
|
name: string = "concept_fact_gen_schema",
|
|
9
9
|
strict: boolean = true
|
|
10
10
|
) {
|
|
11
|
-
|
|
11
|
+
const database = await setUpMongoClient();
|
|
12
12
|
const objectId = new ObjectId("6895ac4baa1cad73b0018061");
|
|
13
13
|
const schemaObj = await database.collection("_prompts").findOne({
|
|
14
14
|
_id: objectId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sanitizeStringsForSchema } from "../../utils/sanitize_strings";
|
|
2
|
-
import {
|
|
2
|
+
import { setUpMongoClient, ObjectId } from "../mongo_helper";
|
|
3
3
|
|
|
4
4
|
// Function to populate enums in a parsed schema
|
|
5
5
|
export async function buildSummarySchema(
|
|
@@ -7,7 +7,7 @@ export async function buildSummarySchema(
|
|
|
7
7
|
name: string = "summary_cards",
|
|
8
8
|
strict: boolean = true
|
|
9
9
|
) {
|
|
10
|
-
|
|
10
|
+
const database = await setUpMongoClient();
|
|
11
11
|
const objectId = new ObjectId("690ae043116a8c929f3a4cd5");
|
|
12
12
|
const schemaObj = await database.collection("_prompts").findOne({
|
|
13
13
|
_id: objectId,
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import express from "express";
|
|
2
2
|
import { OnlyEverGenerator } from "./bootstrap/app";
|
|
3
3
|
import { ObjectId } from "mongodb";
|
|
4
|
-
import {
|
|
4
|
+
import { setUpMongoClient } from "./helper/mongo_helper";
|
|
5
5
|
|
|
6
6
|
export { OnlyEverGenerator };
|
|
7
7
|
|
package/src/logger.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// this is only for developmemt use
|
|
3
3
|
|
|
4
4
|
import axios from "axios";
|
|
5
|
-
import {
|
|
5
|
+
import { setUpMongoClient } from "./helper/mongo_helper";
|
|
6
6
|
|
|
7
7
|
type log_type = {
|
|
8
8
|
flow: string;
|
|
@@ -55,7 +55,7 @@ export class ErrorLogger {
|
|
|
55
55
|
}
|
|
56
56
|
export async function log_error(error: log_type) {
|
|
57
57
|
try {
|
|
58
|
-
|
|
58
|
+
const database = await setUpMongoClient();
|
|
59
59
|
const db = database.collection("_generation_log");
|
|
60
60
|
const result = await db.insertOne(error);
|
|
61
61
|
return result;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { setUpMongoClient, ObjectId } from "../helper/mongo_helper";
|
|
2
2
|
const typologyDocs = {
|
|
3
3
|
role: "676528fc59c0563f42607add",
|
|
4
4
|
input: "6765298059c0563f42607ade",
|
|
@@ -130,6 +130,7 @@ export const getPrompts = async (
|
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
async function getPromptString(promptIds: ObjectId[]) {
|
|
133
|
+
const database = await setUpMongoClient();
|
|
133
134
|
let result = await database
|
|
134
135
|
.collection("_prompts")
|
|
135
136
|
.aggregate([
|