feat(dashboard): edit + bind system prompt from the agent detail drawer#6201
Merged
Conversation
The Agents page showed the system prompt read-only, and the Prompts modal's activate only flipped the store is_active flag without changing the live prompt the agent sends to the LLM. The Hands page already had a full inline editor (#6151 / #6166), so the two pages were inconsistent. Convert SystemPromptSection into an inline editor mirroring the Hands page: edit and save via PATCH /api/agents/{id}, or open the prompt library and bind a saved version via useBindPromptVersionToAgent, which hot-swaps the live system_prompt and flips is_active together. The section now always renders so an agent with no prompt yet can have one added. Dashboard-only; the backend update_system_prompt path is unchanged. i18n added to en/zh/uk; the editor is covered by a new AgentsPage.test.tsx (save PATCHes system_prompt; bind dispatches the version). Closes #6187
# Conflicts: # .secrets.baseline
houko
enabled auto-merge (squash)
June 19, 2026 04:50
Deploying librefang with
|
| Latest commit: |
4b17822
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8ffa7889.librefang-7oe.pages.dev |
| Branch Preview URL: | https://feat-6187-agents-prompt-edit.librefang-7oe.pages.dev |
Deploying librefang-docs with
|
| Latest commit: |
4b17822
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://43812edf.librefang-docs.pages.dev |
| Branch Preview URL: | https://feat-6187-agents-prompt-edit.librefang-docs.pages.dev |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #6187. The Agents (智能体) detail drawer showed the system prompt read-only, and the "Prompts" modal's activate only flipped the store's
is_activeflag — it did not change the live prompt the agent sends to the LLM (documented gap inuseBindPromptVersionToAgent). The Hands page already shipped a full inline editor (#6151 / #6166), so the two pages were inconsistent. The issue screenshot asks for exactly this on the Agents page: view/modify the prompt or bind one from the prompt library (提示词库).Changes (dashboard-only)
src/pages/AgentsPage.tsx—SystemPromptSectionbecomes an inline editor mirroring the Hands page:usePatchAgent→PATCH /api/agents/{id}(system_prompt); Save is disabled until dirty.usePromptVersions, fetched lazily on open) with loading / empty / error states; binding a version callsuseBindPromptVersionToAgent, which hot-swaps the livesystem_promptand flipsis_activetogether — fixing the activate-only-flag gap.src/locales/{en,zh,uk}.json— newagents.*keys (no hardcoded strings).src/pages/AgentsPage.test.tsx— new focused test for the exportedSystemPromptSection: Save is disabled until edited; editing + Save PATCHessystem_prompt; binding a library version dispatches the version. (AgentsPage had no test harness; testing the component directly follows the data-layer rule without standing up the whole ~20-hook page.)No backend change —
update_system_prompt(lifecycle.rs) already supports both paths.Verification