Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lcarrere committed Nov 22, 2024
0 parents commit 8d72ece
Show file tree
Hide file tree
Showing 186 changed files with 21,597 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/_typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Typos configuration file
#
# Info: https://github.com/marketplace/actions/typos-action
# Install: brew install typos-cli
# Install: conda install typos
# Run: typos -c .github/_typos.toml

[files]
extend-exclude = [
"_typos.toml",
"LM-Kit-Maestro/wwwroot/*"
]

32 changes: 32 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: build_test

on:
push:
branches: ["main"]
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Setup .NET 9
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x

- name: Install MAUI Workload
run: dotnet workload install maui


- name: Restore Dependencies
run: dotnet restore LM-Kit-Maestro.sln

- name: Build Debug Configuration
run: dotnet build LM-Kit-Maestro.sln --no-restore --configuration Debug

- name: Build Release Configuration
run: dotnet build LM-Kit-Maestro.sln --no-restore --configuration Release

31 changes: 31 additions & 0 deletions .github/workflows/spell_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Check pull requests for typos.
#
# Configuration: .github/_typos.toml
#
# Info: https://github.com/marketplace/actions/typos-action
# Local install: brew install typos-cli
# Local install: conda install typos
# Local run: typos -c .github/_typos.toml

name: spell_check

on:
push:
branches: [ "main" ]

workflow_dispatch:

