Commit graph

6 commits

Author SHA1 Message Date
Dominik Schröter
6410136f89 feat: add support for customizable server-side prompts
- **Custom Prompt Templates**: Introduced support for user-modifiable prompt templates using Go's `text/template`.
  - Added default prompt templates for title and tag generation.
  - Templates are stored in the `prompts` directory and are loaded at startup.
  - If the template files do not exist, they are created with default content.
  - Users can modify the templates by editing the files in the `prompts` directory.
- **API Endpoints for Prompts**:
  - Added `GET /api/prompts` endpoint to retrieve the current prompt templates.
  - Added `POST /api/prompts` endpoint to update the prompt templates.
  - These endpoints prepare for future UI support for modifying prompts.
- **Thread Safety**:
  - Implemented a `sync.RWMutex` to ensure thread-safe access to the templates.
- **Updated Backend Logic**:
  - Modified `getSuggestedTitle` and `getSuggestedTags` functions to use the loaded templates.
  - Templates utilize variables like `{{.Language}}`, `{{.Content}}`, `{{.AvailableTags}}`, and `{{.Title}}`.
- **Docker and Documentation**:
  - Updated the `loadTemplates` function to ensure the `prompts` directory exists and to save default templates if missing.
  - Updated the README with instructions on how to mount the `prompts` directory in Docker and Docker Compose.
  - Provided guidance on modifying the prompt templates via file edits.
2024-10-16 14:57:14 +02:00
Icereed
4776486fab
Add banner with screenshot to Readme (#7) 2024-10-04 14:26:56 +02:00
Icereed
e87d80e5bf
Update README.md 2024-09-27 21:41:48 +02:00
Dominik Schröter
960ceb090f Document OLLAMA_HOST 2024-09-24 09:20:40 +02:00
Icereed
6940ab47fe Cleanup 2024-09-23 15:17:00 +02:00
Dominik Schröter
833bd9b1b7 Publish paperless-gpt 2024-09-23 14:59:50 +02:00