feat: Prompts Atomic PR of #20243 (#20368)

* feat: Add read-only access support for Prompts

- Backend: Add write_access field to PromptAccessResponse
- Backend: Update /prompts/list to return prompts with write_access
- Frontend: Display Read Only badge in Prompts list
- Frontend: Disable inputs and save button when no write access

* feat: Add read-only visual indicators for Prompts workspace

* fix: Return write_access from getPromptByCommand endpoint

- Backend returns write_access directly in response
- Frontend extracts write_access from getPromptByCommand response
- Remove inefficient getPromptList call in edit page

* fix: Align Read Only badge to right in Prompts.svelte

- Title and command stay on left
- Badge pushed to right by justify-between

* fix: Use PromptAccessResponse in get_prompt_by_command endpoint

fix: Use PromptAccessResponse in get_prompt_by_command endpoint

- Return PromptAccessResponse Pydantic model instead of raw dict
- Properly type the response with response_model
This commit is contained in:
Classic298
2026-01-05 04:36:13 +04:00
committed by GitHub
parent b55a46ae99
commit 1f059fe730
5 changed files with 85 additions and 45 deletions
@@ -12,6 +12,8 @@
import PromptEditor from '$lib/components/workspace/Prompts/PromptEditor.svelte';
let prompt = null;
let write_access = true;
const onSubmit = async (_prompt) => {
console.log(_prompt);
const prompt = await updatePromptByCommand(localStorage.token, _prompt).catch((error) => {
@@ -38,6 +40,7 @@
});
if (_prompt) {
write_access = _prompt.write_access ?? true;
prompt = {
title: _prompt.title,
command: _prompt.command,
@@ -54,5 +57,5 @@
</script>
{#if prompt}
<PromptEditor {prompt} {onSubmit} edit />
<PromptEditor {prompt} {onSubmit} {write_access} edit />
{/if}