data

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendMessage

func AppendMessage(role string, content string)

func CreateTable

func CreateTable()

func DecryptMessage

func DecryptMessage(key []byte, encodedMessage string) (string, error)

func EncryptMessage

func EncryptMessage(key []byte, message string) (string, error)

func GetAppPath

func GetAppPath() string

func GetEncryptionKey

func GetEncryptionKey() []byte

func InitOrDie

func InitOrDie()

func InsertKey

func InsertKey(key string, value string)

func IsSettingsTableCreated

func IsSettingsTableCreated() bool

func OpenAiRequest

func OpenAiRequest(query string) string

func OpenDatabase

func OpenDatabase() error

func PopulateSettings

func PopulateSettings()

func PrintAiAnswer

func PrintAiAnswer(input string)

func PromptCustomOrDefault

func PromptCustomOrDefault(question string, defaultValue string) string

func PromptInit

func PromptInit()

func ReadQuestion

func ReadQuestion()

func RunQuery

func RunQuery(input string)

func StartAiThinking

func StartAiThinking()

Start delay spinner

func StopAiThinking

func StopAiThinking()

Stop delay spinner

func StrToFloat

func StrToFloat(s string) float32

Converts string to float

func StrToInt

func StrToInt(s string) int

Converts string to int

Types

type ApiPostBody

type ApiPostBody struct {
	Messages         []Message `json:"messages"`
	Model            string    `json:"model"`
	MaxTokens        int       `json:"max_tokens"`
	Temperature      float32   `json:"temperature"`
	FrequencyPenalty float32   `json:"frequency_penalty"`
	PresencePenalty  float32   `json:"presence_penalty"`
}

type Choice

type Choice struct {
	Role         string  `json:"role"`
	Message      Message `json:"message"`
	FinishReason string  `json:"finish_reason"`
}

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

func GetMessages

func GetMessages() []Message

type OpenApiResponse

type OpenApiResponse struct {
	Id      string   `json:"id"`
	Model   string   `json:"model"`
	Choices []Choice `json:"choices"`
}

type Settings

type Settings struct {
	ApiKey           string
	ApiURL           string
	MaxTokens        int
	Temperature      float32
	FrequencyPenalty float32
	PresencePenalty  float32
	Model            string
	SystemMessage    string
}

func FetchSettings

func FetchSettings() *Settings

func GetDefaultSettings

func GetDefaultSettings() *Settings

Jump to

Keyboard shortcuts

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