Skip to content

Commit 3f1418e

Browse files
authored
Merge pull request #2 from DevExpress-Examples/pollyndos-update-1
add readme and update example
2 parents 46da24c + 80ecda1 commit 3f1418e

File tree

14 files changed

+478
-50
lines changed

14 files changed

+478
-50
lines changed

CS/DevExpress.AI.Samples.Blazor/Components/Pages/Grid.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
@page "/grid"
2-
@page "/"
32
@using DevExpress.AI.Samples.Blazor.Data;
43
@using DevExpress.AI.Samples.Blazor.Services
54
@using DevExpress.AIIntegration.Blazor.Chat
65
@using DevExpress.AIIntegration.OpenAI.Services
6+
@using Markdig
77

88
@inject IssuesDataService IssuesDataService
99

@@ -83,7 +83,7 @@
8383
IGrid grid;
8484
IAIChat chat;
8585
MarkupString ToHtml(string text) {
86-
return (MarkupString)Markdig.Markdown.ToHtml(text);
86+
return (MarkupString)Markdown.ToHtml(text);
8787
}
8888
IEnumerable<Issue> DataSource { get; set; }
8989
IEnumerable<Project> ProjectList { get; set; }
@@ -121,17 +121,17 @@
121121
return new MarkupString(html);
122122
}
123123
public MarkupString GetIssuePriorityIconHtml(IssuePriority priority) {
124-
string priorytyClass = "warning";
124+
string priorityClass = "warning";
125125
string title = "Medium";
126126
if(priority == IssuePriority.High) {
127-
priorytyClass = "danger";
127+
priorityClass = "danger";
128128
title = " High ";
129129
}
130130
if(priority == IssuePriority.Low) {
131-
priorytyClass = "info";
131+
priorityClass = "info";
132132
title = " Low ";
133133
}
134-
string html = string.Format("<span class='badge priority-{0} py-1 px-2' title='{1} Priority'>{1}</span>", priorytyClass,
134+
string html = string.Format("<span class='badge priority-{0} py-1 px-2' title='{1} Priority'>{1}</span>", priorityClass,
135135
title);
136136
return new MarkupString(html);
137137
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@page "/"
2+
3+
<PageTitle>Welcome</PageTitle>
4+
5+
<div class="main-content">
6+
<DxGridLayout CssClass="welcome-gridlayout" RowSpacing="3rem">
7+
<Rows>
8+
<DxGridLayoutRow Height="auto" Areas="header"></DxGridLayoutRow>
9+
<DxGridLayoutRow Height="auto" Areas="cards"></DxGridLayoutRow>
10+
</Rows>
11+
<Items>
12+
<DxGridLayoutItem Area="header" CssClass="title">
13+
<Template>
14+
<div class="title-header-text">AI Assistant + DevExpress Blazor Components</div>
15+
<div class="title-content-text">Select a component to open a page with an integrated AI Assistant</div>
16+
</Template>
17+
</DxGridLayoutItem>
18+
<DxGridLayoutItem Area="cards" CssClass="welcome-cards">
19+
<Template>
20+
<NavLink class="welcome-card" href="/grid">
21+
<svg class="welcome-card-img" alt="grid card">
22+
<use href="cards.svg#grid"></use>
23+
</svg>
24+
<div class="welcome-card-text">Grid</div>
25+
<div class="welcome-card-back"></div>
26+
</NavLink>
27+
<NavLink class="welcome-card" href="/reportviewer">
28+
<svg class="welcome-card-img" alt="report viewer card">
29+
<use href="cards.svg#reports"></use>
30+
</svg>
31+
<div class="welcome-card-text">Report Viewer</div>
32+
<div class="welcome-card-back"></div>
33+
</NavLink>
34+
</Template>
35+
</DxGridLayoutItem>
36+
</Items>
37+
</DxGridLayout>
38+
</div>

CS/DevExpress.AI.Samples.Blazor/Components/Pages/ReportViewer.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "/report"
1+
@page "/reportviewer"
22
@using Azure.AI.OpenAI.Assistants
33
@using DevExpress.Blazor.Reporting
44
@using DevExpress.XtraReports

CS/DevExpress.AI.Samples.Blazor/Components/Reporting/AITabRenderer.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
@using System.Text.RegularExpressions
2-
@using DevExpress.AI.Samples.Blazor.Models
3-
@using AIIntegration.Services.Chat
1+
@using DevExpress.AI.Samples.Blazor.Models
42
@using DevExpress.AIIntegration.Blazor.Chat
3+
@using System.Text.RegularExpressions
54
@using DevExpress.AIIntegration.OpenAI.Services
65
@using Markdig
76

8-
<DxAIChat CssClass="my-report-chat" ResponseContentFormat="ResponseContentFormat.Markdown" Initialized="ChatInitialized">
7+
8+
<DxAIChat CssClass="my-report-chat" Initialized="ChatInitialized">
99
<MessageContentTemplate>
1010
<div class="my-chat-content">
1111
@ToHtml(context.Content)
@@ -16,7 +16,7 @@
1616
@code {
1717
[Parameter] public UserAssistantTabContentModel Model { get; set; }
1818
string ClearAnnotations(string text) {
19-
//To clear out the annotations in a response from assistant.
19+
//To clear out annotations in a response from the assistant.
2020
return Regex.Replace(text, @"\【.*?】", "");
2121
}
2222

@@ -32,4 +32,4 @@
3232
});
3333
}
3434
}
35-
}
35+
}
-12.8 KB
Binary file not shown.

