feat(channels): add streaming response hooks to ChannelBase

- Add onResponseChunk hook for progressive text display during streaming
- Add onResponseComplete hook for customizing response delivery
- Update mock plugin channel to support streaming chunks

This enables channels to display AI responses progressively as they stream,
improving user experience with real-time feedback.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
tanzhenxin 2026-03-27 14:08:09 +00:00
parent 0ca8cf86f6
commit f7979aa902
4 changed files with 117 additions and 17 deletions

View file

@ -12,7 +12,15 @@ export interface InboundMessage {
text: string;
}
/** Plugin Channel → Server (WebSocket) */
/** Plugin Channel → Server (WebSocket) — streaming chunk */
export interface ChunkMessage {
type: 'chunk';
messageId: string;
chatId: string;
text: string;
}
/** Plugin Channel → Server (WebSocket) — final response */
export interface OutboundMessage {
type: 'outbound';
messageId: string;
@ -20,4 +28,4 @@ export interface OutboundMessage {
text: string;
}
export type WsMessage = InboundMessage | OutboundMessage;
export type WsMessage = InboundMessage | ChunkMessage | OutboundMessage;