-
Notifications
You must be signed in to change notification settings - Fork 111
Description
This widget is giving an error at this widget:
void _sendMessage() async {
if (_controller.text.isEmpty) return;
ChatMessage message = ChatMessage(
text: _controller.text,
sender: "user",
isImage: false,
);
setState(() {
_messages.insert(0, message);
_isTyping = true;
});
_controller.clear();
if (_isImageSearch) {
final request = GenerateImage(message.text, 1, size: "256x256");
final response = await chatGPT!.generateImage(request);
Vx.log(response!.data!.last!.url!);
insertNewData(response.data!.last!.url!, isImage: true);
} else {
final request =
CompleteText(prompt: message.text, model: kTranslateModelV3);
final response = await chatGPT!.onCompleteText(request: request);
Vx.log(response!.choices[0].text);
insertNewData(response.choices[0].text, isImage: false);
}
}
This is the error:
[{
"resource": "",
"owner": "generated_diagnostic_collection_name#1",
"code": {
"value": "undefined_method",
"target": {
"$mid": 1,
"path": "/diagnostics/undefined_method",
"scheme": "https",
"authority": "dart.dev"
}
},
"severity": 8,
"message": "The method 'onCompleteText' isn't defined for the type 'OpenAI'.\nTry correcting the name to the name of an existing method, or defining a method named 'onCompleteText'.",
"source": "dart",
"startLineNumber": 68,
"startColumn": 39,
"endLineNumber": 68,
"endColumn": 53
}]
I've been trying to troubleshoot this for a couple of hours. I've tried adding different dependencies, but nothing is working. Would appreciate help. It's literally just the onCompleteText that is giving me an error. I would have thought using the most up-to-date dependency would help but nothing is working.