scheunemann-interfaces
Version:
Interfaces de Projetos Scheunemann
38 lines (37 loc) • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatGptResponseEntity = void 0;
var model_enum_1 = require("../enums/model.enum");
var chat_gpt_choice_entity_1 = require("./chat-gpt-choice.entity");
var chat_gpt_usage_entity_1 = require("./chat-gpt-usage.entity");
var ChatGptResponseEntity = /** @class */ (function () {
// #endregion Properties (6)
// #region Constructors (1)
function ChatGptResponseEntity(data) {
var _a;
// #region Properties (6)
this.id = '';
this.object = '';
this.created = 0;
this.model = model_enum_1.EChatGptModel.GPT_4;
this.choices = [];
this.usage = new chat_gpt_usage_entity_1.ChatGptUsageEntity();
if (data) {
for (var key in data) {
if (data.hasOwnProperty(key) && key in this) {
if (key === 'choices') {
this.choices = ((_a = data.choices) === null || _a === void 0 ? void 0 : _a.map(function (choice) { return new chat_gpt_choice_entity_1.ChatGptChoiceEntity(choice); })) || [];
}
else if (key === 'usage') {
this.usage = new chat_gpt_usage_entity_1.ChatGptUsageEntity(data.usage);
}
else {
this[key] = data[key];
}
}
}
}
}
return ChatGptResponseEntity;
}());
exports.ChatGptResponseEntity = ChatGptResponseEntity;