Skip to content

Commit 29193a2

Browse files
committed
gather the ai integration demos in a section #24327
1 parent 18ae6ec commit 29193a2

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

Telerik.Examples.Mvc/Telerik.Examples.Mvc/Controllers/Chat/ChatAiIntegrationController.cs renamed to Telerik.Examples.Mvc/Telerik.Examples.Mvc/Controllers/Chat/SmartChatController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
namespace Telerik.Examples.Mvc.Controllers.Chat
88
{
9-
public class ChatAiIntegrationController : Controller
9+
public class SmartChatController : Controller
1010
{
11-
public IActionResult ChatAiIntegration()
11+
public IActionResult SmartChat()
1212
{
1313
return View();
1414
}
1515

1616
private readonly AiService _ai;
17-
public ChatAiIntegrationController(AiService ai) { _ai = ai; }
17+
public SmartChatController(AiService ai) { _ai = ai; }
1818

1919
[HttpPost]
2020
public async Task<IActionResult> Ask([FromBody] AiPrompt req)

Telerik.Examples.Mvc/Telerik.Examples.Mvc/Views/Chat/ChatAiIntegration.cshtml renamed to Telerik.Examples.Mvc/Telerik.Examples.Mvc/Views/Chat/SmartChat.cshtml

File renamed without changes.

Telerik.Examples.Mvc/Telerik.Examples.Mvc/Views/Shared/_Layout.cshtml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,33 @@
102102
</span>
103103
<input autocomplete="off" placeholder="Search..." title="Search..." aria-label="Search..." class="k-input-inner" onkeyup="searchExamples();">
104104
</span>
105-
@(Html.Kendo().PanelBar()
106-
.Name("panelbar")
107-
.Events(e => e.Select("gridSelect"))
108-
.ExpandMode(PanelBarExpandMode.Single)
109-
.Items(panelbar =>
105+
106+
@{
107+
var list = (List<Demo>)JsonSerializer.Deserialize<List<Demo>>(File.ReadAllBytes(Directory.GetCurrentDirectory() + "/wwwroot/files/ExamplesEndpoints.txt"));
108+
foreach (var example in list)
110109
{
111-
foreach (var example in (List<Demo>)JsonSerializer.Deserialize<List<Demo>>(File.ReadAllBytes(Directory.GetCurrentDirectory() + "/wwwroot/files/ExamplesEndpoints.txt")))
110+
if (example.ActionName.Contains("Smart"))
112111
{
113-
panelbar.Add().Text(example.ComponentName + " " + System.Text.RegularExpressions.Regex.Replace(example.ActionName, "(\\B[A-Z])", " $1"));
112+
example.ComponentName = "AI";
114113
}
115-
}))
114+
}
115+
116+
list = list.OrderBy(x => x.ComponentName).ToList();
117+
}
118+
119+
@(
120+
Html.Kendo().PanelBar()
121+
.Name("panelbar")
122+
.Events(e => e.Select("gridSelect"))
123+
.ExpandMode(PanelBarExpandMode.Single)
124+
.Items(panelbar =>
125+
{
126+
foreach (var example in list)
127+
{
128+
panelbar.Add().Text(example.ComponentName + " " + System.Text.RegularExpressions.Regex.Replace(example.ActionName, "(\\B[A-Z])", " $1"));
129+
}
130+
})
131+
)
116132
</div>
117133
<div class="container">
118134
<h4 class="title-container">@(System.Text.RegularExpressions.Regex.Replace(ViewContext.HttpContext.Request.Path.Value.Split('/')[1], "(\\B[A-Z])", " $1"))</h4>

0 commit comments

Comments
 (0)