fix: 优化生成 Prompt 的标题映射,移除技术术语
- 标签约束 → 约束 - 用户自定义内容 → 自定义内容 - 片段内容 → 参考片段 - 片段: xxx → xxx(去掉前缀) - 智能建议补充 → 补充建议
This commit is contained in:
+5
-5
@@ -339,7 +339,7 @@
|
|||||||
// Custom content
|
// Custom content
|
||||||
const customContent = document.getElementById('custom-content').value.trim();
|
const customContent = document.getElementById('custom-content').value.trim();
|
||||||
if (customContent) {
|
if (customContent) {
|
||||||
parts.push(`## 用户自定义内容\n\n${customContent}`);
|
parts.push(`## 自定义内容\n\n${customContent}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tag constraints
|
// Tag constraints
|
||||||
@@ -352,7 +352,7 @@
|
|||||||
tagConstraints.push(`- ${option.constraint_text}`);
|
tagConstraints.push(`- ${option.constraint_text}`);
|
||||||
}
|
}
|
||||||
if (tagConstraints.length > 0) {
|
if (tagConstraints.length > 0) {
|
||||||
parts.push(`## 标签约束\n\n${tagConstraints.join('\n')}`);
|
parts.push(`## 约束\n\n${tagConstraints.join('\n')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Snippets
|
// Snippets
|
||||||
@@ -361,18 +361,18 @@
|
|||||||
.sort((a, b) => a.sortOrder - b.sortOrder)
|
.sort((a, b) => a.sortOrder - b.sortOrder)
|
||||||
.map(s => {
|
.map(s => {
|
||||||
const snippet = allSnippets.find(sn => sn.id === s.snippetId);
|
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);
|
.filter(Boolean);
|
||||||
if (snippetParts.length > 0) {
|
if (snippetParts.length > 0) {
|
||||||
parts.push(`## 片段内容\n\n${snippetParts.join('\n\n')}`);
|
parts.push(`## 参考片段\n\n${snippetParts.join('\n\n')}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Suggestions
|
// Suggestions
|
||||||
const adoptedSuggestions = suggestions.filter(s => s.adopted);
|
const adoptedSuggestions = suggestions.filter(s => s.adopted);
|
||||||
if (adoptedSuggestions.length > 0) {
|
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...';
|
const preview = parts.length > 0 ? parts.join('\n\n') : '选择标签和片段后,这里将实时预览最终的 Prompt...';
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ func AssemblePrompt(projectName string, customContent string, tagOptions []model
|
|||||||
|
|
||||||
// Custom content
|
// Custom content
|
||||||
if customContent != "" {
|
if customContent != "" {
|
||||||
parts = append(parts, fmt.Sprintf("## 用户自定义内容\n\n%s", customContent))
|
parts = append(parts, fmt.Sprintf("## 自定义内容\n\n%s", customContent))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tag constraints
|
// Tag constraints
|
||||||
@@ -219,21 +219,21 @@ func AssemblePrompt(projectName string, customContent string, tagOptions []model
|
|||||||
for _, opt := range tagOptions {
|
for _, opt := range tagOptions {
|
||||||
constraints = append(constraints, fmt.Sprintf("- %s", opt.ConstraintText))
|
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
|
// Snippets
|
||||||
if len(snippets) > 0 {
|
if len(snippets) > 0 {
|
||||||
var snippetParts []string
|
var snippetParts []string
|
||||||
for _, s := range snippets {
|
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
|
// Suggestions
|
||||||
if len(suggestions) > 0 {
|
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")
|
return strings.Join(parts, "\n\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user