internal

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TalkCache talkCache

Functions

func StartServer

func StartServer()

Types

type AudioReader

type AudioReader struct {
	Reader   io.Reader
	FileName string
}

type ChatHandler

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

func NewChatHandler

func NewChatHandler(
	streamId string,
	chatId string,
	ticketId string,
	o TalkOption,
	sse *SSE,
	talker *Talker,
	logger *zap.Logger,
) *ChatHandler

func (*ChatHandler) Start

func (c *ChatHandler) Start(ms []client.Message, ar *AudioReader)

Start

if there is an audio

client --audio--> [toText] --text--> [completion] --text--> [toSpeech] --audio--> client
                               |                      |                     |
                               v                      v                     v
                            client                  client               client

if there isn't an audio

client --text--> [completion] --text--> [toSpeech] --audio--> client
          |                       |
          v                       v
      [toAudio]                 client
          |
          v
        client

type RestfulEHandler

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

func NewRestfulEHandler

func NewRestfulEHandler(talker *Talker, sse *SSE, logger *zap.Logger) *RestfulEHandler

func (*RestfulEHandler) Health

func (h *RestfulEHandler) Health(c echo.Context) error

func (*RestfulEHandler) PostAudioChat

func (h *RestfulEHandler) PostAudioChat(c echo.Context) error

func (*RestfulEHandler) PostChat

func (h *RestfulEHandler) PostChat(c echo.Context) error

func (*RestfulEHandler) ProvidersStatus

func (h *RestfulEHandler) ProvidersStatus(c echo.Context) error

type SSE

type SSE struct {
	*sse.Server
	// contains filtered or unexported fields
}

func NewSSE

func NewSSE(talker *Talker, logger *zap.Logger) *SSE

func (*SSE) HandleEcho

func (s *SSE) HandleEcho(c echo.Context) error

func (*SSE) PublishData

func (s *SSE) PublishData(streamId, eventName string, data interface{})

type Talker

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

func NewTalker

func NewTalker(tc config.TalkConfig, logger *zap.Logger) (*Talker, error)

func (*Talker) Ability

func (t *Talker) Ability(ctx context.Context) ([]error, ability.Ability)

Ability set ability and bypass any errors that may occur

both the ability and error slice can contain elements simultaneously to emphasize this fact, we interchange the positions of errors and items.

func (*Talker) SelectLLMProvider

func (t *Talker) SelectLLMProvider(o *ability.LLMOption) (llm client.LLM, ok bool)

func (*Talker) SelectSTTProvider

func (t *Talker) SelectSTTProvider(o *ability.STTOption) (tts client.SpeechToText, ok bool)

func (*Talker) SelectTTSProvider

func (t *Talker) SelectTTSProvider(o *ability.TTSOption) (tts client.TextToSpeech, ok bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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