streaming

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const AnnotationsProp = "annotations"
View Source
const LLMRequesterUserID = "llm_requester_user_id"
View Source
const NoRegen = "no_regen"
View Source
const PostStreamingControlCancel = "cancel"
View Source
const PostStreamingControlEnd = "end"
View Source
const PostStreamingControlStart = "start"
View Source
const ReasoningSignatureProp = "reasoning_signature"
View Source
const ReasoningSummaryProp = "reasoning_summary"
View Source
const RespondingToProp = "responding_to"
View Source
const ToolCallProp = "pending_tool_call"
View Source
const UnsafeLinksPostProp = "unsafe_links"

Variables

View Source
var ErrAlreadyStreamingToPost = fmt.Errorf("already streaming to post")

Functions

func ModifyPostForBot

func ModifyPostForBot(botid string, requesterUserID string, post *model.Post, respondingToPostID string)

ModifyPostForBot modifies a post to add bot-specific properties

Types

type Client added in v1.7.0

type Client interface {
	PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast)
	UpdatePost(post *model.Post) error
	CreatePost(post *model.Post) error
	DM(senderID, receiverID string, post *model.Post) error
	GetUser(userID string) (*model.User, error)
	GetChannel(channelID string) (*model.Channel, error)
	GetConfig() *model.Config
	LogError(msg string, keyValuePairs ...interface{})
	LogDebug(msg string, keyValuePairs ...interface{})
}

Client defines the minimal client interface needed for streaming operations.

type MMPostStreamService

type MMPostStreamService struct {
	// contains filtered or unexported fields
}

func NewMMPostStreamService

func NewMMPostStreamService(mmClient Client, i18n *i18n.Bundle) *MMPostStreamService

func (*MMPostStreamService) FinishStreaming

func (p *MMPostStreamService) FinishStreaming(postID string)

FinishStreaming should be called when a post streaming operation is finished on success or failure. It is safe to call multiple times, must be called at least once.

func (*MMPostStreamService) GetStreamingContext

func (p *MMPostStreamService) GetStreamingContext(inCtx context.Context, postID string) (context.Context, error)

func (*MMPostStreamService) StopStreaming

func (p *MMPostStreamService) StopStreaming(postID string)

func (*MMPostStreamService) StreamToNewDM

func (p *MMPostStreamService) StreamToNewDM(ctx context.Context, botID string, stream *llm.TextStreamResult, userID string, post *model.Post, respondingToPostID string) error

func (*MMPostStreamService) StreamToNewPost

func (p *MMPostStreamService) StreamToNewPost(ctx context.Context, botID string, requesterUserID string, stream *llm.TextStreamResult, post *model.Post, respondingToPostID string) error

func (*MMPostStreamService) StreamToPost

func (p *MMPostStreamService) StreamToPost(ctx context.Context, stream *llm.TextStreamResult, post *model.Post, userLocale string)

StreamToPost streams the result of a TextStreamResult to a post. it will internally handle logging needs and updating the post.

type Service

type Service interface {
	StreamToNewPost(ctx context.Context, botID string, requesterUserID string, stream *llm.TextStreamResult, post *model.Post, respondingToPostID string) error
	StreamToNewDM(ctx context.Context, botID string, stream *llm.TextStreamResult, userID string, post *model.Post, respondingToPostID string) error
	StreamToPost(ctx context.Context, stream *llm.TextStreamResult, post *model.Post, userLocale string)
	StopStreaming(postID string)
	GetStreamingContext(inCtx context.Context, postID string) (context.Context, error)
	FinishStreaming(postID string)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL