Documentation
¶
Overview ¶
Package promptdb 在本地 SQLite 中保存 Playground 对话
Index ¶
- type Store
- func (s *Store) Close() error
- func (s *Store) CopyPrompt(ctx context.Context, source, id, title string) (api.PromptSummary, error)
- func (s *Store) DeletePrompt(ctx context.Context, id string) error
- func (s *Store) DeleteSystemInstruction(ctx context.Context, id string) error
- func (s *Store) Prompt(ctx context.Context, id string) (api.Prompt, error)
- func (s *Store) Prompts(ctx context.Context, pageSize int, pageToken string) ([]api.PromptSummary, string, error)
- func (s *Store) RenamePrompt(ctx context.Context, id, title, description string) (api.PromptSummary, error)
- func (s *Store) SavePrompt(ctx context.Context, prompt api.Prompt) (api.PromptSummary, error)
- func (s *Store) SaveSystemInstruction(ctx context.Context, preset api.SystemInstructionPreset) error
- func (s *Store) SystemInstructions(ctx context.Context) ([]api.SystemInstructionPreset, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store 读写对话库
func (*Store) CopyPrompt ¶ added in v0.2.17
func (s *Store) CopyPrompt(ctx context.Context, source, id, title string) (api.PromptSummary, error)
CopyPrompt 以 id 与 title 复制 source 的模型、描述与内容,source 不存在时返回 api.ErrPromptNotFound
func (*Store) DeletePrompt ¶
DeletePrompt 删除一份对话,不存在时返回 api.ErrPromptNotFound
func (*Store) DeleteSystemInstruction ¶ added in v0.2.18
DeleteSystemInstruction 删除一条系统指令预设
func (*Store) Prompts ¶
func (s *Store) Prompts(ctx context.Context, pageSize int, pageToken string) ([]api.PromptSummary, string, error)
Prompts 按更新时间倒序列出对话,pageSize 为 0 时列出 pageToken 之后的全部,返回下一页的令牌,没有下一页时为空
func (*Store) RenamePrompt ¶ added in v0.2.17
func (s *Store) RenamePrompt(ctx context.Context, id, title, description string) (api.PromptSummary, error)
RenamePrompt 改写一份对话的标题与描述,不存在时返回 api.ErrPromptNotFound
func (*Store) SavePrompt ¶
SavePrompt 创建或覆盖一份对话,保留首次创建时间
func (*Store) SaveSystemInstruction ¶ added in v0.2.18
func (s *Store) SaveSystemInstruction(ctx context.Context, preset api.SystemInstructionPreset) error
SaveSystemInstruction 新增或改写一条系统指令预设
func (*Store) SystemInstructions ¶ added in v0.2.18
SystemInstructions 按创建顺序读取保存的系统指令预设