callApi method
Implementation
Future<void> callApi() async {
var api = ApiLayer(env: ApisModel().dataRequest);
var response = await api.callApi(endpointData: ApisModel().callIA);
final result = aiResponseFromMap(response.response);
setState(() {
canTyping = true;
_messages.insert(0,
ChatMessageWidget(
bgColor: secondaryColor,
message: "[${widget.model.aiName}]: ${result.choices?.first.text?.replaceAll(" \n\n", "")}",
isAI: true,
)
);
updateModel();
});
}