Skip to content

Commit

Permalink
Release: Version 1.1.1 HOTFIX merge #2 from development branch
Browse files Browse the repository at this point in the history
# Release: Version 1.1.1 HOTFIX

## Description

This pull request focuses on the newly added changes in Version 1.1.0, particularly in the Text Generation and Management features, as well as updates to the EGOIST-Models-Catalog and the addition of cross-platform support to the roadmap.

## Changes Made

1. **Text Generation Enhancements:**
- Removed Markdown rendering capability due wpf limitions.
- Introduced roleplay capabilities with characters and support for single-turn and multi-turn group roleplays.
- Introduced interaction with local documents for seamless integration.
- Introduced text completion feature for enhanced narritive experience.
- Introduced Chat with AI for generating a diverse conversations with AI assistants.

2. **Management Features:**
- Introduced a Characters section to manage roleplay characters effectively, explore created or downloaded roleplay characters with personalities and descriptions.
- Introduced a Character Creator feature for building detailed character cards., allowing users to build character cards to instruct AI behavior.
- Introduced the ability to import TavernAI characters for a richer roleplay experience.

3. **EGOIST-Models-Catalog Update:**
- Encouraged users to check the [EGOIST-Models-Catalog](https://github.com/LSXPrime/EGOIST-Models-Catalog) for the latest details on community-tested models on HuggingFace.
- Updated instructions on [EGOIST-Models-Catalog](https://github.com/LSXPrime/EGOIST-Models-Catalog) to advise users to download tested models and characters from this repo the configuration files.

4. **Roadmap Expansion:**
- Added a new roadmap section for Cross-Platform Support.
- Plans to replace the WPF UI Framework (Avalonia / Uno) for improved cross-platform compatibility.
- Future releases include Linux and MacOS binaries to broaden the application's reach.

> HOTFIX: Fix crash on adding new completion session in Text Completion tab.
  • Loading branch information
LSXPrime authored Feb 5, 2024
2 parents 5a5ccee + 593b8b8 commit 9603718
Show file tree
Hide file tree
Showing 46 changed files with 2,631 additions and 722 deletions.
8 changes: 8 additions & 0 deletions EGOIST.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C8B2FB02-0AA0-4654-BC92-5E0FFBBA5FAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8B2FB02-0AA0-4654-BC92-5E0FFBBA5FAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8B2FB02-0AA0-4654-BC92-5E0FFBBA5FAF}.Debug|x64.ActiveCfg = Debug|x64
{C8B2FB02-0AA0-4654-BC92-5E0FFBBA5FAF}.Debug|x64.Build.0 = Debug|x64
{C8B2FB02-0AA0-4654-BC92-5E0FFBBA5FAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8B2FB02-0AA0-4654-BC92-5E0FFBBA5FAF}.Release|Any CPU.Build.0 = Release|Any CPU
{C8B2FB02-0AA0-4654-BC92-5E0FFBBA5FAF}.Release|x64.ActiveCfg = Release|Any CPU
{C8B2FB02-0AA0-4654-BC92-5E0FFBBA5FAF}.Release|x64.Build.0 = Release|Any CPU
{2C2378FC-FC57-4C0A-9997-4B5107B16AEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C2378FC-FC57-4C0A-9997-4B5107B16AEF}.Debug|x64.ActiveCfg = Debug|Any CPU
{2C2378FC-FC57-4C0A-9997-4B5107B16AEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C2378FC-FC57-4C0A-9997-4B5107B16AEF}.Release|x64.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
43 changes: 16 additions & 27 deletions EGOIST/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.

using System.IO;
using System.IO;
using System.Reflection;
using System.Windows.Threading;
using EGOIST.Data;
using EGOIST.Helpers;
using EGOIST.Services;
using EGOIST.ViewModels.Pages;
using EGOIST.ViewModels.Windows;
Expand All @@ -14,18 +11,14 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;

namespace EGOIST;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App
{
// The.NET Generic Host provides dependency injection, configuration, logging, and other services.
// https://docs.microsoft.com/dotnet/core/extensions/generic-host
// https://docs.microsoft.com/dotnet/core/extensions/dependency-injection
// https://docs.microsoft.com/dotnet/core/extensions/configuration
// https://docs.microsoft.com/dotnet/core/extensions/logging
private static readonly IHost _host = Host
.CreateDefaultBuilder()
.ConfigureAppConfiguration(c => { c.SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)); })
Expand All @@ -51,42 +44,38 @@ public partial class App
services.AddSingleton<SettingsViewModel>();
}).Build();

/// <summary>
/// Gets registered service.
/// </summary>
/// <typeparam name="T">Type of the service to get.</typeparam>
/// <returns>Instance of the service or <see langword="null"/>.</returns>
public static T GetService<T>()
where T : class
{
return _host.Services.GetService(typeof(T)) as T;
}

