session

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultSessionManager

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

DefaultSessionManager 默认实现

func NewSessionManager

func NewSessionManager(namespace string) *DefaultSessionManager

func (*DefaultSessionManager) CreateSessionContext

func (m *DefaultSessionManager) CreateSessionContext(platform, userID, botUserID, channelID, threadID, providerType string) *SessionContext

func (*DefaultSessionManager) GenerateEngineSessionID

func (m *DefaultSessionManager) GenerateEngineSessionID() uuid.UUID

func (*DefaultSessionManager) GenerateProviderSessionID

func (m *DefaultSessionManager) GenerateProviderSessionID(engineSessionID uuid.UUID, providerType string) string

func (*DefaultSessionManager) GetChatSessionID

func (m *DefaultSessionManager) GetChatSessionID(platform, userID, botUserID, channelID, threadID string) string

type SessionContext

type SessionContext struct {
	ChatSessionID     string
	ChatPlatform      string
	ChatUserID        string
	ChatBotUserID     string
	ChatChannelID     string
	ChatThreadID      string
	EngineSessionID   uuid.UUID
	EngineNamespace   string
	ProviderSessionID string
	ProviderType      string
}

SessionContext 完整会话上下文

type SessionManager

type SessionManager interface {
	GetChatSessionID(platform, userID, botUserID, channelID, threadID string) string
	GenerateEngineSessionID() uuid.UUID
	GenerateProviderSessionID(engineSessionID uuid.UUID, providerType string) string
	CreateSessionContext(platform, userID, botUserID, channelID, threadID, providerType string) *SessionContext
}

SessionManager 统一管理三层 SessionID (DRY 原则)

Jump to

Keyboard shortcuts

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