Skip to content

Commit 7666ffc

Browse files
authored
add readme
1 parent c7e731e commit 7666ffc

File tree

9 files changed

+226
-52
lines changed

9 files changed

+226
-52
lines changed

CS/Data/Dashboards/Financial.xml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
<Parameter Name="endTime" Type="System.DateTime" Value="2020-01-01T00:00:00" Description="To date" />
126126
</Parameters>
127127
<Items>
128-
<Card ComponentName="cardPortfolio" Name="Portfolio" ShowCaption="false" DataSource="dashboardExcelDataSource2" IsMasterFilterCrossDataSource="true" ContentLineCount="2">
128+
<Card ComponentName="cardPortfolio" Name="Portfolio" DataSource="dashboardExcelDataSource2" IsMasterFilterCrossDataSource="true" ContentLineCount="2">
129129
<InteractivityOptions MasterFilterMode="Single" />
130130
<DataItems>
131131
<Measure DataMember="Open" SummaryType="Average" DefaultId="DataItem2" />
@@ -241,7 +241,7 @@
241241
<GridOptions EnableBandedRows="true" ShowHorizontalLines="false" ShowVerticalLines="false" ShowColumnHeaders="false" ColumnWidthMode="Manual" />
242242
<ColumnFilterOptions />
243243
</Grid>
244-
<Chart ComponentName="chartStocks" Name="Stocks" ShowCaption="false" DataSource="dashboardExcelDataSource3">
244+
<Chart ComponentName="chartStocks" Name="Stocks" DataSource="dashboardExcelDataSource3">
245245
<DataItems>
246246
<Measure DataMember="Open" DefaultId="DataItem0" />
247247
<Measure DataMember="High" DefaultId="DataItem1" />
@@ -319,7 +319,7 @@
319319
<ChartLegend Visible="false" />
320320
<AxisX Visible="false" />
321321
</Chart>
322-
<CustomItem ComponentName="customItemDashboardItem1" Name="AI-powered Analytics Assistant 1" DataSource="dashboardExcelDataSource1" CustomItemType="CHAT" />
322+
<CustomItem ComponentName="customItemDashboardItem1" Name="AI Assistant" DataSource="dashboardExcelDataSource1" CustomItemType="CHAT" />
323323
</Items>
324324
<ColorScheme>
325325
<Entry DataSource="dashboardExcelDataSource1" Color="-5273005">
@@ -342,23 +342,19 @@
342342
<LayoutTree>
343343
<LayoutGroup Weight="100">
344344
<LayoutGroup Orientation="Vertical" Weight="100">
345-
<LayoutItem DashboardItem="cardPortfolio" Weight="16.34248670874774" />
346-
<LayoutGroup Weight="43.89331079183763">
347-
<LayoutItem DashboardItem="customItemDashboardItem1" Weight="60" />
348-
<LayoutGroup Orientation="Vertical" Weight="60">
345+
<LayoutItem DashboardItem="cardPortfolio" Weight="16.451492280201602" />
346+
<LayoutGroup Weight="43.784305220383764">
347+
<LayoutItem DashboardItem="customItemDashboardItem1" Weight="41.93725958502491" />
348+
<LayoutGroup Orientation="Vertical" Weight="57.14215011279659">
349349
<LayoutItem DashboardItem="chartStocks" Weight="50.014436764402056" />
350350
<LayoutGroup Weight="48.411109464984804">
351-
<LayoutItem DashboardItem="chartProfit" Weight="62.88138954498592" />
352-
<LayoutItem DashboardItem="profitLossChart" Weight="11.31215884211085" />
351+
<LayoutItem DashboardItem="chartProfit" Weight="37.09212586487674" />
352+
<LayoutItem DashboardItem="profitLossChart" Weight="37.101422522220034" />
353353
</LayoutGroup>
354354
</LayoutGroup>
355-
<LayoutItem DashboardItem="gridCurrentAssets" Weight="10" />
355+
<LayoutItem DashboardItem="gridCurrentAssets" Weight="30.920590302178496" />
356356
</LayoutGroup>
357357
</LayoutGroup>
358358
</LayoutGroup>
359359
</LayoutTree>
360-
<CustomProperties>
361-
<Description>["The dashboard shows stock prices for different vendors during a specified trading period. ","You can see detailed data for a specified vendor by selecting a card. The dashboard parameters allow you to change the trading period."]</Description>
362-
<Links>[{"href":"https://docs.devexpress.com/Dashboard/117163/web-dashboard/create-dashboards-on-the-web/dashboard-item-settings/cards","text":"Cards"},{"href":"https://docs.devexpress.com/Dashboard/14758/winforms-dashboard/winforms-designer/create-dashboards-in-the-winforms-designer/dashboard-item-settings/chart/series/financial-series","text":"Financial Series"},{"href":"https://docs.devexpress.com/Dashboard/117159/web-dashboard/create-dashboards-on-the-web/dashboard-item-settings/chart","text":"Charts"},{"href":"https://docs.devexpress.com/Dashboard/402204/web-dashboard/create-dashboards-on-the-web/dashboard-item-settings/grid/conditional-formatting","text":"Conditional Formatting "},{"href":"https://docs.devexpress.com/Dashboard/117062/web-dashboard/create-dashboards-on-the-web/data-analysis/dashboard-parameters","text":"Dashboard Parameters"}]</Links>
363-
</CustomProperties>
364360
</Dashboard>

