Skip to content

Commit 419ceee

Browse files
committed
add remind config
1 parent 6e2b5b0 commit 419ceee

12 files changed

Lines changed: 2947 additions & 50 deletions

AdaptiveGoalManager.cs

Lines changed: 567 additions & 0 deletions
Large diffs are not rendered by default.

ConversationRecorder.cs

Lines changed: 459 additions & 0 deletions
Large diffs are not rendered by default.

EnhancedAudioCaptureService.cs

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,14 @@ private void HandleRecognizedText(string rawText, float confidence, string sourc
10181018
MarkRecognizingState();
10191019

10201020
VoiceRuntimeLog.Info($"Recognized({source}) conf={confidence:F2} text={text}");
1021+
VoiceListenerStatusCenter.PublishRecognition(new VoiceRecognitionRecord
1022+
{
1023+
Text = text,
1024+
Confidence = ClampConfidence(confidence),
1025+
Source = source,
1026+
CapturedAtUtc = DateTime.UtcNow,
1027+
AudioPcm16Mono = SnapshotSpeechPcm()
1028+
});
10211029

10221030
bool isSystemFallback = _classicFallbackEnabled && string.Equals(source, "system-speech", StringComparison.OrdinalIgnoreCase);
10231031
double taskLikelihood = _intentRecognizer.ScoreTaskLikelihood(text);
@@ -1059,6 +1067,17 @@ private void HandleRecognizedText(string rawText, float confidence, string sourc
10591067
TryExtractConversationTasksAsync();
10601068
}
10611069

1070+
private byte[] SnapshotSpeechPcm()
1071+
{
1072+
lock (_speechBuffer)
1073+
{
1074+
if (_speechBuffer.Count == 0)
1075+
return null;
1076+
1077+
return _speechBuffer.ToArray();
1078+
}
1079+
}
1080+
10621081
private bool IsDuplicateRecognition(string text)
10631082
{
10641083
if (string.IsNullOrWhiteSpace(_lastRecognizedText))
@@ -1250,16 +1269,13 @@ private void CaptureSpeechBufferIfNeeded(byte[] buffer, int bytesRecorded)
12501269
if (!_isRecording || buffer == null || bytesRecorded <= 0)
12511270
return;
12521271

1253-
if (_speakerVerifyEnabled)
1272+
lock (_speechBuffer)
12541273
{
1255-
lock (_speechBuffer)
1274+
int maxBytes = (int)(16000 * 2 * 20); // ~20s
1275+
int copy = Math.Min(bytesRecorded, maxBytes - _speechBuffer.Count);
1276+
if (copy > 0)
12561277
{
1257-
int maxBytes = (int)(16000 * 2 * 6); // ~6s
1258-
int copy = Math.Min(bytesRecorded, maxBytes - _speechBuffer.Count);
1259-
if (copy > 0)
1260-
{
1261-
for (int i = 0; i < copy; i++) _speechBuffer.Add(buffer[i]);
1262-
}
1278+
for (int i = 0; i < copy; i++) _speechBuffer.Add(buffer[i]);
12631279
}
12641280
}
12651281

@@ -1280,6 +1296,13 @@ private void CaptureSpeechBufferIfNeeded(byte[] buffer, int bytesRecorded)
12801296
private void EvaluateCompletedSegment(WaveFormat format)
12811297
{
12821298
EvaluateSpeakerSegment(format);
1299+
if (!_speakerVerifyEnabled)
1300+
{
1301+
lock (_speechBuffer)
1302+
{
1303+
_speechBuffer.Clear();
1304+
}
1305+
}
12831306
if (_funAsrEnabled)
12841307
{
12851308
TryRecognizeSegmentWithFunAsr(format);

MainWindow.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<Grid.ColumnDefinitions>
4444
<ColumnDefinition Width="*" />
4545
<ColumnDefinition Width="Auto" />
46+
<ColumnDefinition Width="Auto" />
4647
</Grid.ColumnDefinitions>
4748
<SelectiveScrollingGrid Grid.Column="0">
4849
<SelectiveScrollingGrid.ColumnDefinitions>
@@ -57,7 +58,8 @@
5758
<DataGridDetailsPresenter Grid.Column="1" Grid.Row="1" SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Visibility="{TemplateBinding DetailsVisibility}"/>
5859
<DataGridRowHeader Grid.RowSpan="2" SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
5960
</SelectiveScrollingGrid>
60-
<Button x:Name="PART_DeleteButton" Grid.Column="1" Content="X" Width="20" Height="20" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-2,-2,0" Click="DeleteTaskRow_Click" Background="Transparent" BorderBrush="{x:Null}" FontWeight="Bold" Foreground="Gray"/>
61+
<Button x:Name="PART_ReminderButton" Grid.Column="1" Content="" Width="20" Height="20" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-2,2,0" Click="EditReminderTime_Click" Background="Transparent" BorderBrush="{x:Null}" FontWeight="Bold" Foreground="Gray" ToolTip="编辑提醒时间"/>
62+
<Button x:Name="PART_DeleteButton" Grid.Column="2" Content="X" Width="20" Height="20" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-2,-2,0" Click="DeleteTaskRow_Click" Background="Transparent" BorderBrush="{x:Null}" FontWeight="Bold" Foreground="Gray"/>
6163
</Grid>
6264
</Border>
6365
<ControlTemplate.Triggers>

0 commit comments

Comments
 (0)