prompt

package
v0.0.0-...-9473012 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindFirstSystemMessage

func FindFirstSystemMessage(history []structs.Message) (structs.Message, error)

FindFirstSystemMessage 从消息列表中查找第一条角色为 "system" 的消息

func GetFirstSystemMessage

func GetFirstSystemMessage(basename string) (string, error)

返回第一条 "system" 角色的消息文本 GetFirstSystemMessage returns the first message with role "system", randomly selecting if split by ||

func GetFirstSystemMessageStruct

func GetFirstSystemMessageStruct(basename string) (structs.Message, error)

GetFirstSystemMessage returns the first message that is of "system" role.

func GetMessagesExcludingSystem

func GetMessagesExcludingSystem(basename string) ([]structs.Message, error)

返回除了 "system" 角色之外的所有消息 GetMessagesExcludingSystem returns a list of messages that are not of "system" role, randomly selecting from options separated by "||" in prompt contents.

func GetMessagesFromFilename

func GetMessagesFromFilename(basename string) ([]structs.Message, error)

GetMessagesFromFilename returns a list of messages, each potentially with randomized content if '||' is used in prompts

func GetSettingFromFilename

func GetSettingFromFilename(basename, settingName string) (interface{}, error)

GetSettingFromFilename 用于获取配置文件中的特定设置

func LoadPrompts

func LoadPrompts() error

LoadPrompts 确保目录存在并尝试加载提示词文件

Types

type Prompt

type Prompt struct {
	Role    string `yaml:"role"`
	Content string `yaml:"content"`
}

type PromptFile

type PromptFile struct {
	Prompts  []Prompt         `yaml:"Prompt"`
	Settings structs.Settings `yaml:"settings"`
}

Jump to

Keyboard shortcuts

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