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
|
14
App.axaml
14
App.axaml
@ -1,12 +1,12 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="app.App"
|
||||
xmlns:local="using:app"
|
||||
RequestedThemeVariant="Default">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
<Application
|
||||
x:Class="app.App"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:app"
|
||||
RequestedThemeVariant="Dark">
|
||||
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator/>
|
||||
<local:ViewLocator />
|
||||
</Application.DataTemplates>
|
||||
|
||||
<Application.Styles>
|
||||
|
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;
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.WebSockets;
|
||||
using Avalonia.Controls;
|
||||
using app.Models;
|
||||
using app.Views;
|
||||
@ -17,6 +19,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
set => SetProperty(ref _currentView, value);
|
||||
}
|
||||
private ConfigModel config { get; set; }
|
||||
private ClientWebSocket ws { get; set; }
|
||||
public string ActionButtonText { get; set; } = "Start Conversation";
|
||||
public string ApiKey { get; set; }
|
||||
public string SpeakModel { get; set; }
|
||||
@ -48,6 +51,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
ws = new();
|
||||
config = GetConfig();
|
||||
ApiKey = config.ApiKey;
|
||||
SpeakModel = config.SpeakModel;
|
||||
@ -58,7 +62,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
CurrentView = new ConfigWindow();
|
||||
return;
|
||||
}
|
||||
CurrentView = new AgentWindow();
|
||||
CurrentView = new HomeWindow();
|
||||
}
|
||||
private static string ConfigPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/.config/deepgram-voice-assistant";
|
||||
private static string ConfigFilePath = ConfigPath + "/config.json";
|
||||
@ -115,7 +119,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
ThinkModel = thinkModel
|
||||
};
|
||||
UpdateConfig(config);
|
||||
CurrentView = new AgentWindow();
|
||||
CurrentView = new HomeWindow();
|
||||
}
|
||||
|
||||
public void OpenConfig()
|
||||
@ -123,19 +127,14 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
CurrentView = new ConfigWindow();
|
||||
}
|
||||
|
||||
public void ToggleConversation() {
|
||||
if (ActionButtonText == "Start Conversation") {
|
||||
StartConversation();
|
||||
} else {
|
||||
EndConversation();
|
||||
}
|
||||
public async Task StartAgent() {
|
||||
// ws.Options.SetRequestHeader("Authorization", "token " + config.ApiKey);
|
||||
// await ws.ConnectAsync(new Uri("wss://agent.deepgram.com/agent"), System.Threading.CancellationToken.None);
|
||||
CurrentView = new AgentWindow();
|
||||
}
|
||||
|
||||
public void StartConversation() {
|
||||
ActionButtonText = "End Conversation";
|
||||
}
|
||||
|
||||
public void EndConversation() {
|
||||
ActionButtonText = "Start Conversation";
|
||||
public async Task EndConversation() {
|
||||
CurrentView = new HomeWindow();
|
||||
// await ws.CloseAsync(WebSocketCloseStatus.NormalClosure, "Conversation ended", System.Threading.CancellationToken.None);
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,7 @@
|
||||
<StackPanel>
|
||||
<TextBlock Text="Deepgram Voice Agent" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Grid ShowGridLines="False" Margin="5" ColumnDefinitions="Auto, Auto" RowDefinitions="Auto, Auto, Auto, Auto">
|
||||
<ToggleButton Grid.Row="0" Grid.Column="0" Command="{Binding ToggleConversation}">
|
||||
<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>
|
||||
<Button Grid.Row="0" Grid.Column="0" Command="{Binding EndConversation}">End Conversation</Button>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
@ -1,6 +1,4 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using System;
|
||||
|
||||
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"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
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>
|
||||
<!-- 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