39 improve hostname handling (#42)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2024-07-24 19:27:25 +02:00
1 parent 5250e5d2fb
commit 4f5815272a
5 files changed
+36 -13

No files matched your search

@@ -29,11 +29,11 @@
<MudTd>
@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)
{
@context.Model
@this.GetProviderModelName(context)
}
else
{
@@ -111,5 +111,12 @@ public partial class Settings : ComponentBase
_ => 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
}