CS/DevExpress.AI.Samples.Blazor/DevExpress.AI.Samples.Blazor.csproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<EmitLegacyAssetsFileItems>True</EmitLegacyAssetsFileItems>
88
</PropertyGroup>
9-
10-
<ItemGroup>
11-
<None Remove="Data\Example.docx" />
12-
</ItemGroup>
13-
14-
<ItemGroup>
15-
<EmbeddedResource Include="Data\Example.docx" />
16-
</ItemGroup>
179
<ItemGroup>
1810
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0-beta.2" />
1911
<PackageReference Include="Azure.AI.OpenAI.Assistants" Version="1.0.0-beta.4" />

CS/DevExpress.AI.Samples.Blazor/Models/UserAssistantTabContentModel.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
using DevExpress.Blazor.Reporting.Models;
22
using DevExpress.XtraReports.UI;
33

4-
namespace DevExpress.AI.Samples.Blazor.Models
5-
{
6-
public class UserAssistantTabContentModel : ITabContentModel
7-
{
4+
namespace DevExpress.AI.Samples.Blazor.Models {
5+
public class UserAssistantTabContentModel : ITabContentModel {
86
public TabContentKind Kind => TabContentKind.Custom;
97
Func<XtraReport> GetReport;
108
bool reportReady = false;
119
public bool GetVisible() => reportReady && (GetReport()?.PrintingSystem?.PageCount ?? 0) > 0;
1210

13-
public UserAssistantTabContentModel(Func<XtraReport> getReport)
14-
{
11+
public UserAssistantTabContentModel(Func<XtraReport> getReport) {
1512
GetReport = getReport;
1613
}
1714

18-
public MemoryStream GetReportData()
19-
{
15+
public MemoryStream GetReportData() {
2016
var ms = new MemoryStream();
2117
GetReport()?.PrintingSystem.ExportToPdf(ms);
2218
ms.Position = 0;
2319
return ms;
2420
}
2521

26-
public Task InitializeAsync()
27-
{
22+
public Task InitializeAsync() {
2823
reportReady = false;
2924
return Task.CompletedTask;
3025
}

CS/DevExpress.AI.Samples.Blazor/appsettings.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
},
88
"AllowedHosts": "*",
99
"ConnectionStrings": {
10-
"NWindConnectionString": "XpoProvider=SQLite;Data Source=DataSources/nwind.db",
11-
"VehiclesDBConnectionString": "XpoProvider=SQLite;Data Source=DataSources/vehicles.db",
12-
"HomesConnectionString": "XpoProvider=SQLite;Data Source=DataSources/homes.db",
13-
"ContactsConnectionString": "XpoProvider=SQLite;Data Source=DataSources/Contacts.db",
1410
"DevAvConnectionString": "XpoProvider=SQLite;Data Source=DataSources/devav.sqlite3",
1511
"CountriesConnectionString": "XpoProvider=SQLite;Data Source=DataSources/Countries.db",
1612
"IssuesConnectionString": "Data Source=DataSources/issue-list.db"
Lines changed: 41 additions & 0 deletions
Loading

CS/DevExpress.AI.Samples.Blazor/wwwroot/site.css

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
.my-list {
88
height: 100vh;
9-
width: 420px;
9+
width: 200px;
1010
}
1111

1212
.my-report {
@@ -90,4 +90,107 @@
9090
height: 17px;
9191
background-image: url("./bug.svg");
9292
vertical-align: middle;
93+
}
94+
95+
.welcome-gridlayout {
96+
margin: auto;
97+
width: auto;
98+
height: auto;
99+
}
100+
101+
.welcome-gridlayout .dxbl-gridlayout-root {
102+
align-content: center;
103+
justify-content: center;
104+
}
105+
106+
.title {
107+
text-align: center;
108+
}
109+
110+
.welcome-cards {
111+
display: flex;
112+
flex-wrap: wrap;
113+
gap: 1.5rem;
114+
justify-content: center;
115+
}
116+
117+
.welcome-card {
118+
width: 26.25rem;
119+
height: 15rem;
120+
display: flex;
121+
flex-direction: column;
122+
align-items: center;
123+
justify-content: center;
124+
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -2px rgba(0, 0, 0, 0.1);
125+
transition: box-shadow 0.2s;
126+
border-radius: 1rem;
127+
color: black;
128+
gap: 1.5rem;
129+
text-decoration: none;
130+
position: relative;
131+
}
132+
133+
.welcome-card:hover {
134+
box-shadow: 0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 8px 10px -6px rgba(0, 0, 0, 0.1);
135+
}
136+
137+
.welcome-card .welcome-card-img {
138+
width: 6.5rem;
139+
height: 6.5rem;
140+
}
141+
142+
.welcome-card .welcome-card-text {
143+
font-size: 1.75rem;
144+
font-weight: 600;
145+
letter-spacing: 0em;
146+
text-align: center;
147+
text-decoration: unset;
148+
}
149+
150+
.welcome-card .welcome-card-back {
151+
position: absolute;
152+
top: 0;
153+
left: 0;
154+
right: 0;
155+
bottom: 0;
156+
background: #212529;
157+
opacity: 0.05;
158+
border-radius: 1rem;
159+
z-index: -2;
160+
}
161+
162+
.title {
163+
display: flex;
164+
flex-direction: column;
165+
gap: 0.5rem;
166+
padding-bottom: 0.625rem;
167+
}
168+
169+
.title.title-secondary {
170+
padding-top: 0.313rem;
171+
padding-bottom: 0;
172+
color: rgb(33, 37, 41);
173+
}
174+
175+
.title-header-text {
176+
font-size: 2.5rem;
177+
line-height: 3rem;
178+
font-weight: 600;
179+
letter-spacing: 0rem;
180+
padding: 0.3125rem 0;
181+
}
182+
183+
.title-content-text {
184+
font-size: 1.75rem;
185+
font-weight: 400;
186+
line-height: 2.5rem;
187+
letter-spacing: 0rem;
188+
}
189+
190+
.main-content {
191+
display: flex;
192+
justify-content: center;
193+
align-items: center;
194+
height: 100%;
195+
width: 100%;
93196
}

0 commit comments

Comments
 (0)