function

package
v0.0.0-...-0c82738 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InDialogs = make(map[string]bool)
View Source
var UsersState = make(map[string]UserConfig)

Functions

func Adventure

func Adventure(w http.ResponseWriter, req *http.Request)

func Adventure_V1_Command

func Adventure_V1_Command(bot *linebot.Client, event *linebot.Event, userMessage string)

func Adventure_V1_InitUser

func Adventure_V1_InitUser(userid string)

func Adventure_V2_Command

func Adventure_V2_Command(bot *linebot.Client, event *linebot.Event, userMessage string)

func Adventure_V2_InitUser

func Adventure_V2_InitUser(userid string)

func Adventure_V3_Command

func Adventure_V3_Command(bot *linebot.Client, event *linebot.Event, userMessage string)

func Adventure_V3_InitUser

func Adventure_V3_InitUser(userid string)

func ConvertStructToMap

func ConvertStructToMap(i interface{}) (map[string]interface{}, error)

func Delete

func Delete(collection string, id string) error

Delete deletes a document with the given id in the specified collection

func GetAll

func GetAll(collection string) ([]map[string]interface{}, error)

GetAll returns all documents in the specified collection

func GetByID

func GetByID(collection string, ID string) (map[string]interface{}, error)

func GetByKeyValue

func GetByKeyValue(collection string, key string, value string) ([]map[string]interface{}, error)

func GetClient

func GetClient() *firestore.Client

GetClient uses sync.Once to ensure that the firestore client is only initialized once

func IsRunningInTestMode

func IsRunningInTestMode() bool

func SendLineTextMessage

func SendLineTextMessage(bot *linebot.Client, event *linebot.Event, reply string)

func SendLineTextMessageWithQuickReply

func SendLineTextMessageWithQuickReply(bot *linebot.Client, event *linebot.Event, adv AdvanceResponse)

func UpdateOrCreate

func UpdateOrCreate(collection string, id string, data interface{}, flag ...bool) (err error)

UpdateOrCreate updates a document with the given id in the specified collection, or creates a new one if it doesn't exist

Types

type AdvanceResponse

type AdvanceResponse struct {
	Body  string   `json:"Body,omitempty"`
	Items []string `json:"Items,omitempty"`
}

func ConvertJsonToAdv

func ConvertJsonToAdv(str string) (AdvanceResponse, error)

func DoAnAdventure

func DoAnAdventure(userid string, userMessage string, ChatCompletionRequest openai.ChatCompletionRequest) (adv AdvanceResponse, err error)

func DoAnAdventureV2

func DoAnAdventureV2(userid string, userMessage string, ChatCompletionRequest openai.ChatCompletionRequest) (adv AdvanceResponse, err error)

func Help

func Help() AdvanceResponse

type AdventureVersionSetting

type AdventureVersionSetting struct {
	SystemPrompt                string
	ChatCompletionRequestFirst  openai.ChatCompletionRequest
	ChatCompletionRequestNormal openai.ChatCompletionRequest
}

type UserConfig

type UserConfig struct {
	ChatHistory       []openai.ChatCompletionMessage
	ConversationCount int
	CurrentVersion    string
}

Jump to

Keyboard shortcuts

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