feat: prep for agent release
This commit is contained in:
parent
fa1aaff5fe
commit
c95c5bae38
2
.gitignore
vendored
2
.gitignore
vendored
@ -0,0 +1,2 @@
|
|||||||
|
/bin
|
||||||
|
/obj
|
18
App.axaml
18
App.axaml
@ -1,15 +1,15 @@
|
|||||||
<Application xmlns="https://github.com/avaloniaui"
|
<Application
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
x:Class="app.App"
|
||||||
x:Class="app.App"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:local="using:app"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
RequestedThemeVariant="Default">
|
xmlns:local="using:app"
|
||||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
RequestedThemeVariant="Dark">
|
||||||
|
|
||||||
<Application.DataTemplates>
|
<Application.DataTemplates>
|
||||||
<local:ViewLocator/>
|
<local:ViewLocator />
|
||||||
</Application.DataTemplates>
|
</Application.DataTemplates>
|
||||||
|
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
<FluentTheme />
|
<FluentTheme />
|
||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
</Application>
|
</Application>
|
||||||
|
10
Styles.axaml
10
Styles.axaml
@ -1,10 +0,0 @@
|
|||||||
<Styles xmlns="https://github.com/avaloniaui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
||||||
<Design.PreviewWith>
|
|
||||||
<Border Padding="20">
|
|
||||||
<!-- Add Controls for Previewer Here -->
|
|
||||||
</Border>
|
|
||||||
</Design.PreviewWith>
|
|
||||||
|
|
||||||
<!-- Add Styles Here -->
|
|
||||||
</Styles>
|
|
7
ViewModels/HomeWindowViewModel.cs
Normal file
7
ViewModels/HomeWindowViewModel.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace app.ViewModels;
|
||||||
|
|
||||||
|
public partial class HomeWindowViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,9 +1,11 @@
|
|||||||
namespace app.ViewModels;
|
namespace app.ViewModels;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Net.WebSockets;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using app.Models;
|
using app.Models;
|
||||||
using app.Views;
|
using app.Views;
|
||||||
@ -17,6 +19,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
set => SetProperty(ref _currentView, value);
|
set => SetProperty(ref _currentView, value);
|
||||||
}
|
}
|
||||||
private ConfigModel config { get; set; }
|
private ConfigModel config { get; set; }
|
||||||
|
private ClientWebSocket ws { get; set; }
|
||||||
public string ActionButtonText { get; set; } = "Start Conversation";
|
public string ActionButtonText { get; set; } = "Start Conversation";
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; }
|
||||||
public string SpeakModel { get; set; }
|
public string SpeakModel { get; set; }
|
||||||
@ -48,6 +51,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
|
|
||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
{
|
{
|
||||||
|
ws = new();
|
||||||
config = GetConfig();
|
config = GetConfig();
|
||||||
ApiKey = config.ApiKey;
|
ApiKey = config.ApiKey;
|
||||||
SpeakModel = config.SpeakModel;
|
SpeakModel = config.SpeakModel;
|
||||||
@ -58,7 +62,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
CurrentView = new ConfigWindow();
|
CurrentView = new ConfigWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CurrentView = new AgentWindow();
|
CurrentView = new HomeWindow();
|
||||||
}
|
}
|
||||||
private static string ConfigPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/.config/deepgram-voice-assistant";
|
private static string ConfigPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/.config/deepgram-voice-assistant";
|
||||||
private static string ConfigFilePath = ConfigPath + "/config.json";
|
private static string ConfigFilePath = ConfigPath + "/config.json";
|
||||||
@ -115,7 +119,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
ThinkModel = thinkModel
|
ThinkModel = thinkModel
|
||||||
};
|
};
|
||||||
UpdateConfig(config);
|
UpdateConfig(config);
|
||||||
CurrentView = new AgentWindow();
|
CurrentView = new HomeWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenConfig()
|
public void OpenConfig()
|
||||||
@ -123,19 +127,14 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
CurrentView = new ConfigWindow();
|
CurrentView = new ConfigWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleConversation() {
|
public async Task StartAgent() {
|
||||||
if (ActionButtonText == "Start Conversation") {
|
// ws.Options.SetRequestHeader("Authorization", "token " + config.ApiKey);
|
||||||
StartConversation();
|
// await ws.ConnectAsync(new Uri("wss://agent.deepgram.com/agent"), System.Threading.CancellationToken.None);
|
||||||
} else {
|
CurrentView = new AgentWindow();
|
||||||
EndConversation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartConversation() {
|
public async Task EndConversation() {
|
||||||
ActionButtonText = "End Conversation";
|
CurrentView = new HomeWindow();
|
||||||
}
|
// await ws.CloseAsync(WebSocketCloseStatus.NormalClosure, "Conversation ended", System.Threading.CancellationToken.None);
|
||||||
|
|
||||||
public void EndConversation() {
|
|
||||||
ActionButtonText = "Start Conversation";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,7 @@
|
|||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Deepgram Voice Agent" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<TextBlock Text="Deepgram Voice Agent" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
<Grid ShowGridLines="False" Margin="5" ColumnDefinitions="Auto, Auto" RowDefinitions="Auto, Auto, Auto, Auto">
|
<Grid ShowGridLines="False" Margin="5" ColumnDefinitions="Auto, Auto" RowDefinitions="Auto, Auto, Auto, Auto">
|
||||||
<ToggleButton Grid.Row="0" Grid.Column="0" Command="{Binding ToggleConversation}">
|
<Button Grid.Row="0" Grid.Column="0" Command="{Binding EndConversation}">End Conversation</Button>
|
||||||
<Panel>
|
|
||||||
<TextBlock Classes="start" Text="Start Listening"/>
|
|
||||||
<TextBlock Classes="stop" Text="Stop Listening"/>
|
|
||||||
</Panel>
|
|
||||||
</ToggleButton>
|
|
||||||
<Button Grid.Row="1" Grid.Column="0" Command="{Binding OpenConfig}">Edit Configuration</Button>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
@ -1,6 +1,4 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace app.Views;
|
namespace app.Views;
|
||||||
|
|
||||||
|
13
Views/HomeWindow.axaml
Normal file
13
Views/HomeWindow.axaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="using:app.ViewModels"
|
||||||
|
x:DataType="vm:MainWindowViewModel"
|
||||||
|
x:Class="app.Views.HomeWindow">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="Deepgram Voice Agent" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
<Grid ShowGridLines="False" Margin="5" ColumnDefinitions="Auto, Auto" RowDefinitions="Auto, Auto, Auto, Auto">
|
||||||
|
<Button Grid.Row="0" Grid.Column="0" Command="{Binding StartAgent}">Start Agent</Button>
|
||||||
|
<Button Grid.Row="1" Grid.Column="0" Command="{Binding OpenConfig}">Edit Configuration</Button>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
11
Views/HomeWindow.axaml.cs
Normal file
11
Views/HomeWindow.axaml.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace app.Views;
|
||||||
|
|
||||||
|
public partial class HomeWindow : UserControl
|
||||||
|
{
|
||||||
|
public HomeWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
@ -8,20 +8,6 @@
|
|||||||
x:DataType="vm:MainWindowViewModel"
|
x:DataType="vm:MainWindowViewModel"
|
||||||
Icon="/Assets/avalonia-logo.ico"
|
Icon="/Assets/avalonia-logo.ico"
|
||||||
Title="Deepgram Voice Assistant">
|
Title="Deepgram Voice Assistant">
|
||||||
<Window.Styles>
|
|
||||||
<Style Selector="ToggleButton .start">
|
|
||||||
<Setter Property="IsVisible" Value="False"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="ToggleButton:checked .start">
|
|
||||||
<Setter Property="IsVisible" Value="True"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="ToggleButton .stop">
|
|
||||||
<Setter Property="IsVisible" Value="True"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="ToggleButton:checked .stop">
|
|
||||||
<Setter Property="IsVisible" Value="False"/>
|
|
||||||
</Style>
|
|
||||||
</Window.Styles>
|
|
||||||
|
|
||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||||
|
24
linux-voice-assistant.sln
Normal file
24
linux-voice-assistant.sln
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.5.2.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "app", "app.csproj", "{4195E981-2360-7259-32C6-BB2CA129A715}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{4195E981-2360-7259-32C6-BB2CA129A715}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4195E981-2360-7259-32C6-BB2CA129A715}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4195E981-2360-7259-32C6-BB2CA129A715}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4195E981-2360-7259-32C6-BB2CA129A715}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {7CAB8223-BDA9-44EA-9FB2-675BF9E2D383}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
Loading…
x
Reference in New Issue
Block a user