jobs:
run:
name: Spell check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Use custom config file
uses: crate-ci/typos@master
with:
config: .github/_typos.toml
write_changes: false
quiet: true
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.vs
LM-Kit-Maestro/bin
LM-Kit-Maestro/obj
*.user
/tests/bin
/tests/obj
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 LM-Kit

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
33 changes: 33 additions & 0 deletions LM-Kit-Maestro.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35327.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LM-Kit-Maestro", "LM-Kit-Maestro\LM-Kit-Maestro.csproj", "{CA06766A-A00F-4496-8992-0944994AFB9F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LM-Kit-Maestro.Tests", "tests\LM-Kit-Maestro.Tests.csproj", "{37E609B0-C258-406F-B596-771B757667C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CA06766A-A00F-4496-8992-0944994AFB9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA06766A-A00F-4496-8992-0944994AFB9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA06766A-A00F-4496-8992-0944994AFB9F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{CA06766A-A00F-4496-8992-0944994AFB9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA06766A-A00F-4496-8992-0944994AFB9F}.Release|Any CPU.Build.0 = Release|Any CPU
{CA06766A-A00F-4496-8992-0944994AFB9F}.Release|Any CPU.Deploy.0 = Release|Any CPU
{37E609B0-C258-406F-B596-771B757667C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37E609B0-C258-406F-B596-771B757667C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37E609B0-C258-406F-B596-771B757667C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37E609B0-C258-406F-B596-771B757667C6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {416A0EEC-3B05-40E2-AB90-DC69F9E18DDE}
EndGlobalSection
EndGlobal
22 changes: 22 additions & 0 deletions LM-Kit-Maestro/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:LMKitMaestro"
xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="LMKitMaestro.App">
<Application.Resources>
<ResourceDictionary>
<!--<StyleSheet Source="Resources/CSS/LmKitMaestro.css"/>
<StyleSheet Source="Resources/CSS/font-awesome.css"/>-->
<mct:VariableMultiValueConverter x:Key="AllTrueConverter" ConditionType="All"/>
<mct:VariableMultiValueConverter x:Key="AllFalseConverter" ConditionType="None"/>
<mct:VariableMultiValueConverter x:Key="AnyTrueConverter" ConditionType="Any"/>

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary x:Name="colors" Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
<ResourceDictionary Source="Resources/Styles/Icons.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
63 changes: 63 additions & 0 deletions LM-Kit-Maestro/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using LMKitMaestro.ViewModels;
using Microsoft.AspNetCore.Components.WebView.Maui;

namespace LMKitMaestro
{
public partial class App : Application
{
private readonly AppShellViewModel _appShellViewModel;

public App(AppShellViewModel appShellViewModel)
{
InitializeComponent();

BlazorWebViewHandler.BlazorWebViewMapper.AppendToMapping("CustomBlazorWebView", (handler, view) =>
{
#if WINDOWS
// Setting background color of Blazor Web View to the page background color
// to avoid visual white flash while the view is loading.
if (App.Current != null && App.Current.Resources.TryGetValue("Background", out object value) && value is Color color)
{
color.ToRgb(out byte r, out byte g, out byte b);

handler.PlatformView.DefaultBackgroundColor = new Windows.UI.Color()
{
A = 255,
R = r,
G = g,
B = b
};
}
#endif
});

_appShellViewModel = appShellViewModel;
MainPage = new AppShell(appShellViewModel);

Check warning on line 35 in LM-Kit-Maestro/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build

'Application.MainPage.set' is obsolete: 'This property is deprecated. Initialize your application by overriding Application.CreateWindow rather than setting MainPage. To modify the root page in an active application, use Windows[0].Page for applications with a single window. For applications with multiple windows, use Application.Windows to identify and update the root page on the correct window. Additionally, each element features a Window property, accessible when it's part of the current window.'
}

protected override async void OnStart()
{
base.OnStart();

Current!.UserAppTheme = AppTheme.Dark;
await _appShellViewModel.Init();
}

protected override Window CreateWindow(IActivationState? activationState)
{
Window window = base.CreateWindow(activationState);

window.Destroying += OnAppWindowDestroying;

window.MinimumWidth = AppConstants.WindowMinimumWidth;
window.MinimumHeight = AppConstants.WindowMinimumHeight;

return window;
}

private void OnAppWindowDestroying(object? sender, EventArgs e)
{
_appShellViewModel.SaveAppSettings();
}
}
}
113 changes: 113 additions & 0 deletions LM-Kit-Maestro/AppConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
namespace LMKitMaestro;

internal static class AppConstants
{
public const string DatabaseFilename = "LMKitMaestroSQLite.db3";

public const SQLite.SQLiteOpenFlags Flags =
// open the database in read/write mode
SQLite.SQLiteOpenFlags.ReadWrite |
// create the database if it doesn't exist
SQLite.SQLiteOpenFlags.Create |
// enable multi-threaded database access
SQLite.SQLiteOpenFlags.SharedCache;

public const string ChatRoute = "Chat";

public const string ModelsRoute = "Models";

public const double ChatMessageMaximumWidth = 800;

public const double ChatWindowLayoutMinimumWidth = 720;

public const double WindowMinimumWidth = 568;

public const double WindowMinimumHeight = 600;

public const double PopupWidth = 536;

public const double AlertPopupWidth = 400;

public const double AppBarHeight = 72;

public const double ChatPageTopBarHeight = AppBarHeight + ChatPageHeaderHeight - 8;

public const double ModelSelectionButtonMaxWidth = 568;

public const double MinimizedHeaderButtonWidth = ChatWindowLayoutMinimumWidth - (16 * 2);

public const double ModelSelectionButtonHeight = 48;

public const double ChatPageHeaderHeight = ModelSelectionButtonHeight + (8 * 2);

public const double ChatPageSidebarWidth = 300;

public const double HeaderHorizontalMargin = 12;

public const double ChatPageSideTogglesWidth = (ChatPageToggleButtonWidth * 2) + 16 + 8;

public const double ChatPageToggleButtonWidth = 32;

#if BETA_DOWNLOAD_MODELS
//LM-Kit models catalog: https://huggingface.co/lm-kit
public static readonly ModelInfo[] AvailableModels =
{
new ModelInfo(
@"https://huggingface.co/lm-kit/llama-3-8b-instruct-gguf/resolve/main/Llama-3-8B-Instruct-Q4_K_M.gguf",
new ModelInfo.ModelMetadata()
{
FileSize = 4920733952
}),

new ModelInfo(
@"https://huggingface.co/lm-kit/LM-Kit.Sentiment_Analysis-TinyLlama-1.1B-1T-OpenOrca-en-q4-gguf/resolve/main/LM-Kit.Sentiment_Analysis-TinyLlama-1.1B-1T-OpenOrca-en-q4.gguf",
new ModelInfo.ModelMetadata()
{
}),

new ModelInfo(
@"https://huggingface.co/lm-kit/LM-Kit.Sarcasm_Detection-TinyLlama-1.1B-1T-OpenOrca-en-q4-gguf/resolve/main/LM-Kit.Sarcasm_Detection-TinyLlama-1.1B-1T-OpenOrca-en-q4.gguf",
new ModelInfo.ModelMetadata()
{
}),

new ModelInfo(
@"https://huggingface.co/lm-kit/bge-1.5-gguf/resolve/main/bge-small-en-v1.5-f16.gguf",
new ModelInfo.ModelMetadata()
{
}),

new ModelInfo(
@"https://huggingface.co/lm-kit/mistral-0.1-openorca-7b-gguf/resolve/main/Mistral-0.1-OpenOrca-7B-Q4_K_M.gguf",
new ModelInfo.ModelMetadata()
{
}),

new ModelInfo(
@"https://huggingface.co/lm-kit/mistral-0.3-7b-gguf/resolve/main/Mistral-0.3-7B-Q4_K_M.gguf",
new ModelInfo.ModelMetadata()
{
}),

new ModelInfo(
@"https://huggingface.co/lm-kit/deepseek-coder-1.6-7b-gguf/resolve/main/DeepSeek-Coder-1.6-7B-Instruct-Q4_K_M.gguf",
new ModelInfo.ModelMetadata()
{
}),

new ModelInfo(
@"https://huggingface.co/lm-kit/deepseek-coder-2-lite-15.7b-gguf/resolve/main/DeepSeek-Coder-2-Lite-15.7B-Instruct-Q4_K_M.gguf",
new ModelInfo.ModelMetadata()
{
}),
//https://huggingface.co/lm-kit/llama-3.1-8b-instruct-gguf
//https://huggingface.co/lm-kit/phi-3.1-mini-4k-3.8b-instruct-gguf/tree/main
//https://huggingface.co/lm-kit/gemma-2-2b-gguf/tree/main
//https://huggingface.co/lm-kit/phi-3-medium-4k-14b-instruct-gguf/tree/main
//https://huggingface.co/lm-kit/mistral-0.3-7b-instruct-gguf/tree/main
//https://huggingface.co/lm-kit/mistral-nemo-2407-12.2b-instruct-gguf/tree/main
//https://huggingface.co/lm-kit/qwen-2-7b-instruct-gguf/tree/main
//https://huggingface.co/lm-kit/gemma-2-9b-gguf/tree/main
};
#endif
}
Loading

0 comments on commit 8d72ece

Please sign in to comment.