Skip to content

Commit 3e7f01f

Browse files
Removed unnecessary codes.
1 parent f984ada commit 3e7f01f

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

MAUI/DataForm/AI-Powered-Smart-DataForm.md

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,35 +31,7 @@ To connect your .NET MAUI app to Azure OpenAI, create a service class that handl
3131
/// </summary>
3232
internal class DataFormAIService : AzureBaseService
3333
{
34-
/// <summary>
35-
/// Retrieves an answer from the deployment name model using the provided user prompt.
36-
/// </summary>
37-
/// <param name="userPrompt">The user prompt.</param>
38-
/// <returns>The AI response.</returns>
39-
internal async Task<string> GetAnswerFromGPT(string userPrompt)
40-
{
41-
ChatHistory = string.Empty;
42-
if (IsCredentialValid && Client != null && ChatHistory != null)
43-
{
44-
// Add the user's prompt as a user message to the conversation.
45-
ChatHistory = ChatHistory + "You are a predictive analytics assistant.";
46-
// Add the user's prompt as a user message to the conversation.
47-
ChatHistory = ChatHistory + userPrompt;
48-
try
49-
{
50-
//// Send the chat completion request to the OpenAI API and await the response.
51-
var response = await Client.CompleteAsync(ChatHistory);
52-
return response.ToString();
53-
}
54-
catch
55-
{
56-
// If an exception occurs (e.g., network issues, API errors), return an empty string.
57-
return "";
58-
}
59-
}
60-
61-
return "";
62-
}
34+
6335
}
6436
```
6537
In this service, define a method called `GetAnswerFromGPT`. This method takes a user prompt from the SfAIAssistView control as input, sends it to the deployed model (e.g., GPT35Turbo), and returns the AI-generated response.

0 commit comments

Comments
 (0)