这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ArturTask
Copy link

Pull Request Type

  • ✨ feat

Relevant Issues

resolves #3906

What is in this change?

#3906

short description

adds default system prompt (locale dependent + all locale translations of previous default system prompt) + general (global) configurable system prompt for ALL workspaces (admin or manager may configure general system prompt instead of default one which will be used by default in all workspaces)

I tested the code on local machine + tested docker-compose version new changes work as planned

More specifically added:

  • configurable global system prompt (I called it "general_system_prompt")
  • default system prompt for all locales + changing it on server when changing locale on frontend
  • full rus localization

Additional Information

about me (just in case)

  • I'm JAVA BACKEND developer) not js, sorry if something is incorrect, I tried my best
  • I'm from Russia, again sorry for misspelling
  • I worked as full stack dev and had few little pet projects using React that's why I have some experience

new things

  • new component for configuring general system prompt ...components/GeneralSystemPrompt/index.jsx
  • 2 new util classes for retrieving general or default system prompt (systemPromptHelper.js on server) / sending default system prompt to server (systemPrompt.js on frontend)
  • 2 new system_settings: "general_system_prompt" and "default_system_prompt"
  • all locales have their own locale dependent default_system_prompt property customization.items.system-prompt.default + title and description

important changes:

  • I moved chatPrompt function (from index.js to systemPromptHelper.js) because of cyclic dependency (couldn't import SystemSettings.js to index.js)
  • 2 events on language setting and changing (in i18n.js) => frontend sends default system prompt to server

(unfortunately I found no other way because locale is located on frontend part, the only way to have locale dependent
default system prompt is to synchronise frontend and server, so
I decided to store it in DB in system_settings as default_system_prompt and change on language change

  • changed signature of function buildSystemPrompt in convertTo.js (now async)
  • I DIDN'T TEST csv downloadning, I just didn't find it

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

@ArturTask
Copy link
Author

needs review

@timothycarambat
Copy link
Member

moved to #4487

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.

[FEAT]: Add a Global prompt

2 participants