fix: bonzy mess

This commit is contained in:
tux
2025-07-04 16:08:41 +05:30
parent a5d179d60d
commit c8f13bd437
6 changed files with 16 additions and 33 deletions

View File

@@ -26,7 +26,6 @@ public partial class ChatUserControl : UserControl
_pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().UseColorCode().Build(); _pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().UseColorCode().Build();
} }
public void StartRecord() public void StartRecord()
{ {
_audioRecorder = new AudioCapture.AudioRecorder(AudioFilePath); _audioRecorder = new AudioCapture.AudioRecorder(AudioFilePath);
@@ -38,7 +37,7 @@ public partial class ChatUserControl : UserControl
if (_audioRecorder != null) if (_audioRecorder != null)
{ {
_audioRecorder.StopRecording(); _audioRecorder.StopRecording();
OnRecordingStopped(null, EventArgs.Empty); // Manually invoke the method after stopping the recording kyuki already in use bata ra hai OnRecordingStopped(null, EventArgs.Empty);
} }
} }
@@ -47,6 +46,7 @@ public partial class ChatUserControl : UserControl
_audioRecorder = null; _audioRecorder = null;
SendAudio(); SendAudio();
} }
public async void SendAudio() public async void SendAudio()
{ {
try try
@@ -79,7 +79,6 @@ public partial class ChatUserControl : UserControl
} }
} }
public async void SendScreenshot() public async void SendScreenshot()
{ {
try try

View File

@@ -5,7 +5,7 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="highminded.ui.controls.SettingsUserControl"> x:Class="highminded.ui.controls.SettingsUserControl">
<Grid Margin="15" RowSpacing="10" ColumnSpacing="10" RowDefinitions="Auto,Auto,Auto,Auto" ColumnDefinitions="*,*"> <Grid Margin="15" RowSpacing="10" ColumnSpacing="10" RowDefinitions="Auto,Auto,Auto,Auto,Auto" ColumnDefinitions="*,*">
<StackPanel Grid.Row="0" Grid.Column="0"> <StackPanel Grid.Row="0" Grid.Column="0">
<TextBlock Text="Model" /> <TextBlock Text="Model" />
@@ -22,12 +22,12 @@
<TextBox Name="ApiKeyTextBox" PasswordChar="*" /> <TextBox Name="ApiKeyTextBox" PasswordChar="*" />
</StackPanel> </StackPanel>
<StackPanel Grid.Row="2" Grid.Column="0"> <StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
<TextBlock Text="Screenshot Prompt" /> <TextBlock Text="Screenshot Prompt" />
<TextBox Name="ScreenshotPromptTextBox" TextWrapping="Wrap"/> <TextBox Name="ScreenshotPromptTextBox" TextWrapping="Wrap"/>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="2" Grid.Column="1"> <StackPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">
<TextBlock Text="Audio Prompt" /> <TextBlock Text="Audio Prompt" />
<TextBox Name="AudioPromptTextbox" TextWrapping="Wrap"/> <TextBox Name="AudioPromptTextbox" TextWrapping="Wrap"/>
</StackPanel> </StackPanel>

View File

@@ -14,6 +14,7 @@ public partial class SettingsUserControl : UserControl
ApiUrlTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ApiURL; ApiUrlTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ApiURL;
ApiKeyTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ApiKey; ApiKeyTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ApiKey;
ScreenshotPromptTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ScreenshotPrompt; ScreenshotPromptTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ScreenshotPrompt;
AudioPromptTextbox.Text = InMemoryDb.Obj.SettingsManager.Settings.AudioPrompt;
} }
private void SaveSettingsBtn_OnClick(object? sender, RoutedEventArgs e) private void SaveSettingsBtn_OnClick(object? sender, RoutedEventArgs e)
@@ -21,7 +22,7 @@ public partial class SettingsUserControl : UserControl
InMemoryDb.Obj.SaveSettings(new AppSettings() InMemoryDb.Obj.SaveSettings(new AppSettings()
{ {
ApiKey = ApiKeyTextBox.Text, ApiURL = ApiUrlTextBox.Text, Model = ModelTextBox.Text, ApiKey = ApiKeyTextBox.Text, ApiURL = ApiUrlTextBox.Text, Model = ModelTextBox.Text,
ScreenshotPrompt = ScreenshotPromptTextBox.Text ScreenshotPrompt = ScreenshotPromptTextBox.Text, AudioPrompt = AudioPromptTextbox.Text
}); });
} }
} }

View File

@@ -45,7 +45,7 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"
Spacing="5" Margin="10 0"> Spacing="5" Margin="10 0">
<TextBlock FontSize="12" Text="Audio:" /> <TextBlock FontSize="12" Text="Audio:" />
<TextBlock FontSize="12" Text="Alt + A | | Alt + Shift + A" /> <TextBlock FontSize="12" Text="SHIFT + A" />
</StackPanel> </StackPanel>
</Border> </Border>
<Button Name="ChatBtn" Background="Transparent" Click="ChatBtnClick"> <Button Name="ChatBtn" Background="Transparent" Click="ChatBtnClick">

View File

@@ -95,21 +95,12 @@ public partial class MainWindow : Window
{ {
Dispatcher.UIThread.Post(() => { _chatUserControl.SendScreenshot(); }); Dispatcher.UIThread.Post(() => { _chatUserControl.SendScreenshot(); });
} }
if (hasAlt && hasA)
if (hasShift && hasA)
{ {
Dispatcher.UIThread.Post(() => { _chatUserControl.StartRecord(); }); Dispatcher.UIThread.Post(() => { _chatUserControl.StartRecord(); });
} }
if (hasAlt && hasShift && hasA)
{
Dispatcher.UIThread.Post(() => { _chatUserControl.StopRecord(); });
}
/* if (hasShift && hasA)
{
Dispatcher.UIThread.Post(() => { _chatUserControl.SendAudio(); });
}*/
if (hasAlt && hasShift && hasQ) if (hasAlt && hasShift && hasQ)
{ {
Dispatcher.UIThread.Post(() => { Environment.Exit(0); }); Dispatcher.UIThread.Post(() => { Environment.Exit(0); });

View File

@@ -1,13 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NAudio.Wave; using NAudio.Wave;
using NAudio.CoreAudioApi;
using System.IO;
using System.Windows.Input;
using static System.Net.Mime.MediaTypeNames;
namespace highminded.utils; namespace highminded.utils;