Skip to content

Conversation

@tim-roethig
Copy link
Owner

@tim-roethig tim-roethig commented Jan 20, 2025

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests for validating the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To cleary categorize this pull request, prefix the pull request title, using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

  • [Concisely describe the changes made in this pull request, including any relevant motivation and impact (e.g., fixing a bug, adding a feature, or improving performance)]

This PR adds the possibility to configure DEFAULT_PROMPT_SUGGESTIONS via an env var of the same name analog to WEBUI_BANNERS. Previously this was only possible via the settings menu.

Added

  • env var DEFAULT_PROMPT_SUGGESTIONS
  • pydantic model to validate DEFAULT_PROMPT_SUGGESTIONS

Changed

  • DEFAULT_PROMPT_SUGGESTIONS PersistentConfig

Deprecated

  • None

Removed

  • None

Fixed

  • None

Security

  • None

Breaking Changes

  • None

Additional Information

  • docs entry:

DEFAULT_PROMPT_SUGGESTIONS

  • Type: list of dict
  • Description: List of prompt suggestions to show to users. Format of prompt suggestions are:
[
    {
        "title": ["Help me study", "vocabulary for a college entrance exam"],
        "content": "Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option.",
    },
    {
        "title": ["Give me ideas", "for what to do with my kids' art"],
        "content": "What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter.",
    },
]
  • Persistence: This environment variable is a PersistentConfig variable.

:::info

When setting this environment variable in a .env file, make sure to escape the quotes by wrapping the entire value in double quotes and using escaped quotes (\") for the inner quotes. Example:

DEFAULT_PROMPT_SUGGESTIONS="[{\"title\": [\"Help me study\", \"vocabulary for a college entrance exam\"], \"content\": \"Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option.\"}, {\"title\": [\"Give me ideas\", \"for what to do with my kids' art\"], \"content\": \"What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter.\"}]"

### Screenshots or Videos

- None

@tim-roethig tim-roethig changed the title making DEFAULT_PROMPT_SUGGESTIONS env var refactor: making DEFAULT_PROMPT_SUGGESTIONS env var Jan 20, 2025
@tim-roethig tim-roethig marked this pull request as ready for review January 20, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants