Add section performance directives
This commit is contained in:
@@ -30,15 +30,20 @@ public struct SongProjectPromptCompiler: PromptCompiling {
|
||||
}
|
||||
|
||||
return project.orderedSections
|
||||
.compactMap { section in
|
||||
let lyrics = project.lyrics.sectionTexts[section.id] ?? section.lyrics
|
||||
let trimmedLyrics = lyrics.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !trimmedLyrics.isEmpty else { return nil }
|
||||
return "[\(section.title)]\n\(trimmedLyrics)"
|
||||
}
|
||||
.compactMap { sectionLyricsBlock(for: $0, project: project) }
|
||||
.joined(separator: "\n\n")
|
||||
}
|
||||
|
||||
private func sectionLyricsBlock(for section: SongSection, project: SongProject) -> String? {
|
||||
let lyrics = project.lyrics.sectionTexts[section.id] ?? section.lyrics
|
||||
let trimmedLyrics = lyrics.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !trimmedLyrics.isEmpty else { return nil }
|
||||
|
||||
let performanceDirective = normalized(section.vocalDirection)
|
||||
let header = performanceDirective.map { "[\(section.title) - \($0)]" } ?? "[\(section.title)]"
|
||||
return "\(header)\n\(trimmedLyrics)"
|
||||
}
|
||||
|
||||
private func stylePrompt(for project: SongProject) -> String {
|
||||
let context = SongGenerationContext(project: project)
|
||||
var components: [String] = []
|
||||
|
||||
Reference in New Issue
Block a user