fix(prompts): allow saving prompts with empty content

Remove content validation requirement to allow users to save prompts
with empty content for placeholder or draft purposes.
This commit is contained in:
Jason
2026-01-05 23:30:03 +08:00
parent 671cda60d9
commit 0020889a8f
2 changed files with 4 additions and 4 deletions

View File

@@ -68,7 +68,7 @@ const PromptFormModal: React.FC<PromptFormModalProps> = ({
}, [initialData]); }, [initialData]);
const handleSave = async () => { const handleSave = async () => {
if (!name.trim() || !content.trim()) { if (!name.trim()) {
return; return;
} }
@@ -147,7 +147,7 @@ const PromptFormModal: React.FC<PromptFormModalProps> = ({
<Button <Button
type="button" type="button"
onClick={handleSave} onClick={handleSave}
disabled={!name.trim() || !content.trim() || saving} disabled={!name.trim() || saving}
> >
{saving ? t("common.saving") : t("common.save")} {saving ? t("common.saving") : t("common.save")}
</Button> </Button>

View File

@@ -60,7 +60,7 @@ const PromptFormPanel: React.FC<PromptFormPanelProps> = ({
}, [initialData]); }, [initialData]);
const handleSave = async () => { const handleSave = async () => {
if (!name.trim() || !content.trim()) { if (!name.trim()) {
return; return;
} }
@@ -99,7 +99,7 @@ const PromptFormPanel: React.FC<PromptFormPanelProps> = ({
<Button <Button
type="button" type="button"
onClick={handleSave} onClick={handleSave}
disabled={!name.trim() || !content.trim() || saving} disabled={!name.trim() || saving}
className="bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed" className="bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed"
> >
{saving ? t("common.saving") : t("common.save")} {saving ? t("common.saving") : t("common.save")}