feat: enhance IM integration with streaming support and documentation

- add StreamSender interface and streaming output for WeCom/Feishu
- refactor WeCom adapter into separate webhook and websocket files
- add output_mode config for stream/full toggle per platform
- add stream flush batching, dedup cleanup, and think-block filtering
- improve context template to handle irrelevant retrieved info gracefully
- add IM streaming integration tests
- add IM integration documentation with quick start guide
This commit is contained in:
nullkey
2026-03-15 20:42:50 +08:00
committed by lyingbug
parent 9fa969fb5c
commit f16aa12822
12 changed files with 1532 additions and 70 deletions
+15
View File
@@ -74,3 +74,18 @@ type Adapter interface {
// Returns true if this request is a verification request and has been handled.
HandleURLVerification(c *gin.Context) bool
}
// StreamSender is an optional interface that adapters can implement to support streaming replies.
// When an adapter implements StreamSender, the IM service will push answer chunks in real-time
// instead of waiting for the full answer.
type StreamSender interface {
// StartStream initializes a streaming reply session (e.g., creates a streaming card).
// Returns a platform-specific stream ID for subsequent chunk/end calls.
StartStream(ctx context.Context, incoming *IncomingMessage) (string, error)
// SendStreamChunk appends a content chunk to an ongoing stream.
SendStreamChunk(ctx context.Context, incoming *IncomingMessage, streamID string, content string) error
// EndStream finalizes a streaming reply.
EndStream(ctx context.Context, incoming *IncomingMessage, streamID string) error
}