types

package
v0.0.0-...-499e268 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatGptRequest

type ChatGptRequest struct {
	MessageId      string `json:"message_id"`
	ConversationId string `json:"conversation_id"`
	ParentId       string `json:"parent_id"`
	Content        string `json:"content"`
}

type ChatGptResponse

type ChatGptResponse struct {
	Id             string `json:"id"`
	ResponseId     string `json:"response_id"`
	ConversationId string `json:"conversation_id"`
	Content        string `json:"content"`
	Error          string `json:"error"`
}

type Connection

type Connection struct {
	// The websocket connection.
	Ws *websocket.Conn
	// The connecton id.
	Id string
	// Last heartbeat time.
	Heartbeat time.Time
	// Last message time.
	LastMessageTime time.Time
}

type ConnectionPool

type ConnectionPool struct {
	Connections map[string]*Connection
	Mu          sync.RWMutex
}

func NewConnectionPool

func NewConnectionPool() *ConnectionPool

func (*ConnectionPool) Delete

func (p *ConnectionPool) Delete(id string) error

func (*ConnectionPool) Get

func (p *ConnectionPool) Get(id string) (*Connection, bool)

func (*ConnectionPool) Set

func (p *ConnectionPool) Set(conn *Connection)

type Conversation

type Conversation struct {
	Id           string `json:"id"`
	ConnectionId string `json:"connection_id"`
}

type ConversationPool

type ConversationPool struct {
	Conversations map[string]*Conversation
	Mu            sync.RWMutex
}

func NewConversationPool

func NewConversationPool() *ConversationPool

func (*ConversationPool) Delete

func (p *ConversationPool) Delete(id string)

func (*ConversationPool) Get

func (p *ConversationPool) Get(id string) (*Conversation, bool)

func (*ConversationPool) Set

func (p *ConversationPool) Set(conversation *Conversation)

type Message

type Message struct {
	Id      string `json:"id"`
	Message string `json:"message"`
	Data    string `json:"data"`
}

Jump to

Keyboard shortcuts

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