Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
BeepBeepBopBop committed Jan 24, 2025
1 parent 78ea484 commit 3876a96
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 51 deletions.
56 changes: 11 additions & 45 deletions LM-Kit-Maestro/UI/Razor/Components/ChatSettings.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
<MudExpansionPanels MultiExpansion="true">
<MudExpansionPanel Text="General settings">
<MudStack Spacing="6">

<NumericSetting @bind-Value="ViewModel.RequestTimeout"
Title="Request timeout (sec)" MinValue="10" MaxValue="120" />

<div class="setting-container">
<MudText>
Chatbot purpose
Expand All @@ -17,51 +13,21 @@
Value="ViewModel.SystemPrompt"/>
</div>

<div class="setting-container">
<div class="flex-row">

<MudText>
Maximum completion tokens
</MudText>
<NumericSetting @bind-Value="ViewModel.MaximumCompletionTokens"
Title="Maximum completion tokens"
Variant="NumericSettingVariant.Optional" />

<MudTextField Class="setting-field"
Margin="Margin.Dense"
Variant="Variant.Outlined"
InputType="InputType.Number"
Value="ViewModel.MaximumCompletionTokens"/>
</div>
</div>


<div class="setting-container">
<div class="flex-row">
<MudText>
Request timeout
</MudText>

<MudTextField Class="setting-field"
Margin="Margin.Dense"
Variant="Variant.Outlined"
Value="@ViewModel.RequestTimeout"/>
</div>
<NumericSetting @bind-Value="ViewModel.RequestTimeout"
Title="Request timeout (sec)"
MinValue="10"
MaxValue="120" />

<MudSlider Min="10" Max="120" Value="@ViewModel.RequestTimeout" Color="Color.Primary"
Variant="Variant.Filled"/>
</div>

<div class="setting-container">
<div class="flex-row">

<MudText>
Context size
</MudText>

<MudTextField Class="setting-field"
Margin="Margin.Dense"
Value="ViewModel.ContextSize"
Variant="Variant.Outlined"/>
</div>
</div>
<NumericSetting @bind-Value="ViewModel.RequestTimeout"
Title="Context size"
MinValue="512"
MaxValue="32768" />
</MudStack>
</MudExpansionPanel>

Expand Down
17 changes: 12 additions & 5 deletions LM-Kit-Maestro/UI/Razor/Components/NumericSetting.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@

<div class="setting-container">
<div class="flex-row">
<MudText>
<MudText Typo="Typo.subtitle2">
@Title
</MudText>

<MudTextField Class="setting-field"
Margin="Margin.Dense"
Variant="MudBlazor.Variant.Outlined"
@onfocusout="OnInputFocusOut"
@onkeydown="OnKeyDown"
Variant="Variant.Outlined"
Value="_inputText" />
@bind-Value="_inputText" />
</div>

<MudSlider T="T" Value="Value" Min="MinValue" Max="MaxValue" Color="Color.Primary"
Variant="Variant.Filled" />
@if (Variant == NumericSettingVariant.Default)
{
<MudSlider T="T"
@bind-Value="Value"
Min="MinValue"
Max="MaxValue"
Color="Color.Primary"
Variant="MudBlazor.Variant.Filled" />
}
</div>
9 changes: 8 additions & 1 deletion LM-Kit-Maestro/UI/Razor/Components/NumericSetting.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class NumericSetting<T> : ComponentBase where T : struct, INumber

[Parameter] public required T MinValue { get; set; }
[Parameter] public required T MaxValue { get; set; }

[Parameter] public NumericSettingVariant Variant { get; set; }

private T _value;

Expand Down Expand Up @@ -65,4 +65,11 @@ private void ValidateSettingValue()
InvokeAsync(() => StateHasChanged());
}
}
}


public enum NumericSettingVariant
{
Default,
Optional
}

0 comments on commit 3876a96

Please sign in to comment.