Documentation
¶
Index ¶
- func SSE() gin.HandlerFunc
- func StreamChunks(c *gin.Context, ch <-chan string) error
- func StreamText(c *gin.Context, ch <-chan string) error
- func StreamWithID(c *gin.Context, messageID string, ch <-chan string) error
- type SSEWriter
- func (w *SSEWriter) KeepAlive() error
- func (w *SSEWriter) Stream(event string, ch <-chan any) error
- func (w *SSEWriter) WriteDone() error
- func (w *SSEWriter) WriteError(err error) error
- func (w *SSEWriter) WriteEvent(event, data string) error
- func (w *SSEWriter) WriteJSON(event string, data any) error
- func (w *SSEWriter) WriteMessage(data string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamChunks ¶
StreamChunks 流式发送文本块(带增量标记)
func StreamText ¶
StreamText 流式发送文本(适用于 AI 对话场景)
Types ¶
type SSEWriter ¶
type SSEWriter struct {
// contains filtered or unexported fields
}
SSEWriter SSE 写入器
func (*SSEWriter) WriteEvent ¶
WriteEvent 写入 SSE 事件 格式: event: <event>\ndata: <data>\n\n
func (*SSEWriter) WriteMessage ¶
WriteMessage 写入消息(无事件类型) 格式: data: <data>\n\n
Click to show internal directories.
Click to hide internal directories.