1
This commit is contained in:
53
keyBoard/Class/AiTalk/VM/VoiceChatStreamingManager.h
Normal file
53
keyBoard/Class/AiTalk/VM/VoiceChatStreamingManager.h
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// VoiceChatStreamingManager.h
|
||||
// keyBoard
|
||||
//
|
||||
// Created by Mac on 2026/1/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol VoiceChatStreamingManagerDelegate <NSObject>
|
||||
@optional
|
||||
- (void)voiceChatStreamingManagerDidConnect;
|
||||
- (void)voiceChatStreamingManagerDidDisconnect:(NSError *_Nullable)error;
|
||||
- (void)voiceChatStreamingManagerDidStartSession:(NSString *)sessionId;
|
||||
- (void)voiceChatStreamingManagerDidStartTurn:(NSInteger)turnIndex;
|
||||
- (void)voiceChatStreamingManagerDidReceiveEagerEndOfTurnWithTranscript:(NSString *)text
|
||||
confidence:(double)confidence;
|
||||
- (void)voiceChatStreamingManagerDidResumeTurn;
|
||||
- (void)voiceChatStreamingManagerDidUpdateRMS:(float)rms;
|
||||
- (void)voiceChatStreamingManagerDidReceiveInterimTranscript:(NSString *)text;
|
||||
- (void)voiceChatStreamingManagerDidReceiveFinalTranscript:(NSString *)text;
|
||||
- (void)voiceChatStreamingManagerDidReceiveLLMStart;
|
||||
- (void)voiceChatStreamingManagerDidReceiveLLMToken:(NSString *)token;
|
||||
- (void)voiceChatStreamingManagerDidReceiveAudioChunk:(NSData *)audioData;
|
||||
- (void)voiceChatStreamingManagerDidCompleteWithTranscript:(NSString *)transcript
|
||||
aiResponse:(NSString *)aiResponse;
|
||||
- (void)voiceChatStreamingManagerDidFail:(NSError *)error;
|
||||
@end
|
||||
|
||||
/// Manager for realtime recording and streaming.
|
||||
@interface VoiceChatStreamingManager : NSObject
|
||||
|
||||
@property(nonatomic, weak) id<VoiceChatStreamingManagerDelegate> delegate;
|
||||
|
||||
/// Base WebSocket URL, e.g. wss://api.yourdomain.com/api/ws/chat
|
||||
@property(nonatomic, copy) NSString *serverURL;
|
||||
|
||||
@property(nonatomic, assign, readonly, getter=isStreaming) BOOL streaming;
|
||||
@property(nonatomic, copy, readonly, nullable) NSString *sessionId;
|
||||
|
||||
- (void)startWithToken:(NSString *)token
|
||||
language:(nullable NSString *)language
|
||||
voiceId:(nullable NSString *)voiceId;
|
||||
|
||||
- (void)stopAndFinalize;
|
||||
- (void)cancel;
|
||||
- (void)disconnect;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Reference in New Issue
Block a user