mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 17:49:05 +00:00
39 improve hostname handling (#42)
This commit is contained in:
parent
5250e5d2fb
commit
4f5815272a
@ -29,11 +29,11 @@
|
|||||||
<MudTd>
|
<MudTd>
|
||||||
@if (context.UsedProvider is not Providers.SELF_HOSTED)
|
@if (context.UsedProvider is not Providers.SELF_HOSTED)
|
||||||
{
|
{
|
||||||
@context.Model
|
@this.GetProviderModelName(context)
|
||||||
}
|
}
|
||||||
else if (context.UsedProvider is Providers.SELF_HOSTED && context.Host is not Host.LLAMACPP)
|
else if (context.UsedProvider is Providers.SELF_HOSTED && context.Host is not Host.LLAMACPP)
|
||||||
{
|
{
|
||||||
@context.Model
|
@this.GetProviderModelName(context)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -111,5 +111,12 @@ public partial class Settings : ComponentBase
|
|||||||
_ => string.Empty,
|
_ => string.Empty,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private string GetProviderModelName(AIStudio.Settings.Provider provider)
|
||||||
|
{
|
||||||
|
const int MAX_LENGTH = 36;
|
||||||
|
var modelName = provider.Model.ToString();
|
||||||
|
return modelName.Length > MAX_LENGTH ? "[...] " + modelName[^Math.Min(MAX_LENGTH, modelName.Length)..] : modelName;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
@ -47,7 +47,11 @@ public static class ExtensionsProvider
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="providerSettings">The provider settings.</param>
|
/// <param name="providerSettings">The provider settings.</param>
|
||||||
/// <returns>The provider instance.</returns>
|
/// <returns>The provider instance.</returns>
|
||||||
public static IProvider CreateProvider(this Settings.Provider providerSettings) => providerSettings.UsedProvider switch
|
public static IProvider CreateProvider(this Settings.Provider providerSettings)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return providerSettings.UsedProvider switch
|
||||||
{
|
{
|
||||||
Providers.OPEN_AI => new ProviderOpenAI { InstanceName = providerSettings.InstanceName },
|
Providers.OPEN_AI => new ProviderOpenAI { InstanceName = providerSettings.InstanceName },
|
||||||
Providers.ANTHROPIC => new ProviderAnthropic { InstanceName = providerSettings.InstanceName },
|
Providers.ANTHROPIC => new ProviderAnthropic { InstanceName = providerSettings.InstanceName },
|
||||||
@ -58,3 +62,10 @@ public static class ExtensionsProvider
|
|||||||
_ => new NoProvider(),
|
_ => new NoProvider(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Failed to create provider: {e.Message}");
|
||||||
|
return new NoProvider();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -102,7 +102,7 @@ public partial class ProviderDialog : ComponentBase
|
|||||||
UsedProvider = this.DataProvider,
|
UsedProvider = this.DataProvider,
|
||||||
Model = this.DataModel,
|
Model = this.DataModel,
|
||||||
IsSelfHosted = this.DataProvider is Providers.SELF_HOSTED,
|
IsSelfHosted = this.DataProvider is Providers.SELF_HOSTED,
|
||||||
Hostname = this.DataHostname,
|
Hostname = this.DataHostname.EndsWith('/') ? this.DataHostname[..^1] : this.DataHostname,
|
||||||
Host = this.DataHost,
|
Host = this.DataHost,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
5
app/MindWork AI Studio/wwwroot/changelog/v0.8.3.md
Normal file
5
app/MindWork AI Studio/wwwroot/changelog/v0.8.3.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# v0.8.3 (WIP)
|
||||||
|
- Migrated UI framework from MudBlazor v6.x.x to v7.x.x
|
||||||
|
- Added an option to configure the behavior of the navigation bar in the settings
|
||||||
|
- Improved the handling of self-hosted provider hostnames
|
||||||
|
- Improved the configured provider table: long model names are now truncated
|
Loading…
Reference in New Issue
Block a user