This commit is contained in:
2026-01-26 18:43:07 +08:00
parent 6a177ceebc
commit a22599feda
4 changed files with 241 additions and 27 deletions

View File

@@ -0,0 +1,40 @@
//
// KBVoiceToTextManager.h
// keyBoard
//
// Created by Mac on 2026/1/26.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class KBVoiceInputBar;
@class KBVoiceToTextManager;
@protocol KBVoiceToTextManagerDelegate <NSObject>
@optional
- (void)voiceToTextManagerDidBeginRecording:(KBVoiceToTextManager *)manager;
- (void)voiceToTextManagerDidEndRecording:(KBVoiceToTextManager *)manager;
- (void)voiceToTextManagerDidCancelRecording:(KBVoiceToTextManager *)manager;
- (void)voiceToTextManager:(KBVoiceToTextManager *)manager
didUpdateInterimText:(NSString *)text;
- (void)voiceToTextManager:(KBVoiceToTextManager *)manager
didReceiveFinalText:(NSString *)text;
- (void)voiceToTextManager:(KBVoiceToTextManager *)manager
didFailWithError:(NSError *)error;
@end
/// Voice-to-text manager (binds KBVoiceInputBar and uses Deepgram).
@interface KBVoiceToTextManager : NSObject
@property(nonatomic, weak) id<KBVoiceToTextManagerDelegate> delegate;
@property(nonatomic, weak, readonly) KBVoiceInputBar *inputBar;
- (instancetype)initWithInputBar:(KBVoiceInputBar *)inputBar;
- (void)prepareConnection;
- (void)disconnect;
@end
NS_ASSUME_NONNULL_END