bard

package
v0.0.0-...-ed23b36 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ALLOWED_LANGUAGES = []string{"en", "ko", "ja", "english", "korean", "japanese", "chinese"}
View Source
var DEFAULT_LANGUAGE = "en"
View Source
var IMG_UPLOAD_HEADERS = map[string]string{
	"authority":                           "content-push.googleapis.com",
	"accept":                              "*/*",
	"accept-language":                     "en-US,en;q=0.7",
	"authorization":                       "Basic c2F2ZXM6cyNMdGhlNmxzd2F2b0RsN3J1d1U=",
	"content-type":                        "application/x-www-form-urlencoded;charset=UTF-8",
	"origin":                              "https://bard.google.com",
	"push-id":                             "feeds/mcudyrk2a4khkz",
	"referer":                             "https://bard.google.com/",
	"x-goog-upload-command":               "start",
	"x-goog-upload-header-content-length": "",
	"x-goog-upload-protocol":              "resumable",
	"x-tenant-id":                         "bard-storage",
}
View Source
var SEPARATOR_LINE = strings.Repeat("=", 36)
View Source
var SESSION_HEADERS = map[string]string{
	"Host":          "bard.google.com",
	"X-Same-Domain": "1",
	"User-Agent":    "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
	"Content-Type":  "application/x-www-form-urlencoded;charset=UTF-8",
	"Origin":        "https://bard.google.com",
	"Referer":       "https://bard.google.com/",
}
View Source
var USER_PROMPT = "You: "

Functions

This section is empty.

Types

type Bard

type Bard struct {
	Token                  string
	Timeout                int
	Proxies                map[string]string
	Session                *http.Client
	ReqId                  int
	ConversationId         string
	Language               string
	RunCode                bool
	GoogleTranslatorAPIKey string
	SNlM0e                 string
	ResponseId             string
	ChoiceId               string
}

func NewBard

func NewBard(token string, timeout int, proxies map[string]string, session *http.Client, conversationId string, language string,
	runCode bool, googleTranslatorAPIKey string) *Bard

func (*Bard) ExtractCookie

func (b *Bard) ExtractCookie() string

func (*Bard) GetAnswer

func (b *Bard) GetAnswer(inputText string) (map[string]interface{}, error)

func (*Bard) GetSNlM0e

func (b *Bard) GetSNlM0e() string

func (*Bard) Speech

func (b *Bard) Speech(inputText string, lang string) ([]byte, error)

type ChatBard

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

func NewChatBard

func NewChatBard(token string, timeout int, language string) *ChatBard

func (*ChatBard) DisplayChatHistory

func (c *ChatBard) DisplayChatHistory()

func (*ChatBard) Start

func (c *ChatBard) Start()

Jump to

Keyboard shortcuts

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