/// <summary>
/// Occurs when the application is loading.
/// </summary>
private void OnStartup(object sender, StartupEventArgs e)
{
_host.Start();
GetService<ManagementViewModel>().LoadData();
GetService<TextViewModel>().OnStartup();
GetService<SettingsViewModel>().OnStartup();
_ = GetService<SettingsViewModel>().CheckForUpdate();
_ = SystemInfo.Instance.Montitor();
Extensions.LoadData();

Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.File("EGOIST_Handler.log")
.CreateLogger();
}

/// <summary>
/// Occurs when the application is closing.
/// </summary>
private async void OnExit(object sender, ExitEventArgs e)
{
Extensions.SaveData();
Log.CloseAndFlush();
await _host.StopAsync();

_host.Dispose();
}

/// <summary>
/// Occurs when an exception is thrown by an application but not handled.
/// </summary>
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
// For more info see https://docs.microsoft.com/en-us/dotnet/api/system.windows.application.dispatcherunhandledexception?view=windowsdesktop-6.0
Extensions.Notify("Core", $"OnDispatcherUnhandledException: {e.Exception.Message}");
}
}
125 changes: 35 additions & 90 deletions EGOIST/Data/AppConfig.cs
Original file line number Diff line number Diff line change
@@ -1,97 +1,38 @@
using System.Collections;
using System.ComponentModel;
using System.IO;
using EGOIST.Enums;

namespace EGOIST.Data;

public class AppConfig : INotifyPropertyChanged
public partial class AppConfig : ObservableObject
{
#region API
public string ApiUrl => string.Format("{0}:{1}", ApiHost, ApiPort);

[ObservableProperty]
private string _apiHost = "http://127.0.0.1";
public string ApiHost
{
get => _apiHost;
set
{
if (_apiHost != value)
{
_apiHost = value;
OnPropertyChanged(nameof(ApiHost));
}
}
}
[ObservableProperty]
private int _apiPort = 8000;
public int ApiPort
{
get => _apiPort;
set
{
if (_apiPort != value)
{
_apiPort = value;
OnPropertyChanged(nameof(ApiPort));
}
}
}
[ObservableProperty]
private string _dataSecretKey = "USER_SECRET_KEY_TO_DECRYPT_DATA";
#endregion
#region Paths
[ObservableProperty]
private string _modelsPath = string.Empty;
public string ModelsPath
{
get => _modelsPath;
set
{
if (_modelsPath != value)
{
_modelsPath = value;
OnPropertyChanged(nameof(ModelsPath));
}
}
}
[ObservableProperty]
private string _voicesPath = string.Empty;
public string VoicesPath
{
get => _voicesPath;
set
{
if (_voicesPath != value)
{
_voicesPath = value;
OnPropertyChanged(nameof(VoicesPath));
}
}
}
[ObservableProperty]
private string _resultsPath = string.Empty;
public string ResultsPath
{
get => _resultsPath;
set
{
if (_resultsPath != value)
{
_resultsPath = value;
OnPropertyChanged(nameof(ResultsPath));
}
}
}

private static readonly string filePath = Directory.GetCurrentDirectory() + "\\Config.json";
[ObservableProperty]
private string _charactersPath = string.Empty;
[ObservableProperty]
private string _backgroundsPath = string.Empty;
private static readonly string filePath = $"{Directory.GetCurrentDirectory()}\\Config.json";
#endregion
#region Inference
[ObservableProperty]
public Device _device = Device.GPU;
public Device Device
{
get => _device;
set
{
_device = value;
OnPropertyChanged(nameof(Device));
}
}
public IEnumerable DeviceValues => Enum.GetValues(typeof(Device));
public static IEnumerable DeviceValues => Enum.GetValues(typeof(Device));
#endregion

public AppConfig()
Expand All @@ -101,6 +42,8 @@ public AppConfig()
ModelsPath = $"{Directory.GetCurrentDirectory()}\\Resources\\Models\\Checkpoints";
VoicesPath = $"{Directory.GetCurrentDirectory()}\\Resources\\Voices";
ResultsPath = $"{Directory.GetCurrentDirectory()}\\Resources\\Results";
CharactersPath = $"{Directory.GetCurrentDirectory()}\\Resources\\Characters";
BackgroundsPath = $"{Directory.GetCurrentDirectory()}\\Resources\\Backgrounds";
}

// Load settings from a JSON file
Expand All @@ -118,6 +61,8 @@ public void LoadSelf()
ModelsPath = self.ModelsPath;
VoicesPath = self.VoicesPath;
ResultsPath = self.ResultsPath;
CharactersPath = self.CharactersPath;
BackgroundsPath = self.BackgroundsPath;
Device = self.Device;

CheckPaths();
Expand All @@ -126,18 +71,20 @@ public void LoadSelf()