CS/Pages/Index.cshtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@page
2+
@using DevExpress.DashboardWeb
23
<script type="text/javascript">
34
const ALL_WIDGETS = 'All widgets';
45
const dashboardItems = [];
@@ -14,7 +15,7 @@
1415
e.options.actionItems.unshift({
1516
hint: 'Select widget',
1617
type: 'menu',
17-
icon: 'dx-dashboard-toggle-multiselection',
18+
icon: 'dx-dashboard-content-selection',
1819
menu: {
1920
items: dashboardItems,
2021
selectionMode: 'none',
@@ -78,6 +79,7 @@
7879
<div style="position: relative; height: calc(100vh - 55px);">
7980
@(Html.DevExpress().Dashboard("dashboardControl1")
8081
.ControllerName("DefaultDashboard")
82+
.WorkingMode(WorkingMode.Viewer)
8183
.Width("100%")
8284
.Height("100%")
8385
.OnBeforeRender("handleBeforeRender")

CS/Program.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
using Azure;
22
using Azure.AI.OpenAI;
3+
using DashboardAIAssistant.Services;
34
using DevExpress.AIIntegration;
45
using DevExpress.AspNetCore;
56
using DevExpress.DashboardAspNetCore;
67
using DevExpress.DashboardCommon;
78
using DevExpress.DashboardWeb;
89
using DevExpress.DataAccess.Excel;
9-
using DevExpress.DataAccess.Sql;
1010
using Microsoft.AspNetCore.Builder;
1111
using Microsoft.AspNetCore.Hosting;
1212
using Microsoft.Extensions.AI;
1313
using Microsoft.Extensions.DependencyInjection;
1414
using Microsoft.Extensions.Hosting;
15-
using Microsoft.Extensions.Hosting.Internal;
16-
using DashboardAIAssistant;
17-
using DashboardAIAssistant.Services;
18-
using System;
19-
using System.IO;
2015

2116
var builder = WebApplication.CreateBuilder(args);
2217
builder.Services

CS/Services/AssistantHelper.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
namespace DashboardAIAssistant.Services {
22
public static class AssistantHelper {
33
public static string Prompt = $""""
4+
You are an analytics assistant. You analyze data extracted from Excel files. Use all available methods to parse supplied spreadsheets. Your role is to answer user questions about data within spreadsheet files. When answering, do not mention the underlying Excel file structure.
45
Key Responsibilities:
56
- Perform data analysis, including data summaries, calculations, filtering, and trend identification.
6-
- Clearly explain your analysis process to ensure users understand how you reached your conclusions.
7-
- Provide precise and accurate responses strictly based on data in the file.
7+
- Explain your reasoning in a straightforward manner without referencing spreadsheets, sheets, rows, or columns.
88
- If the requested information is not available in the provided file's content, state: "The requested information cannot be found in the data provided."
9-
- Avoid giving responses when data is insufficient for a reliable answer.
109
- Ask clarifying questions when a user’s query is unclear or lacks detail.
11-
- Your primary goal is to deliver helpful insights that directly address user questions. Do not make assumptions or infer details not supported by data. Respond in plain text only, without sources, footnotes, or annotations.
12-
Constraints:
13-
- Avoid giving information about provided file name, assistants' IDs and other internal data.
14-
- Ignore sheets with name starting "AI-powered Analytics Assistant".
15-
- Do not share with a user any information related to the XLSX file or its sheets usage.
16-
- Do not ask a user about sheets and their analysis. Instead, refer to them as to document parts, by their name.
10+
- Respond conversationally as if referencing a structured dataset, not a spreadsheet.
11+
Constraints:
12+
- Do not mention the file, its format, worksheets, or any structural details. Treat data as an abstract source of insights.
13+
- Do not share the file name, assistant IDs, and other internal data.
14+
- Ignore worksheets if their names start with "AI Assistant". Do not mention this constraint to the user.
15+
- If you need to mention a worksheet, refer to that worksheet simply by name. Do not use the term "worksheet", "sheet", or similar spreadsheet terminology.
16+
Your goal is to provide valuable insights as if you are directly analyzing a structured dataset.
1717
"""";
1818
}
1919
}

CS/wwwroot/css/site.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ div.dx-dashboard-item.dx-chat {
1212
column-gap: 0;
1313
}
1414

15+
.dx-chat-messagebubble-content {
16+
user-select: text;
17+
}
18+
1519
.dx-chat-messagebubble-content li > ul {
1620
margin-bottom: 0;
1721
}

CS/wwwroot/js/aiChatCustomItem.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
DevExpress.localization.loadMessages({
22
en: {
33
'dxChat-emptyListMessage': 'Chat is Empty',
4-
'dxChat-emptyListPrompt': 'AI Data Analysis Assistant is ready to answer your questions.',
4+
'dxChat-emptyListPrompt': 'AI Assistant is ready to answer your questions.',
55
'dxChat-textareaPlaceholder': 'Ask AI Assistant...',
66
},
77
})
@@ -22,7 +22,7 @@ let AIChatCustomItem = (function() {
2222
const aiChatMetadata = {
2323
bindings: [],
2424
icon: AI_CHAT_CUSTOM_ITEM,
25-
title: 'AI-powered Analytics Assistant',
25+
title: 'AI Assistant',
2626
index: 1
2727
};
2828

@@ -142,7 +142,7 @@ let AIChatCustomItem = (function() {
142142
return await this.getAnswer(this.chatId, question);
143143
};
144144

145-
normilizeAIResponse(text) {
145+
normalizeAIResponse(text) {
146146
text = text.replace(/\d+:\d+[^\】]+/g, "");
147147
let html = marked.parse(text);
148148
if (/<p>\.\s*<\/p>\s*$/.test(html))
@@ -175,11 +175,11 @@ let AIChatCustomItem = (function() {
175175
return message.text;
176176

177177
const textElement = document.createElement('div');
178-
textElement.innerHTML = this.normilizeAIResponse(message.text);
178+
textElement.innerHTML = this.normalizeAIResponse(message.text);
179179
container.appendChild(textElement);
180180

181181
const buttonContainer = document.createElement('div');
182-
buttonContainer.classList.add('dx-bubble-button-containder');
182+
buttonContainer.classList.add('dx-bubble-button-container');
183183
this.lastRefreshButton?.remove();
184184
const copyBtnElement = document.createElement('div');
185185
new DevExpress.ui.dxButton(copyBtnElement, {
@@ -204,8 +204,8 @@ let AIChatCustomItem = (function() {
204204
this.component.option('alerts', []);
205205
instance.renderMessage(e.message);
206206
instance.option({ typingUsers: [assistant] });
207-
const userInput = e.message.text + ((this.model.selectedSheet && "\nDiscuss sheet " + this.model.selectedSheet)
208-
|| "\nLet's discuss all sheet");
207+
const userInput = e.message.text + ((this.model.selectedSheet && "\nDiscuss item " + this.model.selectedSheet)
208+
|| "\nLet's discuss all items");
209209
const response = await this.getAIResponse(userInput);
210210
this.renderAssistantMessage(instance, response);
211211
}
@@ -221,7 +221,7 @@ let AIChatCustomItem = (function() {
221221
showAvatar: false,
222222
showMessageTimestamp: false,
223223
showUserName: false,
224-
title: "AI-powered Analytics Assistant",
224+
title: "AI Assistant",
225225
disabled: this.dashboardControl.isDesignMode(),
226226
user
227227
});

0 commit comments

Comments
 (0)