Persist selections and compile song output

This commit is contained in:
diyaa
2026-09-14 21:56:26 +02:00
parent 35703f89a8
commit 7bf4df79f9
10 changed files with 490 additions and 11 deletions
@@ -65,15 +65,20 @@ public struct SongProjectGenerationRequest: Equatable, Sendable {
public var context: AIRequestContext
public var seedProject: SongProject?
public var discussionMode: ConversationMode
public var songGenerationContext: SongGenerationContext
public init(
context: AIRequestContext,
seedProject: SongProject? = nil,
discussionMode: ConversationMode = .auto
discussionMode: ConversationMode = .auto,
songGenerationContext: SongGenerationContext? = nil
) {
self.context = context
self.seedProject = seedProject
self.discussionMode = discussionMode
self.songGenerationContext = songGenerationContext
?? seedProject.map(SongGenerationContext.init(project:))
?? .empty
}
}
@@ -96,10 +101,16 @@ public struct SongProjectGenerationResult: Equatable, Sendable {
public struct SongProjectDiscussionRequest: Equatable, Sendable {
public var context: AIRequestContext
public var project: SongProject
public var songGenerationContext: SongGenerationContext
public init(context: AIRequestContext, project: SongProject) {
public init(
context: AIRequestContext,
project: SongProject,
songGenerationContext: SongGenerationContext? = nil
) {
self.context = context
self.project = project
self.songGenerationContext = songGenerationContext ?? SongGenerationContext(project: project)
}
}
@@ -118,17 +129,20 @@ public struct LyricsRevisionRequest: Equatable, Sendable {
public var project: SongProject
public var sourceLyrics: Lyrics
public var mode: LyricsRevisionMode
public var songGenerationContext: SongGenerationContext
public init(
context: AIRequestContext,
project: SongProject,
sourceLyrics: Lyrics,
mode: LyricsRevisionMode
mode: LyricsRevisionMode,
songGenerationContext: SongGenerationContext? = nil
) {
self.context = context
self.project = project
self.sourceLyrics = sourceLyrics
self.mode = mode
self.songGenerationContext = songGenerationContext ?? SongGenerationContext(project: project)
}
}
@@ -154,15 +168,18 @@ public struct SongProjectUpdateRequest: Equatable, Sendable {
public var context: AIRequestContext
public var project: SongProject
public var allowedScopes: [SongProjectUpdateScope]
public var songGenerationContext: SongGenerationContext
public init(
context: AIRequestContext,
project: SongProject,
allowedScopes: [SongProjectUpdateScope]
allowedScopes: [SongProjectUpdateScope],
songGenerationContext: SongGenerationContext? = nil
) {
self.context = context
self.project = project
self.allowedScopes = allowedScopes
self.songGenerationContext = songGenerationContext ?? SongGenerationContext(project: project)
}
}