promptdb

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package promptdb 在本地 SQLite 中保存 Playground 对话

Index

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 Open

func Open(path string) (*Store, error)

Open 打开或创建对话库

func (*Store) Close

func (s *Store) Close() error

Close 关闭对话库

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

func (s *Store) DeletePrompt(ctx context.Context, id string) error

DeletePrompt 删除一份对话,不存在时返回 api.ErrPromptNotFound

func (*Store) DeleteSystemInstruction added in v0.2.18

func (s *Store) DeleteSystemInstruction(ctx context.Context, id string) error

DeleteSystemInstruction 删除一条系统指令预设

func (*Store) Prompt

func (s *Store) Prompt(ctx context.Context, id string) (api.Prompt, error)

Prompt 读取一份对话,不存在时返回 api.ErrPromptNotFound

func (*Store) Prompts

func (s *Store) Prompts(ctx context.Context, pageSize int, pageToken string) ([]api.PromptSummary, string, error)

Prompts 按更新时间倒序列出对话,pageSize 为 0 时列出 pageToken 之后的全部,返回下一页的令牌,没有下一页时为空

func (*Store) Reclaim added in v0.3.11

func (s *Store) Reclaim(ctx context.Context) error

Reclaim 把空闲页交还文件系统

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

func (s *Store) SavePrompt(ctx context.Context, prompt api.Prompt) (api.PromptSummary, error)

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

func (s *Store) SystemInstructions(ctx context.Context) ([]api.SystemInstructionPreset, error)

SystemInstructions 按创建顺序读取保存的系统指令预设

Jump to

Keyboard shortcuts

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