Skip to content

Commit f8a04fa

Browse files
author
Piotr Stachaczynski
committed
automation in place
1 parent b8f2c97 commit f8a04fa

50 files changed

Lines changed: 300 additions & 28 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.idea/.idea.MaIN/.idea/indexLayout.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.MaIN/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.models

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
gemma:2b
2+
llama3:8b
3+
4+
#Place any new model here and it will be downloaded during start command

Frontend/MainFE/.idea/.idea.MainFE/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Frontend/MainFE/Components/Layout/NavMenu.razor

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,12 @@
3333

3434
<nav class="navbar navbar-expand-md navbar-dark bg-dark mb-4 gradient">
3535
<div class="container-fluid">
36-
<a class="navbar-brand" href="">MaIN</a>
36+
<a class="navbar-brand" href=""><span class="fancy-text">M.A.I.N</span></a>
3737
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
3838
<span class="navbar-toggler-icon"></span>
3939
</button>
4040
<div class="collapse navbar-collapse" id="navbarSupportedContent">
4141
<ul class="navbar-nav mb-2 mb-md-0">
42-
<li class="nav-item">
43-
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
44-
<span class="oi oi-home" aria-hidden="true"></span> Home
45-
</NavLink>
46-
</li>
4742
<li class="nav-item">
4843
<NavLink class="nav-link" href="chat">
4944
<span class="oi oi-plus" aria-hidden="true"></span> 💬 Chat

Frontend/MainFE/Components/Pages/Chat.razor

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
@page "/chat"
2-
@using System.Runtime.CompilerServices
32
@using MainFE.Components.Models
43
@using Markdig
5-
@using Markdown.ColorCode
64
@using Microsoft.FluentUI.AspNetCore.Components
75
@using NAssetNameGenerator
86
@using Message = MainFE.Components.Models.Message
@@ -53,7 +51,7 @@
5351
}
5452
</div>
5553
<div class="input-container">
56-
<input @bind=ask placeholder="Enter your prompt here..." class="inp">
54+
<input @bind-value="ask" @bind-value:event="oninput" placeholder="Enter your prompt here..." @onkeydown="CheckEnterKey" class="inp">
5755
<FluentButton IconStart="@(new Icons.Filled.Size28.Send())" BackgroundColor="rgba(0, 0, 0, 0)" Style="margin-top: 5px; background-color: transparent"
5856
Appearance="Appearance.Lightweight"
5957
Loading="@loading"
@@ -85,6 +83,14 @@
8583
string ask = string.Empty;
8684
bool loading = false;
8785

86+
private async Task CheckEnterKey(KeyboardEventArgs e)
87+
{
88+
if (e.Key == "Enter")
89+
{
90+
await SendAsync(ask);
91+
}
92+
}
93+
8894
protected override async Task OnInitializedAsync()
8995
{
9096
Http.Timeout = TimeSpan.FromMinutes(10);
@@ -95,7 +101,7 @@
95101
private async Task LoadChatsAsync()
96102
{
97103

98-
var response = await Http.GetAsync("http://localhost:5243/api/chats");
104+
var response = await Http.GetAsync($"{ExtensionMethods.GetApiUrl()}/api/chats");
99105
if (response.IsSuccessStatusCode)
100106
{
101107
chats = await response.Content.ReadFromJsonAsync<List<ChatDto>>() ?? [];
@@ -104,7 +110,7 @@
104110

105111
private async Task LoadModelsAsync()
106112
{
107-
var response = await Http.GetAsync("http://localhost:5243/api/chats/models");
113+
var response = await Http.GetAsync($"{ExtensionMethods.GetApiUrl()}/api/chats/models");
108114
if (response.IsSuccessStatusCode)
109115
{
110116
models = await response.Content.ReadFromJsonAsync<List<string>>() ?? [];
@@ -114,7 +120,7 @@
114120

115121
private async Task LoadChatAsync(string chatId)
116122
{
117-
var response = await Http.GetFromJsonAsync<ChatDto>($"http://localhost:5243/api/chats/{chatId}");
123+
var response = await Http.GetFromJsonAsync<ChatDto>($"{ExtensionMethods.GetApiUrl()}/api/chats/{chatId}");
118124
if (response != null)
119125
{
120126
messages = response.Messages;
@@ -125,7 +131,7 @@
125131

126132
private async Task DeleteChatAsync(string id)
127133
{
128-
var response = await Http.DeleteAsync($"http://localhost:5243/api/chats/{id}");
134+
var response = await Http.DeleteAsync($"{ExtensionMethods.GetApiUrl()}/api/chats/{id}");
129135
if (response.IsSuccessStatusCode)
130136
{
131137
chats.RemoveAll(c => c.Id == id);
@@ -148,7 +154,7 @@
148154
Stream = false,
149155
};
150156

151-
var result = await Http.PostAsJsonAsync("http://localhost:5243/api/chats", newChatRequest);
157+
var result = await Http.PostAsJsonAsync($"{ExtensionMethods.GetApiUrl()}/api/chats", newChatRequest);
152158

153159
if (result.IsSuccessStatusCode)
154160
{
@@ -172,7 +178,7 @@
172178
selectedChat.Messages = messages;
173179
selectedChat.Model = selectedModel;
174180

175-
var replyServerOllama = await Http.PostAsJsonAsync("http://localhost:5243/api/chats/complete", selectedChat);
181+
var replyServerOllama = await Http.PostAsJsonAsync($"{ExtensionMethods.GetApiUrl()}/api/chats/complete", selectedChat);
176182

177183
if (replyServerOllama.IsSuccessStatusCode)
178184
{
Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
11
@page "/"
2+
<link rel="stylesheet" href="css/home.css">
23

34
<PageTitle>Home</PageTitle>
5+
<div class="container">
6+
<div class="description">
7+
<div>
8+
<div class="robot">
9+
<img src="images/robot.png" alt="Robot" id="robot"/>
10+
</div>
11+
<h1 style="display: inline">Welcome to <span class="fancy-text">M.A.I.N</span></h1>
12+
</div>
13+
<p style="width: 50vmax ">
14+
M.A.I.N (Modular Artificial Intelligence Network) is an advanced, modular AI platform designed to integrate various AI capabilities seamlessly. Initially featuring chat-based solutions powered by open-source large language models (LLMs), M.A.I.N is set to evolve with additional functionalities, providing a comprehensive AI toolkit for diverse applications. The ultimate goal is to build an AI that is aware of what is happening within the system and can react to those changes. This interconnectedness and contextual awareness is what makes it a "Network."
15+
</p>
16+
<div style="width: 50vmax">
17+
<ul style="text-align: left">
18+
<li><b>Chat Solutions:</b> Leveraging open-source LLMs to deliver sophisticated conversational AI experiences.</li>
19+
<li><b>Vision Capabilities:</b>Upcoming feature enabling the system to process and interpret visual data.</li>
20+
<li><b>Image Processing:</b> Advanced image handling and analysis tools.</li>
21+
<li><b>Retrieval-Augmented Generation (RAG):</b> Integrating retrieval mechanisms to enhance response generation with up-to-date information.</li>
22+
<li><b>Modular Architecture:</b> Flexible and scalable design allowing easy integration of new AI modules.</li>
23+
<li><b>Open-Source Foundation:</b> Built on robust, community-driven AI technologies.</li>
24+
</ul>
25+
</div>
26+
</div>
27+
</div>
428

5-
<h1>Hello, world!</h1>
6-
7-
Welcome to your new app.
29+
<script>
30+
document.addEventListener("DOMContentLoaded", function() {
31+
setTimeout(function() {
32+
document.getElementById('robot').classList.add('visible');
33+
}, 200); // Delay to ensure the page is fully loaded before animation
34+
});
35+
</script>

Frontend/MainFE/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
2+
WORKDIR /app
3+
4+
COPY *.csproj ./
5+
RUN dotnet restore
6+
7+
COPY . ./
8+
RUN dotnet publish -c Release -o out
9+
10+
# Use the official ASP.NET image to run the app
11+
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
12+
WORKDIR /app
13+
COPY --from=build /app/out .
14+
ENTRYPOINT ["dotnet", "MainFE.dll"]
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace MainFE;
44

5-
public static class Extensions
5+
public static class ExtensionMethods
66
{
77
public static string PrepareMd(this string content)
88
{
@@ -40,5 +40,10 @@ public static string PrepareMd(this string content)
4040

4141
return content;
4242
}
43+
44+
public static string GetApiUrl()
45+
{
46+
return Environment.GetEnvironmentVariable("API_URL") ?? throw new InvalidOperationException("API_URL environment variable is not set");
47+
}
4348

4449
}

Frontend/MainFE/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
app.UseStaticFiles();
2525
app.UseAntiforgery();
26-
2726
app.MapRazorComponents<App>()
2827
.AddInteractiveServerRenderMode();
2928

0 commit comments

Comments
 (0)