Skip to content

Commit

Permalink
1. Update the model inference platform to the latest version
Browse files Browse the repository at this point in the history
2. Fix the bug that the configuration item save did not take effect in real time
  • Loading branch information
rnchg committed Aug 15, 2024
1 parent cfcfc51 commit afd2634
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions General.Apt.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<ApplicationIcon>Resources\App.ico</ApplicationIcon>
<Version>2.5.0</Version>
<Version>2.5.1</Version>
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration</InterceptorsPreviewNamespaces>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
Expand Down Expand Up @@ -52,7 +52,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="General.Apt.Service" Version="2.5.0" />
<PackageReference Include="General.Apt.Service" Version="2.5.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.122" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20240616" />
Expand Down
13 changes: 10 additions & 3 deletions ViewModels/Pages/Chat/Gpt/IndexViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ public partial class IndexViewModel : ObservableValidator, INavigationAware

public Action<Paragraph> MessageAction { get; set; }

public int PromptMaxLength => Current.Config.ChatGpt.PromptMaxLength;
[ObservableProperty]
private int _promptMaxLength;
partial void OnPromptMaxLengthChanged(int value)
{
MessageHeader = $"{Language.Instance["ChatGptIndexPageMessage"]} [ {Message.Length}/{value} ]";
}

[ObservableProperty]
private string _messageHeader = $"{Language.Instance["ChatGptIndexPageMessage"]} [ 0 ]";
private string _messageHeader;

[ObservableProperty]
private string _placeholder;
Expand All @@ -34,7 +39,7 @@ public partial class IndexViewModel : ObservableValidator, INavigationAware

partial void OnMessageChanged(string value)
{
MessageHeader = $"{Language.Instance["ChatGptIndexPageMessage"]} [ {value.Length} ]";
MessageHeader = $"{Language.Instance["ChatGptIndexPageMessage"]} [ {value.Length}/{PromptMaxLength} ]";
}

[ObservableProperty]
Expand Down Expand Up @@ -88,6 +93,8 @@ public void OnNavigatedFrom() { }
private void InitializeViewModel()
{
_windowsService = Apt.App.App.Current.GetRequiredService<WindowsProviderService>();
Message = string.Empty;
PromptMaxLength = Current.Config.ChatGpt.PromptMaxLength;
ChatHistory = new ObservableCollection<ChatMessage>();
Task.Run(InitModel);
_isInitialized = true;
Expand Down
5 changes: 2 additions & 3 deletions ViewModels/Windows/Chat/Gpt/ConfigWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public partial class ConfigWindowViewModel : ObservableObject
private string _promptSystem;

[ObservableProperty]
private bool _pastPresentShareBuffer = Current.Config.ChatGpt.PastPresentShareBuffer;
private bool _pastPresentShareBuffer;

[ObservableProperty]
private int _promptMaxLength;
Expand All @@ -27,6 +27,7 @@ private async Task SetSave()
Current.Config.ChatGpt.PastPresentShareBuffer = PastPresentShareBuffer;
Current.Config.ChatGpt.PromptMaxLength = PromptMaxLength;
Current.Config.ChatGpt.ContextMaxLength = ContextMaxLength;
Apt.App.App.Current.GetRequiredService<Pages.Chat.Gpt.IndexViewModel>().PromptMaxLength = Current.Config.ChatGpt.PromptMaxLength;
await Utility.Message.ShowMessageInfo(Language.Instance["ChatGptConfigWindowSetSaveSuccess"]);
CloseAction?.Invoke();
}
Expand All @@ -44,8 +45,6 @@ public ConfigWindowViewModel()

private void InitializeViewModel()
{
PastPresentShareBuffer = Current.Config.ChatGpt.PastPresentShareBuffer;

_isInitialized = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Views/Windows/Chat/Gpt/ConfigWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public void InitializeData()
{
if (!IsVisible) return;
ViewModel.PromptSystem = Current.Config.ChatGpt.PromptSystem;
ViewModel.PastPresentShareBuffer = Current.Config.ChatGpt.PastPresentShareBuffer;
ViewModel.PromptMaxLength = Current.Config.ChatGpt.PromptMaxLength;
ViewModel.ContextMaxLength = Current.Config.ChatGpt.ContextMaxLength;

};
}
}
Expand Down

0 comments on commit afd2634

Please sign in to comment.