Documentation
¶
Index ¶
- Constants
- Variables
- func ModifyPostForBot(botid string, requesterUserID string, post *model.Post, ...)
- type Client
- type MMPostStreamService
- func (p *MMPostStreamService) FinishStreaming(postID string)
- func (p *MMPostStreamService) GetStreamingContext(inCtx context.Context, postID string) (context.Context, error)
- func (p *MMPostStreamService) SetTurnStore(ts TurnStore)
- func (p *MMPostStreamService) StopStreaming(postID string)
- func (p *MMPostStreamService) StreamContinuationToPost(ctx context.Context, stream *llm.TextStreamResult, post *model.Post, ...)
- func (p *MMPostStreamService) StreamToNewDM(ctx context.Context, botID string, stream *llm.TextStreamResult, userID string, ...) error
- func (p *MMPostStreamService) StreamToNewPost(ctx context.Context, botID string, requesterUserID string, ...) error
- func (p *MMPostStreamService) StreamToPost(ctx context.Context, stream *llm.TextStreamResult, post *model.Post, ...)
- type Service
- type TurnStore
Constants ¶
const ConversationIDProp = "conversation_id"
const LLMRequesterUserIDProp = "llm_requester_user_id"
LLMRequesterUserIDProp is a compatibility bridge for the meeting summarization flow, which still produces custom_llmbot posts without a conversation entity. Ownership for conversation-backed posts should be resolved via ConversationIDProp and the conversation row's UserID; this prop should only be consulted as a fallback when no conversation_id is present. Remove once meeting flows migrate.
const NoRegen = "no_regen"
const PostStreamingControlCancel = "cancel"
const PostStreamingControlContinue = "continue"
PostStreamingControlContinue signals a tool-approval resume stream onto a post that already has content. The webapp clears the visible message but keeps the resolved tool cards.
const PostStreamingControlEnd = "end"
const PostStreamingControlStart = "start"
const RespondingToProp = "responding_to"
const UnsafeLinksPostProp = "unsafe_links"
const WebSearchContextProp = "web_search_context"
WebSearchContextProp is still read by conversations/web_search_context.go when extracting web search state from legacy thread posts.
Variables ¶
var ErrAlreadyStreamingToPost = fmt.Errorf("already streaming to post")
Functions ¶
Types ¶
type Client ¶
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
KVSet(key string, value interface{}) error
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 (*MMPostStreamService) SetTurnStore ¶
func (p *MMPostStreamService) SetTurnStore(ts TurnStore)
SetTurnStore sets the store used for persisting assistant turns. When nil (the default), turn persistence is silently skipped.
func (*MMPostStreamService) StopStreaming ¶
func (p *MMPostStreamService) StopStreaming(postID string)
func (*MMPostStreamService) StreamContinuationToPost ¶
func (p *MMPostStreamService) StreamContinuationToPost(ctx context.Context, stream *llm.TextStreamResult, post *model.Post, userLocale string, requesterUserID string)
func (*MMPostStreamService) StreamToNewDM ¶
func (*MMPostStreamService) StreamToNewPost ¶
func (*MMPostStreamService) StreamToPost ¶
func (p *MMPostStreamService) StreamToPost(ctx context.Context, stream *llm.TextStreamResult, post *model.Post, userLocale string, requesterUserID string)
StreamToPost streams a fresh response onto a post (first stream or regen, where the caller has already scrubbed prior turns). For tool-approval resume use StreamContinuationToPost.
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, requesterUserID string)
// StreamContinuationToPost streams a follow-up round onto a post that
// already has an assistant turn (tool-approval resume). Finalize demotes
// the prior anchor so both rounds render. Do not use for regeneration.
StreamContinuationToPost(ctx context.Context, stream *llm.TextStreamResult, post *model.Post, userLocale string, requesterUserID string)
StopStreaming(postID string)
GetStreamingContext(inCtx context.Context, postID string) (context.Context, error)
FinishStreaming(postID string)
}
type TurnStore ¶
type TurnStore interface {
CreateTurnAutoSequence(turn *store.Turn) error
GetTurnByPostID(postID string) (*store.Turn, error)
UpdateTurnPostID(id string, postID *string) error
}
TurnStore is the subset of store operations needed by the streaming layer. Finalize either creates a fresh anchor (first stream / regen, with the caller having scrubbed any prior turns) or demotes the existing anchor and creates a new one (continuation).