@trainly/react 1.6.1 → 1.6.2
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.
|
@@ -142,11 +142,12 @@ var TrainlyClient = /** @class */ (function () {
|
|
|
142
142
|
};
|
|
143
143
|
TrainlyClient.prototype.ask = function (question_1) {
|
|
144
144
|
return __awaiter(this, arguments, void 0, function (question, options) {
|
|
145
|
-
var params, response_1, error, data_1, url, headers, body, response, error, data;
|
|
145
|
+
var includeCitations, params, response_1, error, data_1, url, headers, body, response, error, data;
|
|
146
146
|
if (options === void 0) { options = {}; }
|
|
147
147
|
return __generator(this, function (_a) {
|
|
148
148
|
switch (_a.label) {
|
|
149
149
|
case 0:
|
|
150
|
+
includeCitations = options.includeCitations !== false;
|
|
150
151
|
if (!this.scopedToken) {
|
|
151
152
|
throw new Error("Not connected. Call connect() or connectWithOAuthToken() first.");
|
|
152
153
|
}
|
|
@@ -181,7 +182,7 @@ var TrainlyClient = /** @class */ (function () {
|
|
|
181
182
|
data_1 = _a.sent();
|
|
182
183
|
return [2 /*return*/, {
|
|
183
184
|
answer: data_1.answer,
|
|
184
|
-
citations: data_1.citations || [],
|
|
185
|
+
citations: includeCitations ? data_1.citations || [] : [],
|
|
185
186
|
}];
|
|
186
187
|
case 5:
|
|
187
188
|
url = this.config.apiKey
|
|
@@ -218,7 +219,7 @@ var TrainlyClient = /** @class */ (function () {
|
|
|
218
219
|
data = _a.sent();
|
|
219
220
|
return [2 /*return*/, {
|
|
220
221
|
answer: data.answer,
|
|
221
|
-
citations: data.citations || [],
|
|
222
|
+
citations: includeCitations ? data.citations || [] : [],
|
|
222
223
|
}];
|
|
223
224
|
}
|
|
224
225
|
});
|