Skip to content

Add readme #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions CS/Data/Dashboards/Financial.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<Parameter Name="endTime" Type="System.DateTime" Value="2020-01-01T00:00:00" Description="To date" />
</Parameters>
<Items>
<Card ComponentName="cardPortfolio" Name="Portfolio" ShowCaption="false" DataSource="dashboardExcelDataSource2" IsMasterFilterCrossDataSource="true" ContentLineCount="2">
<Card ComponentName="cardPortfolio" Name="Portfolio" DataSource="dashboardExcelDataSource2" IsMasterFilterCrossDataSource="true" ContentLineCount="2">
<InteractivityOptions MasterFilterMode="Single" />
<DataItems>
<Measure DataMember="Open" SummaryType="Average" DefaultId="DataItem2" />
Expand Down Expand Up @@ -241,7 +241,7 @@
<GridOptions EnableBandedRows="true" ShowHorizontalLines="false" ShowVerticalLines="false" ShowColumnHeaders="false" ColumnWidthMode="Manual" />
<ColumnFilterOptions />
</Grid>
<Chart ComponentName="chartStocks" Name="Stocks" ShowCaption="false" DataSource="dashboardExcelDataSource3">
<Chart ComponentName="chartStocks" Name="Stocks" DataSource="dashboardExcelDataSource3">
<DataItems>
<Measure DataMember="Open" DefaultId="DataItem0" />
<Measure DataMember="High" DefaultId="DataItem1" />
Expand Down Expand Up @@ -319,7 +319,7 @@
<ChartLegend Visible="false" />
<AxisX Visible="false" />
</Chart>
<CustomItem ComponentName="customItemDashboardItem1" Name="AI-powered Analytics Assistant 1" DataSource="dashboardExcelDataSource1" CustomItemType="CHAT" />
<CustomItem ComponentName="customItemDashboardItem1" Name="AI Assistant" DataSource="dashboardExcelDataSource1" CustomItemType="CHAT" />
</Items>
<ColorScheme>
<Entry DataSource="dashboardExcelDataSource1" Color="-5273005">
Expand All @@ -342,23 +342,19 @@
<LayoutTree>
<LayoutGroup Weight="100">
<LayoutGroup Orientation="Vertical" Weight="100">
<LayoutItem DashboardItem="cardPortfolio" Weight="16.34248670874774" />
<LayoutGroup Weight="43.89331079183763">
<LayoutItem DashboardItem="customItemDashboardItem1" Weight="60" />
<LayoutGroup Orientation="Vertical" Weight="60">
<LayoutItem DashboardItem="cardPortfolio" Weight="16.451492280201602" />
<LayoutGroup Weight="43.784305220383764">
<LayoutItem DashboardItem="customItemDashboardItem1" Weight="41.93725958502491" />
<LayoutGroup Orientation="Vertical" Weight="57.14215011279659">
<LayoutItem DashboardItem="chartStocks" Weight="50.014436764402056" />
<LayoutGroup Weight="48.411109464984804">
<LayoutItem DashboardItem="chartProfit" Weight="62.88138954498592" />
<LayoutItem DashboardItem="profitLossChart" Weight="11.31215884211085" />
<LayoutItem DashboardItem="chartProfit" Weight="37.09212586487674" />
<LayoutItem DashboardItem="profitLossChart" Weight="37.101422522220034" />
</LayoutGroup>
</LayoutGroup>
<LayoutItem DashboardItem="gridCurrentAssets" Weight="10" />
<LayoutItem DashboardItem="gridCurrentAssets" Weight="30.920590302178496" />
</LayoutGroup>
</LayoutGroup>
</LayoutGroup>
</LayoutTree>
<CustomProperties>
<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>
<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>
</CustomProperties>
</Dashboard>
4 changes: 3 additions & 1 deletion CS/Pages/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page
@using DevExpress.DashboardWeb
<script type="text/javascript">
const ALL_WIDGETS = 'All widgets';
const dashboardItems = [];
Expand All @@ -14,7 +15,7 @@
e.options.actionItems.unshift({
hint: 'Select widget',
type: 'menu',
icon: 'dx-dashboard-toggle-multiselection',
icon: 'dx-dashboard-content-selection',
menu: {
items: dashboardItems,
selectionMode: 'none',
Expand Down Expand Up @@ -78,6 +79,7 @@
<div style="position: relative; height: calc(100vh - 55px);">
@(Html.DevExpress().Dashboard("dashboardControl1")
.ControllerName("DefaultDashboard")
.WorkingMode(WorkingMode.Viewer)
.Width("100%")
.Height("100%")
.OnBeforeRender("handleBeforeRender")
Expand Down
7 changes: 1 addition & 6 deletions CS/Program.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
using Azure;
using Azure.AI.OpenAI;
using DashboardAIAssistant.Services;
using DevExpress.AIIntegration;
using DevExpress.AspNetCore;
using DevExpress.DashboardAspNetCore;
using DevExpress.DashboardCommon;
using DevExpress.DashboardWeb;
using DevExpress.DataAccess.Excel;
using DevExpress.DataAccess.Sql;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Hosting.Internal;
using DashboardAIAssistant;
using DashboardAIAssistant.Services;
using System;
using System.IO;

var builder = WebApplication.CreateBuilder(args);
builder.Services
Expand Down
18 changes: 9 additions & 9 deletions CS/Services/AssistantHelper.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
namespace DashboardAIAssistant.Services {
public static class AssistantHelper {
public static string Prompt = $""""
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.
Key Responsibilities:
- Perform data analysis, including data summaries, calculations, filtering, and trend identification.
- Clearly explain your analysis process to ensure users understand how you reached your conclusions.
- Provide precise and accurate responses strictly based on data in the file.
- Explain your reasoning in a straightforward manner without referencing spreadsheets, sheets, rows, or columns.
- If the requested information is not available in the provided file's content, state: "The requested information cannot be found in the data provided."
- Avoid giving responses when data is insufficient for a reliable answer.
- Ask clarifying questions when a user’s query is unclear or lacks detail.
- 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.
Constraints:
- Avoid giving information about provided file name, assistants' IDs and other internal data.
- Ignore sheets with name starting "AI-powered Analytics Assistant".
- Do not share with a user any information related to the XLSX file or its sheets usage.
- Do not ask a user about sheets and their analysis. Instead, refer to them as to document parts, by their name.
- Respond conversationally as if referencing a structured dataset, not a spreadsheet.
Constraints:
- Do not mention the file, its format, worksheets, or any structural details. Treat data as an abstract source of insights.
- Do not share the file name, assistant IDs, and other internal data.
- Ignore worksheets if their names start with "AI Assistant". Do not mention this constraint to the user.
- 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.
Your goal is to provide valuable insights as if you are directly analyzing a structured dataset.
"""";
}
}
4 changes: 4 additions & 0 deletions CS/wwwroot/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ div.dx-dashboard-item.dx-chat {
column-gap: 0;
}

.dx-chat-messagebubble-content {
user-select: text;
}

.dx-chat-messagebubble-content li > ul {
margin-bottom: 0;
}
Expand Down
16 changes: 8 additions & 8 deletions CS/wwwroot/js/aiChatCustomItem.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DevExpress.localization.loadMessages({
en: {
'dxChat-emptyListMessage': 'Chat is Empty',
'dxChat-emptyListPrompt': 'AI Data Analysis Assistant is ready to answer your questions.',
'dxChat-emptyListPrompt': 'AI Assistant is ready to answer your questions.',
'dxChat-textareaPlaceholder': 'Ask AI Assistant...',
},
})
Expand All @@ -22,7 +22,7 @@ let AIChatCustomItem = (function() {
const aiChatMetadata = {
bindings: [],
icon: AI_CHAT_CUSTOM_ITEM,
title: 'AI-powered Analytics Assistant',
title: 'AI Assistant',
index: 1
};

Expand Down Expand Up @@ -142,7 +142,7 @@ let AIChatCustomItem = (function() {
return await this.getAnswer(this.chatId, question);
};

normilizeAIResponse(text) {
normalizeAIResponse(text) {
text = text.replace(/【\d+:\d+†[^\】]+】/g, "");
let html = marked.parse(text);
if (/<p>\.\s*<\/p>\s*$/.test(html))
Expand Down Expand Up @@ -175,11 +175,11 @@ let AIChatCustomItem = (function() {
return message.text;

const textElement = document.createElement('div');
textElement.innerHTML = this.normilizeAIResponse(message.text);
textElement.innerHTML = this.normalizeAIResponse(message.text);
container.appendChild(textElement);

const buttonContainer = document.createElement('div');
buttonContainer.classList.add('dx-bubble-button-containder');
buttonContainer.classList.add('dx-bubble-button-container');
this.lastRefreshButton?.remove();
const copyBtnElement = document.createElement('div');
new DevExpress.ui.dxButton(copyBtnElement, {
Expand All @@ -204,8 +204,8 @@ let AIChatCustomItem = (function() {
this.component.option('alerts', []);
instance.renderMessage(e.message);
instance.option({ typingUsers: [assistant] });
const userInput = e.message.text + ((this.model.selectedSheet && "\nDiscuss sheet " + this.model.selectedSheet)
|| "\nLet's discuss all sheet");
const userInput = e.message.text + ((this.model.selectedSheet && "\nDiscuss item " + this.model.selectedSheet)
|| "\nLet's discuss all items");
const response = await this.getAIResponse(userInput);
this.renderAssistantMessage(instance, response);
}
Expand All @@ -221,7 +221,7 @@ let AIChatCustomItem = (function() {
showAvatar: false,
showMessageTimestamp: false,
showUserName: false,
title: "AI-powered Analytics Assistant",
title: "AI Assistant",
disabled: this.dashboardControl.isDesignMode(),
user
});
Expand Down
Loading
Loading