Implement optional discussion mode
This commit is contained in:
@@ -24,6 +24,24 @@ final class AIServiceTests: XCTestCase {
|
||||
XCTAssertEqual(result.followUpQuestions, ["Should the chorus be bigger?"])
|
||||
}
|
||||
|
||||
func testProviderIndependentServiceReturnsDiscussionQuestionsWithoutProjectUpdate() async throws {
|
||||
let service = MockAIService()
|
||||
let project = SongProject(
|
||||
title: "Discussion Project",
|
||||
idea: "Plan the chorus",
|
||||
conversationMode: .discuss
|
||||
)
|
||||
let request = SongProjectDiscussionRequest(
|
||||
context: AIRequestContext(userInstruction: "Ask what is still missing."),
|
||||
project: project
|
||||
)
|
||||
|
||||
let result = try await service.discussSongProject(from: request)
|
||||
|
||||
XCTAssertEqual(result.questions, ["Which vocal delivery should lead the chorus?"])
|
||||
XCTAssertEqual(result.notes, ["Discussion only; no project update was proposed."])
|
||||
}
|
||||
|
||||
func testProviderIndependentServiceRevisesLyricsWithStructuredResult() async throws {
|
||||
let service = MockAIService()
|
||||
let project = SongProject(title: "Lyric Project", idea: "Improve words")
|
||||
@@ -71,6 +89,13 @@ private struct MockAIService: AIService {
|
||||
)
|
||||
}
|
||||
|
||||
func discussSongProject(from request: SongProjectDiscussionRequest) async throws -> SongProjectDiscussionResult {
|
||||
SongProjectDiscussionResult(
|
||||
questions: ["Which vocal delivery should lead the chorus?"],
|
||||
notes: ["Discussion only; no project update was proposed."]
|
||||
)
|
||||
}
|
||||
|
||||
func reviseLyrics(from request: LyricsRevisionRequest) async throws -> LyricsRevisionResult {
|
||||
LyricsRevisionResult(
|
||||
lyrics: Lyrics(text: "\(request.sourceLyrics.text)\n\(request.context.userInstruction)"),
|
||||
|
||||
Reference in New Issue
Block a user