Fixes #27 — AI-generated example sentences on verb detail
Tapping a verb now shows six example sentences beneath the conjugation table, one per core tense (Present, Preterite, Imperfect, Future, Present Subjunctive, Imperative). Each example renders the tense label, Spanish sentence, and English translation in the DeckStudyView style. Generation uses Foundation Models with a @Generable schema that pins each response to the requested tenseId and forces tú/nosotros subjects for imperatives. Results are cached as JSON in the Caches directory keyed by verb id (DictionaryService pattern); cache misses regenerate on demand. Devices without Apple Intelligence see an inline notice instead of the loading state. No network dependency. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
17
Conjuga/SharedModels/Sources/SharedModels/VerbExample.swift
Normal file
17
Conjuga/SharedModels/Sources/SharedModels/VerbExample.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
import Foundation
|
||||
|
||||
/// A single Spanish / English example sentence pair for a verb at a specific tense.
|
||||
/// Used by the Verb detail view (Issue #27). Generated at runtime via Foundation
|
||||
/// Models and cached to disk; shape is intentionally simple Codable for easy
|
||||
/// JSON persistence and cross-module sharing.
|
||||
public struct VerbExample: Codable, Hashable, Sendable {
|
||||
public let tenseId: String
|
||||
public let spanish: String
|
||||
public let english: String
|
||||
|
||||
public init(tenseId: String, spanish: String, english: String) {
|
||||
self.tenseId = tenseId
|
||||
self.spanish = spanish
|
||||
self.english = english
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user