Documentation
¶
Overview ¶
Package prompt separates what a user wrote from what they pasted.
A prompt like "<300 lines of log> why does auth time out?" is mostly pasted material; the intent is the last line. Capturing it verbatim and truncating would keep the log and lose the question. Split keeps the user's own words intact and turns large pasted blocks (code fences, quotes, logs and stack traces) into attachment records: kind, size, hash, a head+tail excerpt and the error lines, which is what retrieval needs.
Index ¶
Constants ¶
const ( // MinBlockBytes is the smallest pasted block worth extracting; shorter // snippets stay inline because they are usually part of the question. MinBlockBytes = 400 )
Variables ¶
This section is empty.
Functions ¶
func OwnWords ¶
OwnWords is the user's own text: the split prompt without the placeholders that stand in for pasted blocks.
func ShouldRecall ¶ added in v0.1.4
ShouldRecall allows compact Han queries such as "死锁" or "证书过期" while keeping acknowledgements and bare continuation prompts off the network. Latin-only input retains the existing six-letter/digit minimum.
func StripPlaceholders ¶
StripPlaceholders removes pasted-block placeholders from split text.
Types ¶
type Attachment ¶
type Attachment struct {
Kind string `json:"kind"` // code | log | quote | image | pasted
Lang string `json:"lang,omitempty"`
Bytes int `json:"bytes,omitempty"`
Lines int `json:"lines,omitempty"`
SHA256 string `json:"sha256,omitempty"`
Excerpt string `json:"excerpt,omitempty"`
Errors []string `json:"errors,omitempty"`
Ref string `json:"ref,omitempty"` // placeholder or path the agent used
}
Attachment describes pasted or attached material that is not stored in full. Media content is never stored, only its metadata.