conversation

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddMessageRequest

type AddMessageRequest struct {
	ProjectID         uuid.UUID                     `json:"project_id"`
	Namespace         string                        `json:"namespace"`
	MessageID         string                        `json:"message_id"`
	PreviousMessageID string                        `json:"previous_message_id"`
	Messages          []responses.InputMessageUnion `json:"messages"`
	Meta              map[string]any                `json:"meta"`
	ConversationID    string                        `json:"conversation_id"`
}

type Conversation

type Conversation struct {
	ProjectID      uuid.UUID `json:"project_id" db:"project_id"`
	NamespaceID    string    `json:"namespace_id" db:"namespace_id"`
	ConversationID string    `json:"conversation_id" db:"conversation_id"`
	Name           string    `json:"name" db:"name"`
	CreatedAt      time.Time `json:"created_at" db:"created_at"`
	LastUpdated    time.Time `json:"last_updated" db:"last_updated"`
}

Conversation represents a conversation

type ConversationMessage

type ConversationMessage struct {
	MessageID      string                        `json:"message_id" db:"message_id"`
	ThreadID       string                        `json:"thread_id" db:"thread_id"`
	ConversationID string                        `json:"conversation_id" db:"conversation_id"`
	Messages       []responses.InputMessageUnion `json:"messages" db:"messages"`
	Meta           map[string]any                `json:"meta" db:"meta"`
}

ConversationMessage represents a message within a thread

type ConversationRepo

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

func NewConversationRepo

func NewConversationRepo(db *sqlx.DB) *ConversationRepo

func (*ConversationRepo) CreateConversation

func (r *ConversationRepo) CreateConversation(ctx context.Context, conversation Conversation) (Conversation, error)

func (*ConversationRepo) CreateMessages

func (r *ConversationRepo) CreateMessages(ctx context.Context, message ConversationMessage) error

func (*ConversationRepo) CreateSummary

func (r *ConversationRepo) CreateSummary(ctx context.Context, summary Summary) error

CreateSummary saves a summary to the summaries table

func (*ConversationRepo) CreateThread

func (r *ConversationRepo) CreateThread(ctx context.Context, thread Thread) (Thread, error)

func (*ConversationRepo) GetAllMessagesTillRun

func (r *ConversationRepo) GetAllMessagesTillRun(ctx context.Context, projectID uuid.UUID, namespace string, previousMessageID string) ([]ConversationMessage, error)

func (*ConversationRepo) GetConversationByID

func (r *ConversationRepo) GetConversationByID(ctx context.Context, projectID uuid.UUID, namespace string, conversationID string) (Conversation, error)

func (*ConversationRepo) GetLatestSummaryBeforeMessage

func (r *ConversationRepo) GetLatestSummaryBeforeMessage(ctx context.Context, projectID uuid.UUID, namespace string, threadID string, beforeMessageID string) (Summary, error)

GetLatestSummaryBeforeMessage finds the latest summary for a thread that precedes the given message ID

func (*ConversationRepo) GetMessageByID

func (r *ConversationRepo) GetMessageByID(ctx context.Context, projectID uuid.UUID, namespace string, ID string) (ConversationMessage, error)

func (*ConversationRepo) GetThreadByID

func (r *ConversationRepo) GetThreadByID(ctx context.Context, projectID uuid.UUID, namespace string, threadID string) (Thread, error)

func (*ConversationRepo) GetThreadMessages

func (r *ConversationRepo) GetThreadMessages(ctx context.Context, projectID uuid.UUID, namespace string, threadID string, offset, limit int) ([]ConversationMessage, error)

func (*ConversationRepo) ListConversations

func (r *ConversationRepo) ListConversations(ctx context.Context, projectID uuid.UUID, namespaceID string) ([]Conversation, error)

func (*ConversationRepo) ListThreads

func (r *ConversationRepo) ListThreads(ctx context.Context, projectID uuid.UUID, namespaceID string, conversationID string) ([]Thread, error)

func (*ConversationRepo) UpdateConversation

func (r *ConversationRepo) UpdateConversation(ctx context.Context, conversation Conversation) error

func (*ConversationRepo) UpdateThread

func (r *ConversationRepo) UpdateThread(ctx context.Context, thread Thread) error

type ConversationService

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

func NewConversationService

func NewConversationService(r *ConversationRepo) *ConversationService

func (*ConversationService) AddMessages

func (s *ConversationService) AddMessages(ctx context.Context, in *AddMessageRequest) error

func (*ConversationService) CreateSummary

func (s *ConversationService) CreateSummary(ctx context.Context, projectID uuid.UUID, namespace string, summary Summary) error

func (*ConversationService) GetAllMessagesTillRun

func (s *ConversationService) GetAllMessagesTillRun(ctx context.Context, in *GetMessagesRequest) ([]ConversationMessage, error)

func (*ConversationService) GetConversation

func (s *ConversationService) GetConversation(ctx context.Context, projectID uuid.UUID, namespaceID string, conversationID string) (Conversation, error)

func (*ConversationService) GetMessage

func (s *ConversationService) GetMessage(ctx context.Context, projectID uuid.UUID, namespaceID string, messageID string) (ConversationMessage, error)

func (*ConversationService) GetThread

func (s *ConversationService) GetThread(ctx context.Context, projectID uuid.UUID, namespaceID string, threadID string) (Thread, error)

func (*ConversationService) ListConversations

func (s *ConversationService) ListConversations(ctx context.Context, projectID uuid.UUID, namespaceID string) ([]Conversation, error)

func (*ConversationService) ListMessages

func (s *ConversationService) ListMessages(ctx context.Context, projectID uuid.UUID, namespaceID string, threadID string) ([]ConversationMessage, error)

func (*ConversationService) ListThreads

func (s *ConversationService) ListThreads(ctx context.Context, projectID uuid.UUID, namespaceID string, conversationID string) ([]Thread, error)

type GetMessagesRequest

type GetMessagesRequest struct {
	ProjectID         uuid.UUID `json:"project_id"`
	Namespace         string    `json:"namespace"`
	PreviousMessageID string    `json:"previous_message_id"`
	Offset            int       `json:"offset"`
	Limit             int       `json:"limit"`
}

type Summary

type Summary struct {
	ID                      string                      `json:"id" db:"id"`
	ThreadID                string                      `json:"thread_id" db:"thread_id"`
	SummaryMessage          responses.InputMessageUnion `json:"summary_message" db:"summary_message"`
	LastSummarizedMessageID string                      `json:"last_summarized_message_id" db:"last_summarized_message_id"`
	CreatedAt               time.Time                   `json:"created_at" db:"created_at"`
	Meta                    map[string]any              `json:"meta" db:"meta"`
}

Summary represents a conversation summary stored in the summaries table

type Thread

type Thread struct {
	ConversationID  string                 `json:"conversation_id" db:"conversation_id"`
	OriginMessageID string                 `json:"origin_message_id" db:"origin_message_id"`
	LastMessageID   string                 `json:"last_message_id" db:"last_message_id"`
	ThreadID        string                 `json:"thread_id" db:"thread_id"`
	Meta            map[string]interface{} `json:"meta" db:"meta"`
	CreatedAt       time.Time              `json:"created_at" db:"created_at"`
	LastUpdated     time.Time              `json:"last_updated" db:"last_updated"`
}

Thread represents a thread within a conversation

Jump to

Keyboard shortcuts

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