Documentation ¶
Index ¶
- func AttachFile(path string) (string, error)
- func OutputHistory(r io.Reader, w io.Writer, userName, assistantName string) error
- type ChatContext
- func (cctx *ChatContext) AppendAssistantMessages(msgs []string) error
- func (cctx *ChatContext) AppendUserMessages(msgs []string) error
- func (cctx *ChatContext) Interactive(ctx context.Context, w io.Writer) error
- func (cctx *ChatContext) InteractiveMulti(ctx context.Context, w io.Writer) error
- func (cctx *ChatContext) Request(ctx context.Context, rest bool, msgs []string, w io.Writer) error
- func (cctx *ChatContext) Save() error
- func (cctx *ChatContext) SavePath() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttachFile ¶ added in v0.5.0
AttachFile function converts markdown like text from text file data
Types ¶
type ChatContext ¶
type ChatContext struct { *gpt.GPTContext // contains filtered or unexported fields }
ChatContext is context data for chat
func New ¶
func New(apiKey, cacheDir string, logger *zerolog.Logger, preparePath, savePath string) (*ChatContext, error)
New function create new ChatContext instance.
func (*ChatContext) AppendAssistantMessages ¶ added in v0.5.0
func (cctx *ChatContext) AppendAssistantMessages(msgs []string) error
AppendAssistantMessages method adds assistant messages.
func (*ChatContext) AppendUserMessages ¶ added in v0.5.0
func (cctx *ChatContext) AppendUserMessages(msgs []string) error
AppendUserMessages method adds user messages.
func (*ChatContext) Interactive ¶
Interactive method is chatting in interactive mode (stream access).
func (*ChatContext) InteractiveMulti ¶ added in v0.6.0
InteractiveMulti method is chatting in interactive mode with multiline editing (stream access).
func (*ChatContext) Request ¶
Request requesta OpenAI Chat completion, and returns response message.
func (*ChatContext) Save ¶ added in v0.3.0
func (cctx *ChatContext) Save() error
Save method saves openai.ChatCompletionRequest data.
func (*ChatContext) SavePath ¶ added in v0.3.0
func (cctx *ChatContext) SavePath() string
SavePath method return Path of saving chat data.
Click to show internal directories.
Click to hide internal directories.