mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 00:57:59 +00:00
Implement support for self-hosted and local LLMs (#20)
This commit is contained in:
1 parent
6cc1d37db8
commit
29263660fc
21 files changed
+418
-62
No files matched your search
@@ -0,0 +1,39 @@
|
||||
namespace AIStudio.Settings;
|
||||
|
||||
public static class SettingsMigrations
|
||||
{
|
||||
public static Data Migrate(Data previousData)
|
||||
{
|
||||
switch (previousData.Version)
|
||||
{
|
||||
case Version.V1:
|
||||
return MigrateFromV1(previousData);
|
||||
|
||||
default:
|
||||
Console.WriteLine("No migration needed.");
|
||||
return previousData;
|
||||
}
|
||||
}
|
||||
|
||||
private static Data MigrateFromV1(Data previousData)
|
||||
{
|
||||
//
|
||||
// Summary:
|
||||
// In v1 we had no self-hosted providers. Thus, we had no hostnames.
|
||||
//
|
||||
|
||||
Console.WriteLine("Migrating from v1 to v2...");
|
||||
return new()
|
||||
{
|
||||
Version = Version.V2,
|
||||
|
||||
Providers = previousData.Providers.Select(provider => provider with { IsSelfHosted = false, Hostname = "" }).ToList(),
|
||||
|
||||
EnableSpellchecking = previousData.EnableSpellchecking,
|
||||
IsSavingEnergy = previousData.IsSavingEnergy,
|
||||
NextProviderNum = previousData.NextProviderNum,
|
||||
ShortcutSendBehavior = previousData.ShortcutSendBehavior,
|
||||
UpdateBehavior = previousData.UpdateBehavior,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user