Skip to content

Commit f32773c

Browse files
committed
ai prompt updated
1 parent 21809e8 commit f32773c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

AISalesDashboard/AISalesDashboard/Service/PredictionService.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ public async Task<List<SalesPrediction>> GetSalesPredictionsAsync(
3333

3434
internal async Task<string> GetRandomExplanationAsync(List<SalesPrediction> predictions)
3535
{
36-
string prompt = $"Based on the {predictions.Count} sales data points, provide an insightful explanation.";
36+
var fullData = predictions
37+
.Select(p =>
38+
$"Date: {p.Date:yyyy-MM-dd}, Revenue: {p.PredictedRevenue}, Confidence: {p.Confidence}, Anomaly: {p.IsAnomaly}, AnomalyExplanation: {p.AnomalyExplanation ?? "N/A"}")
39+
.ToList();
40+
41+
string dataText = string.Join("\n", fullData);
42+
43+
string prompt = $@"You are analyzing {predictions.Count} sales predictions. Here is the full data: {dataText}
44+
Based on this data, provide an insightful explanation.";
3745

3846
string insights = await _baseAIService.GetAnswerFromGPT(prompt);
3947

0 commit comments

Comments
 (0)