Skip to content

Commit

Permalink
fix: Добавил normalizedText в asr
Browse files Browse the repository at this point in the history
  • Loading branch information
sasha-tlt committed Feb 24, 2025
1 parent 0cf50d3 commit 53737af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/assistantSdk/assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export type AppEvent =
};

export type AssistantEvent = {
asr?: { text: string; last?: boolean; mid?: OriginalMessageType['messageId'] }; // last и mid нужен для отправки исх бабла в чат
asr?: { text: string; normalizedText: string; last?: boolean; mid?: OriginalMessageType['messageId'] }; // last и mid нужен для отправки исх бабла в чат
/**
* @deprecated Use the `on('assistant', { listener })` and `on('tts', tts)` subscriptions to receive voice events
*/
Expand Down
6 changes: 4 additions & 2 deletions src/assistantSdk/voice/voice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const createVoice = (
client: ReturnType<typeof createClient>,
settings: MutexedObject<AssistantSettings>,
emit: (event: {
asr?: { text: string; last?: boolean; mid?: OriginalMessageType['messageId'] }; // last и mid нужен для отправки исх бабла в чат
asr?: { text: string; normalizedText: string; last?: boolean; mid?: OriginalMessageType['messageId'] }; // last и mid нужен для отправки исх бабла в чат
emotion?: EmotionId;
listener?: { status: VoiceListenerStatus };
mtt?: { response: Music2TrackProtocol.MttResponse; mid: OriginalMessageType['messageId'] };
Expand Down Expand Up @@ -339,7 +339,7 @@ export const createVoice = (
emit({ emotion: 'listen' });
} else if (status === 'stopped') {
voicePlayer?.setActive(!settings.current.disableDubbing);
emit({ asr: { text: '' }, emotion: 'idle' });
emit({ asr: { text: '', normalizedText: '' }, emotion: 'idle' });
}
}),

Expand Down Expand Up @@ -385,6 +385,7 @@ export const createVoice = (
asr: {
mid: originalMessage.messageId,
text: text.data || '',
normalizedText: response?.decoderResultField?.hypothesis?.[0]?.normalizedText || '',
last: originalMessage.last === 1,
},
});
Expand All @@ -404,6 +405,7 @@ export const createVoice = (
asr: {
mid: originalMessage.messageId,
text: decoderResultField.hypothesis[0].normalizedText || '',
normalizedText: decoderResultField.hypothesis[0].normalizedText || '',
last: !!(decoderResultField && decoderResultField?.isFinal),
},
});
Expand Down

0 comments on commit 53737af

Please sign in to comment.