-
- 自定义标签
-
-
- {tags.map(tag => (
-
- ))}
-
+
setInput(e.target.value)}
onKeyDown={handleKeyDown}
- placeholder="输入标签后按 Enter 添加"
+ placeholder="输入自定义标签后按 Enter 添加"
style={{ flex: 1, padding: '6px 10px', fontSize: 13 }}
/>
diff --git a/frontend/src/components/ProjectConfigPanel.tsx b/frontend/src/components/ProjectConfigPanel.tsx
index b0158a3..a5384b1 100644
--- a/frontend/src/components/ProjectConfigPanel.tsx
+++ b/frontend/src/components/ProjectConfigPanel.tsx
@@ -2,7 +2,7 @@ import { useEffect } from 'react'
import { useParams } from 'react-router-dom'
import { useProjectStore } from '../stores/project'
import { useToastStore } from '../stores/toast'
-import { PROJECT_TYPES, PROJECT_TYPE_KEY } from '../utils/style'
+import { PROJECT_TYPES, PROJECT_TYPE_KEY, getCustomTags } from '../utils/style'
import StyleSelector from './StyleSelector'
import CustomTagsEditor from './CustomTagsEditor'
import Skeleton from './Skeleton'
@@ -82,6 +82,7 @@ export default function ProjectConfigPanel() {
label: '工程类型',
options: PROJECT_TYPES.map(p => ({ value: p.value, label: p.label })),
}]}
+ customTags={getCustomTags(draftStyle)}
/>
diff --git a/frontend/src/components/PromptEditor.tsx b/frontend/src/components/PromptEditor.tsx
index fbd43fc..27ecaef 100755
--- a/frontend/src/components/PromptEditor.tsx
+++ b/frontend/src/components/PromptEditor.tsx
@@ -1,4 +1,4 @@
-import { STYLE_CATEGORIES, PROJECT_TYPES, PROJECT_TYPE_KEY, getCustomTags } from '../utils/style'
+import { STYLE_CATEGORIES, PROJECT_TYPES, PROJECT_TYPE_KEY, CUSTOM_PREFIX, getCustomTags } from '../utils/style'
import styles from './GenerateForm.module.css'
interface PromptEditorProps {
@@ -32,7 +32,9 @@ function styleToDescription(kvPairs: Record
): string {
if (option) parts.push(`${cat.label}: ${option.label}`)
}
- const customTags = getCustomTags(kvPairs)
+ const customTags = getCustomTags(kvPairs).filter(
+ tag => kvPairs[`${CUSTOM_PREFIX}${tag}`] === 'true'
+ )
if (customTags.length > 0) parts.push(`标签: ${customTags.join(', ')}`)
return parts.join(', ')
diff --git a/frontend/src/components/StyleSelector.tsx b/frontend/src/components/StyleSelector.tsx
index 06a7578..d995d26 100755
--- a/frontend/src/components/StyleSelector.tsx
+++ b/frontend/src/components/StyleSelector.tsx
@@ -1,5 +1,5 @@
import type { StyleCategory } from '../utils/style'
-import { STYLE_CATEGORIES } from '../utils/style'
+import { STYLE_CATEGORIES, CUSTOM_PREFIX } from '../utils/style'
import styles from './StyleSelector.module.css'
interface StyleSelectorProps {
@@ -7,6 +7,13 @@ interface StyleSelectorProps {
onChange: (key: string, value: string) => void
compact?: boolean
categories?: StyleCategory[]
+ customTags?: string[]
+}
+
+const CUSTOM_TAG_CATEGORY: StyleCategory = {
+ key: '', // unused, pills use custom: prefix directly
+ label: '自定义标签',
+ options: [],
}
export default function StyleSelector({
@@ -14,6 +21,7 @@ export default function StyleSelector({
onChange,
compact,
categories,
+ customTags,
}: StyleSelectorProps) {
const cats = categories ?? STYLE_CATEGORIES
return (
@@ -37,6 +45,27 @@ export default function StyleSelector({