private void CheckPaths()
{
var transcribeModelsPath = ModelsPath + "\\VoiceGeneration\\transcribe";
var cloneModelsPath = ModelsPath + "\\VoiceGeneration\\clone";
var transcribeModelsPath = $"{ModelsPath}\\VoiceGeneration\\transcribe";
var cloneModelsPath = $"{ModelsPath}\\VoiceGeneration\\clone";
Directory.CreateDirectory(transcribeModelsPath);
Directory.CreateDirectory(cloneModelsPath);
Directory.CreateDirectory(VoicesPath);
Directory.CreateDirectory(ResultsPath+ "\\VoiceGeneration");
Directory.CreateDirectory($"{ResultsPath}\\VoiceGeneration");
Directory.CreateDirectory($"{Directory.GetCurrentDirectory()}\\Resources\\Characters");
Directory.CreateDirectory($"{Directory.GetCurrentDirectory()}\\Resources\\Backgrounds");
}

// Save settings to a JSON file
public void Save()
{
var json = Newtonsoft.Json.JsonConvert.SerializeObject(this);
var json = Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
File.WriteAllText(filePath, json);
ExportToBackend();
CheckPaths();
Expand All @@ -151,36 +98,34 @@ public void Reset()

ApiHost = "http://127.0.0.1";
ApiPort = 8000;
ModelsPath = Directory.GetCurrentDirectory() + "\\Resources\\Models\\Checkpoints";
VoicesPath = Directory.GetCurrentDirectory() + "\\Resources\\Voices";
ResultsPath = Directory.GetCurrentDirectory() + "\\Resources\\Results";
ModelsPath = $"{Directory.GetCurrentDirectory()}\\Resources\\Models\\Checkpoints";
VoicesPath = $"{Directory.GetCurrentDirectory()}\\Resources\\Voices";
ResultsPath = $"{Directory.GetCurrentDirectory()}\\Resources\\Results";
CharactersPath = $"{Directory.GetCurrentDirectory()}\\Resources\\Characters";
BackgroundsPath = $"{Directory.GetCurrentDirectory()}\\Resources\\Backgrounds";
Save();
}

// For backend config
public void ExportToBackend()
{
var backendPath = Directory.CreateDirectory(Directory.GetCurrentDirectory() + "\\Backend");
using StreamWriter file = new StreamWriter($"{backendPath}\\.env");
var backendPath = Directory.CreateDirectory($"{Directory.GetCurrentDirectory()}\\Backend");
using var file = new StreamWriter($"{backendPath}\\.env");

file.WriteLine($"HOST_IP={new Uri(ApiHost).Host}");
file.WriteLine($"HOST_PORT={ApiPort}");
file.WriteLine($"DEVICE={Device}");
file.WriteLine($"MODELS_PATH={ModelsPath}");
file.WriteLine($"VOICES_PATH={VoicesPath}");
file.WriteLine($"RESULTS_PATH={ResultsPath}");
file.WriteLine($"CHARACTER_PATH={CharactersPath}");
file.WriteLine($"BACKGROUNDS_PATH={BackgroundsPath}");
file.Close();
}

public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

public delegate void ConfigSavedDelegate();
public event ConfigSavedDelegate ConfigSavedEvent;

private static AppConfig? instance;
public static AppConfig Instance => instance ?? (instance = new AppConfig());
public static AppConfig Instance => instance ??= new AppConfig();
}
11 changes: 11 additions & 0 deletions EGOIST/Data/ChatMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace EGOIST.Data;

public partial class ChatMessage : ObservableObject
{
[ObservableProperty]
private string _sender = string.Empty;
[ObservableProperty]
private string _message = string.Empty;
[ObservableProperty]
private bool _isEditable;
}
63 changes: 63 additions & 0 deletions EGOIST/Data/ChatSession.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Text;
using LLama;

namespace EGOIST.Data;

public partial class ChatSession : ObservableObject, INotifyPropertyChanged
{
public string SessionName { get; set; }

[ObservableProperty]
private Dictionary<int, ObservableCollection<ChatMessage>> _chatMessages = new();
public ObservableCollection<ChatMessage> Messages => ChatMessages[CurrentLog];


#region Unused due LLama tokenizer/embeddings limitions
[ObservableProperty]
public int _currentLog = 0;
public string CurrentLogSTR => $"{CurrentLog} / {Edits}";
public int Edits => ChatMessages.Count - 1;
public bool Edited => Edits > 0;
#endregion

#region LLamaSharp
[NonSerialized]
public StatefulExecutorBase? Executor;
#endregion


public ChatSession()
{
SessionName = $"Chat {DateTime.Now}";
ChatMessages.Add(0, new());
}

public ChatMessage AddMessage(string user, string message)
{
var messageInput = new ChatMessage { Sender = user, Message = message };
Messages.Add(messageInput);

return messageInput;
}

public override string ToString()
{
var stringBuilder = new StringBuilder();

foreach (var message in Messages)
{
stringBuilder.AppendLine($"{message.Sender}: {message.Message}");
}

return stringBuilder.ToString();
}

public event PropertyChangedEventHandler PropertyChanged;

public virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
Loading

0 comments on commit 9603718

Please sign in to comment.