fix: 优化生成 Prompt 的标题映射,移除技术术语

- 标签约束 → 约束
- 用户自定义内容 → 自定义内容
- 片段内容 → 参考片段
- 片段: xxx → xxx(去掉前缀)
- 智能建议补充 → 补充建议
This commit is contained in:
2026-06-26 16:05:59 +08:00
parent 1e3aa9b06b
commit b23ed28b88
2 changed files with 10 additions and 10 deletions
+5 -5
View File
@@ -339,7 +339,7 @@
// Custom content
const customContent = document.getElementById('custom-content').value.trim();
if (customContent) {
parts.push(`## 用户自定义内容\n\n${customContent}`);
parts.push(`## 自定义内容\n\n${customContent}`);
}
// Tag constraints
@@ -352,7 +352,7 @@
tagConstraints.push(`- ${option.constraint_text}`);
}
if (tagConstraints.length > 0) {
parts.push(`## 标签约束\n\n${tagConstraints.join('\n')}`);
parts.push(`## 约束\n\n${tagConstraints.join('\n')}`);
}
// Snippets
@@ -361,18 +361,18 @@
.sort((a, b) => a.sortOrder - b.sortOrder)
.map(s => {
const snippet = allSnippets.find(sn => sn.id === s.snippetId);
return snippet ? `--- 片段: ${snippet.name} ---\n${snippet.content}` : '';
return snippet ? `--- ${snippet.name} ---\n${snippet.content}` : '';
})
.filter(Boolean);
if (snippetParts.length > 0) {
parts.push(`## 片段内容\n\n${snippetParts.join('\n\n')}`);
parts.push(`## 参考片段\n\n${snippetParts.join('\n\n')}`);
}
}
// Suggestions
const adoptedSuggestions = suggestions.filter(s => s.adopted);
if (adoptedSuggestions.length > 0) {
parts.push(`## 智能建议补充\n\n${adoptedSuggestions.map(s => s.constraint_text).join('\n')}`);
parts.push(`## 补充建议\n\n${adoptedSuggestions.map(s => s.constraint_text).join('\n')}`);
}
const preview = parts.length > 0 ? parts.join('\n\n') : '选择标签和片段后,这里将实时预览最终的 Prompt...';
+5 -5
View File
@@ -210,7 +210,7 @@ func AssemblePrompt(projectName string, customContent string, tagOptions []model
// Custom content
if customContent != "" {
parts = append(parts, fmt.Sprintf("## 用户自定义内容\n\n%s", customContent))
parts = append(parts, fmt.Sprintf("## 自定义内容\n\n%s", customContent))
}
// Tag constraints
@@ -219,21 +219,21 @@ func AssemblePrompt(projectName string, customContent string, tagOptions []model
for _, opt := range tagOptions {
constraints = append(constraints, fmt.Sprintf("- %s", opt.ConstraintText))
}
parts = append(parts, fmt.Sprintf("## 标签约束\n\n%s", strings.Join(constraints, "\n")))
parts = append(parts, fmt.Sprintf("## 约束\n\n%s", strings.Join(constraints, "\n")))
}
// Snippets
if len(snippets) > 0 {
var snippetParts []string
for _, s := range snippets {
snippetParts = append(snippetParts, fmt.Sprintf("--- 片段: %s ---\n%s", s.Name, s.Content))
snippetParts = append(snippetParts, fmt.Sprintf("--- %s ---\n%s", s.Name, s.Content))
}
parts = append(parts, fmt.Sprintf("## 片段内容\n\n%s", strings.Join(snippetParts, "\n\n")))
parts = append(parts, fmt.Sprintf("## 参考片段\n\n%s", strings.Join(snippetParts, "\n\n")))
}
// Suggestions
if len(suggestions) > 0 {
parts = append(parts, fmt.Sprintf("## 智能建议补充\n\n%s", strings.Join(suggestions, "\n")))
parts = append(parts, fmt.Sprintf("## 补充建议\n\n%s", strings.Join(suggestions, "\n")))
}
return strings.Join(parts, "\n\n")