mirror of
https://github.com/icereed/paperless-gpt.git
synced 2025-03-12 21:08:00 -05:00
Merge branch 'main' into token-limit
This commit is contained in:
commit
e76eaff4cd
2 changed files with 30 additions and 0 deletions
29
README.md
29
README.md
|
@ -185,6 +185,7 @@ paperless-gpt’s flexible **prompt templates** let you shape how AI responds:
|
|||
1. **`title_prompt.tmpl`**: For document titles.
|
||||
2. **`tag_prompt.tmpl`**: For tagging logic.
|
||||
3. **`ocr_prompt.tmpl`**: For LLM OCR.
|
||||
4. **`correspondent_prompt.tmpl`**: For correspondent identification.
|
||||
|
||||
Mount them into your container via:
|
||||
|
||||
|
@ -195,6 +196,34 @@ Mount them into your container via:
|
|||
|
||||
Then tweak at will—**paperless-gpt** reloads them automatically on startup!
|
||||
|
||||
#### Template Variables
|
||||
|
||||
Each template has access to specific variables:
|
||||
|
||||
**title_prompt.tmpl**:
|
||||
- `{{.Language}}` - Target language (e.g., "English")
|
||||
- `{{.Content}}` - Document content text
|
||||
- `{{.Title}}` - Original document title
|
||||
|
||||
**tag_prompt.tmpl**:
|
||||
- `{{.Language}}` - Target language
|
||||
- `{{.AvailableTags}}` - List of existing tags in paperless-ngx
|
||||
- `{{.OriginalTags}}` - Document's current tags
|
||||
- `{{.Title}}` - Document title
|
||||
- `{{.Content}}` - Document content text
|
||||
|
||||
**ocr_prompt.tmpl**:
|
||||
- `{{.Language}}` - Target language
|
||||
|
||||
**correspondent_prompt.tmpl**:
|
||||
- `{{.Language}}` - Target language
|
||||
- `{{.AvailableCorrespondents}}` - List of existing correspondents
|
||||
- `{{.BlackList}}` - List of blacklisted correspondent names
|
||||
- `{{.Title}}` - Document title
|
||||
- `{{.Content}}` - Document content text
|
||||
|
||||
The templates use Go's text/template syntax. paperless-gpt automatically reloads template changes on startup.
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
|
|
@ -252,6 +252,7 @@ func (app *App) getSuggestedTitle(ctx context.Context, content string, originalT
|
|||
var promptBuffer bytes.Buffer
|
||||
templateData["Content"] = truncatedContent
|
||||
err = titleTemplate.Execute(&promptBuffer, templateData)
|
||||
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error executing title template: %v", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue