Skip to content

feat: introduce system prompt feature with validation#27

Merged
chenyme merged 1 commit into
devfrom
support_system_prompt
May 23, 2026
Merged

feat: introduce system prompt feature with validation#27
chenyme merged 1 commit into
devfrom
support_system_prompt

Conversation

@chenyme

@chenyme chenyme commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Add global and model-level system prompt support for chat models. Global prompts are configured in conversation settings, model-level prompts are configured in model management, and the resolved prompt is injected only for chat tasks. Providers/models that do not support native system prompts fall back to merging the prompt into the latest user message.

Change type

  • Bug fix
  • Feature
  • Documentation
  • Refactor
  • Configuration / deployment
  • Security hardening
  • Other

Affected areas

  • Frontend / UI
  • Backend / API
  • Authentication / authorization
  • Conversations / streaming
  • Files / RAG / extraction
  • Model routing / providers
  • MCP / tools
  • Billing / payments
  • Admin console
  • Deployment / Docker / configuration
  • Documentation

Verification

  • cd backend && go test ./...
  • cd frontend && pnpm lint
  • git diff --check

Screenshots, API examples, or logs

No screenshots included. This change adds admin configuration fields and backend prompt resolution behavior.

Configuration, migration, and compatibility notes

Adds a new runtime setting: chat.default_system_prompt.

Adds systemPrompt to admin model create/update/list API contracts and generated Swagger docs.

Adds system_prompt to platform model persistence. Existing models default to an empty prompt, so existing behavior is unchanged unless a global or model-level prompt is configured.

User-level system prompts are not included. Prompt precedence is: global default prompt, then model-level prompt.

Documentation

  • Documentation is not needed for this change.
  • Documentation was updated.
  • Documentation still needs to be updated.

Security and privacy

  • No secrets, tokens, credentials, local config, or personal data are included.
  • User data access remains scoped by authenticated user context unless an admin-only path explicitly requires broader access.
  • Security-sensitive behavior was reviewed, including authentication, authorization, provider routing, file processing, billing, and admin APIs where relevant.

Checklist

  • I searched existing issues and pull requests.
  • Changes are focused and do not include unrelated refactors.
  • Tests or static verification were run where practical.
  • User-facing behavior, deployment steps, API contracts, or configuration changes are documented.
  • Generated artifacts are included only when this project explicitly requires them.
  • Caches, build output, .pyc files, .env files, and local storage data are not committed.

@chenyme chenyme linked an issue May 23, 2026 that may be closed by this pull request
3 tasks
@chenyme
chenyme merged commit e1c74bb into dev May 23, 2026
2 checks passed
@chenyme
chenyme deleted the support_system_prompt branch May 23, 2026 09:51
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.

[Feature]: 支持模型级和用户级系统提示词

1 participant