Skip to content

Feat/custom system prompts - #437

Open
astkwcz wants to merge 6 commits into
nextcloud:mainfrom
astkwcz:feat/custom-system-prompts
Open

astkwcz wants to merge 6 commits into
nextcloud:mainfrom
astkwcz:feat/custom-system-prompts

Conversation

@astkwcz

@astkwcz astkwcz commented Sep 25, 2026

Copy link
Copy Markdown

Configurable system prompts for summary and translation tasks

Earlier work:

Related work:
There is already merged functionality for configurable system prompts set by admin #433 (@Abhijeet-035, @lukasdotcom) introduces that, so I think that I should explain myself and my work a little, considering SummaryProvider
I started working on this PR before #433 was merged, so those two PRs overlap. I implemented the prompt per service using ServiceConfig which is why instance-wide setting from #433 is reverted. I reverted it to keep one place in UI instead of two. I am happy to keep global default as fallback if you prefer.

Summary system prompts

There are 3 types of system prompts configuration:

  • user system prompt (Advanced options in Assistant UI)
  • admin system prompt (that can be set in Admin Settings > Assistant)
  • default system prompt (hard-coded in repo: You are a helpful assistant that summarizes text in the same language as the text. You should only return the summary without any additional information.

How it works:

  • user system prompt (if set) overrides admin system prompt (if set) and default system prompt . It also ignores format and complexity options. The idea is that user knows what they want and the can define thiers output format however they wants
  • admin system prompt (if set) overwrites default system prompt and can be overwritten by user system prompt (if set). It appends format and complexity option, so the idea is that prompt should be more general and should not define format and complexity
  • default system prompt will be used only if user system prompt and admin system prompt are not set

Translation system prompt

I introduce that because I had troubles with translation. Sometimes model outputs only translated text and sometimes it outputs orginal text + translation line by line. It was not coherent

UI look

Admin system prompts for summarization and translation

image
  • Textareas are under the section System prompts
  • It is nested inside Text generation so if we toggle that off, System prompts will not be visible

User defined system prompt for summary

image

…n/default

Signed-off-by: Arkadiusz Sitkiewicz <a.sitkiewicz@wbgroup.com>
…dmin/default

Signed-off-by: Arkadiusz Sitkiewicz <a.sitkiewicz@wbgroup.com>
…er/admin

Signed-off-by: Arkadiusz Sitkiewicz <a.sitkiewicz@wbgroup.com>
…pt - admin

Signed-off-by: Arkadiusz Sitkiewicz <a.sitkiewicz@wbgroup.com>

@edward-ly edward-ly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, thanks a lot for tackling this! We've been discussing the changes internally, and while we agree that it would be nice for admins to be able to customize the system prompts, we're not sure if we can say the same for normal users. Not only does it add additional, unneeded complexity for users, we don't see any meaningful use cases for it either. Would you be able to remove the user part from this PR or, at the very least, split the user part into a separate PR and add more justifications to it?

Signed-off-by: Arkadiusz Sitkiewicz <a.sitkiewicz@wbgroup.com>
@astkwcz

astkwcz commented Oct 9, 2026

Copy link
Copy Markdown
Author

Hello, thanks a lot for tackling this! We've been discussing the changes internally, and while we agree that it would be nice for admins to be able to customize the system prompts, we're not sure if we can say the same for normal users. Not only does it add additional, unneeded complexity for users, we don't see any meaningful use cases for it either. Would you be able to remove the user part from this PR or, at the very least, split the user part into a separate PR and add more justifications to it?

@edward-ly Hi, thanks for your feedback. I removed user-defined summary system prompt option from this PR. I added a new PR #444 with user-defined summary system prompt option and justification - it is stacked on #437

@astkwcz
astkwcz requested a review from edward-ly October 9, 2026 11:55

@edward-ly edward-ly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great in my testing so far! Just a few small changes and we can get this in. On top of my other comments, the initial revert commit is missing a sign-off trailer, so that should be fixed too.

Also, since this is your first contribution, I recommend reviewing our AI Contributions Policy in case you haven't seen it yet. I don't know for certain if you've used any AI assistance for this PR, but I would appreciate any disclosures if you did (or if you didn't, an explicit mention stating that).

Comment on lines +368 to +373
/**
* The admin-configured system prompt appended to the built-in translation
* prompt for the translation task type. The built-in prompt is always kept,
* as it enforces the expected JSON response format.
* An empty string means only the built-in prompt is used.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment isn't relevant to this particular function. Also, I think the code is TranslateService is clear enough to know what is happening, so I don't think it's necessary either.

Comment on lines +360 to +363
/**
* The admin-configured fallback system prompt for the summary task type.
* An empty string means the built-in default prompt is used.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment isn't relevant to this particular function. Plus, it is redundant anyway, so it should be removed.

Comment on lines -494 to -500
.line--full {
width: 100%;
}

.line .input--full {
width: 100%;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the new text boxes should keep their full width too. The current boxes are too small to comfortably fit longer prompts.

@github-actions

Copy link
Copy Markdown

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants