service

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// execute host command on local machine
	Ask suggestionType = iota

	// translate text
	Translate

	// data from web page contents
	Web

	// data from file contents
	File

	// execute host command on local machine
	Cmd

	// clear all conversation history
	Clear

	// Config system setting
	Config

	// Reset suggestion
	Reset

	// Quit suggestion
	Quit

	// Others is key for various arbitrary suggestions
	Others
)
View Source
const PLUGIN_NAME_FILE_CONTENT = "file-content"
View Source
const PLUGIN_NAME_FILE_SUMMARY = "file-summary"
View Source
const PLUGIN_NAME_FILE_TRANSLATE_CN = "file-translate-cn"
View Source
const PLUGIN_NAME_FILE_TRANSLATE_EN = "file-translate-en"
View Source
const PLUGIN_NAME_FILE_TRANSLATE_JP = "file-translate-jp"
View Source
const PLUGIN_NAME_WEB_CONTENT = "web-content"
View Source
const PLUGIN_NAME_WEB_SUMMARY = "web-summary"
View Source
const PLUGIN_NAME_WEB_TRANSLATE_CN = "web-translate-cn"
View Source
const PLUGIN_NAME_WEB_TRANSLATE_EN = "web-translate-en"
View Source
const PLUGIN_NAME_WEB_TRANSLATE_JP = "web-translate-jp"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatBot

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

func NewChatbot

func NewChatbot(chat_history_path string, name string, role_name string, log_history bool, verbose bool) *ChatBot

func (*ChatBot) Ask

func (bot *ChatBot) Ask(question string) bool

func (*ChatBot) CheckConnectivity

func (bot *ChatBot) CheckConnectivity() bool

func (*ChatBot) Close

func (bot *ChatBot) Close(exit bool)

func (*ChatBot) CommandProcessor

func (bot *ChatBot) CommandProcessor(original_msg string, arr_cmd []string) (string, bool, error)

func (*ChatBot) Run

func (bot *ChatBot) Run()

func (*ChatBot) Say

func (bot *ChatBot) Say(msg string, need_dump bool)

func (*ChatBot) ShakeHands

func (bot *ChatBot) ShakeHands() (string, error)

type ChatGPTCLient

type ChatGPTCLient struct {
	gpt3.Client
	HTTPClient *http.Client
}

func (*ChatGPTCLient) CreateChatCompletion

func (c *ChatGPTCLient) CreateChatCompletion(
	ctx context.Context,
	request gpt3.ChatCompletionRequest,
) (response gpt3.ChatCompletionResponse, err error)

CreateChatCompletion — API call to Create a completion for the chat message.

func (*ChatGPTCLient) GetMaxTokens added in v0.1.8

func (c *ChatGPTCLient) GetMaxTokens(model string) int

please refer to this page for limitation:

https://platform.openai.com/docs/models/gpt-3-5

func (*ChatGPTCLient) UserLogin

func (c *ChatGPTCLient) UserLogin() (string, error)

func (*ChatGPTCLient) UserLogout

func (c *ChatGPTCLient) UserLogout() (string, error)

func (*ChatGPTCLient) UserRegistration

func (c *ChatGPTCLient) UserRegistration(email string, endpoint_url string) (string, error)

type FilePlugin

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

func (*FilePlugin) Close

func (*FilePlugin) Close() error

func (*FilePlugin) Execute

func (plugin *FilePlugin) Execute(original_msg string, arr_cmd []string) (processed bool, replaced_msg string, replaced_cmd []string, err error)

func (*FilePlugin) Open

func (plugin *FilePlugin) Open() error

type LivePrefixState

type LivePrefixState struct {
	LivePrefix string
	IsEnable   bool
	Buffer     string
}

func (*LivePrefixState) ChangeLivePrefix

func (lps *LivePrefixState) ChangeLivePrefix() (string, bool)

func (*LivePrefixState) InputModePadding

func (lps *LivePrefixState) InputModePadding(cmds string) bool

func (*LivePrefixState) ResetInputMode

func (lps *LivePrefixState) ResetInputMode()

type Plugin

type Plugin interface {
	Open() error
	Close() error
	Execute(original_msg string, arr_cmd []string) (processed bool, replaced_msg string, replaced_cmd []string, err error)
}

type PluginManager

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

func NewPluginManager

func NewPluginManager() *PluginManager

func (*PluginManager) AddPlugin

func (pm *PluginManager) AddPlugin(p Plugin)

func (*PluginManager) Close

func (pm *PluginManager) Close() error

func (*PluginManager) Execute

func (pm *PluginManager) Execute(original_msg string, arr_cmd []string) (processed bool, replaced_msg string, replaced_cmd []string, err error)

func (*PluginManager) Open

func (pm *PluginManager) Open() error

type WebSummaryPlugin

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

func (*WebSummaryPlugin) Close

func (*WebSummaryPlugin) Close() error

func (*WebSummaryPlugin) Execute

func (plugin *WebSummaryPlugin) Execute(original_msg string, arr_cmd []string) (processed bool, replaced_msg string, replaced_cmd []string, err error)

func (*WebSummaryPlugin) Open

func (plugin *WebSummaryPlugin) Open() error

Jump to

Keyboard shortcuts

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