mirror of
https://github.com/tuxdotrs/highminded.git
synced 2025-08-22 23:51:03 +05:30
fix: bonzy mess
This commit is contained in:
@@ -25,7 +25,6 @@ public partial class ChatUserControl : UserControl
|
||||
InitializeComponent();
|
||||
_pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().UseColorCode().Build();
|
||||
}
|
||||
|
||||
|
||||
public void StartRecord()
|
||||
{
|
||||
@@ -38,15 +37,16 @@ public partial class ChatUserControl : UserControl
|
||||
if (_audioRecorder != null)
|
||||
{
|
||||
_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);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRecordingStopped(object? sender, EventArgs e)
|
||||
{
|
||||
_audioRecorder = null;
|
||||
SendAudio();
|
||||
SendAudio();
|
||||
}
|
||||
|
||||
public async void SendAudio()
|
||||
{
|
||||
try
|
||||
@@ -54,11 +54,11 @@ public partial class ChatUserControl : UserControl
|
||||
if (!File.Exists("output.wav"))
|
||||
throw new Exception("Audio file not found");
|
||||
|
||||
|
||||
var timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||
var fileName = "output.wav";
|
||||
var destPath = Path.Combine(Environment.CurrentDirectory, fileName);
|
||||
File.Copy("output.wav", destPath, true);
|
||||
|
||||
var timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||
var fileName = "output.wav";
|
||||
var destPath = Path.Combine(Environment.CurrentDirectory, fileName);
|
||||
File.Copy("output.wav", destPath, true);
|
||||
|
||||
await using Stream audioStream = File.OpenRead("output.wav");
|
||||
var audioBytes = await BinaryData.FromStreamAsync(audioStream);
|
||||
@@ -79,7 +79,6 @@ public partial class ChatUserControl : UserControl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async void SendScreenshot()
|
||||
{
|
||||
try
|
||||
|
@@ -5,7 +5,7 @@
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
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">
|
||||
<TextBlock Text="Model" />
|
||||
@@ -22,12 +22,12 @@
|
||||
<TextBox Name="ApiKeyTextBox" PasswordChar="*" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="0">
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
|
||||
<TextBlock Text="Screenshot Prompt" />
|
||||
<TextBox Name="ScreenshotPromptTextBox" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="1">
|
||||
<StackPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">
|
||||
<TextBlock Text="Audio Prompt" />
|
||||
<TextBox Name="AudioPromptTextbox" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
|
@@ -14,6 +14,7 @@ public partial class SettingsUserControl : UserControl
|
||||
ApiUrlTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ApiURL;
|
||||
ApiKeyTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ApiKey;
|
||||
ScreenshotPromptTextBox.Text = InMemoryDb.Obj.SettingsManager.Settings.ScreenshotPrompt;
|
||||
AudioPromptTextbox.Text = InMemoryDb.Obj.SettingsManager.Settings.AudioPrompt;
|
||||
}
|
||||
|
||||
private void SaveSettingsBtn_OnClick(object? sender, RoutedEventArgs e)
|
||||
@@ -21,7 +22,7 @@ public partial class SettingsUserControl : UserControl
|
||||
InMemoryDb.Obj.SaveSettings(new AppSettings()
|
||||
{
|
||||
ApiKey = ApiKeyTextBox.Text, ApiURL = ApiUrlTextBox.Text, Model = ModelTextBox.Text,
|
||||
ScreenshotPrompt = ScreenshotPromptTextBox.Text
|
||||
ScreenshotPrompt = ScreenshotPromptTextBox.Text, AudioPrompt = AudioPromptTextbox.Text
|
||||
});
|
||||
}
|
||||
}
|
@@ -45,7 +45,7 @@
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Spacing="5" Margin="10 0">
|
||||
<TextBlock FontSize="12" Text="Audio:" />
|
||||
<TextBlock FontSize="12" Text="Alt + A | | Alt + Shift + A" />
|
||||
<TextBlock FontSize="12" Text="SHIFT + A" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Button Name="ChatBtn" Background="Transparent" Click="ChatBtnClick">
|
||||
|
@@ -95,21 +95,12 @@ public partial class MainWindow : Window
|
||||
{
|
||||
Dispatcher.UIThread.Post(() => { _chatUserControl.SendScreenshot(); });
|
||||
}
|
||||
if (hasAlt && hasA)
|
||||
|
||||
if (hasShift && hasA)
|
||||
{
|
||||
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)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() => { Environment.Exit(0); });
|
||||
|
@@ -1,13 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NAudio.Wave;
|
||||
using NAudio.CoreAudioApi;
|
||||
using System.IO;
|
||||
using System.Windows.Input;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace highminded.utils;
|
||||
|
||||
|
Reference in New Issue
Block a user