fix(ios): QuizGenerateRequest Codable 替代 [String: Any]

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-05-30 09:06:36 +08:00
parent 9dfc1e1954
commit d1b3ac160a
2 changed files with 7 additions and 1 deletions

View File

@ -446,6 +446,11 @@ struct QuizAnswer: Codable, Identifiable {
let question: QuizQuestion?
}
struct QuizGenerateRequest: Codable {
let knowledgeBaseId: String
let questionCount: Int
}
struct QuizSubmitRequest: Codable {
let attemptId: String
let answers: [QuizAnswerItem]

View File

@ -453,7 +453,8 @@ class QuizService {
private let client = APIClient.shared
func generate(knowledgeBaseId: String, questionCount: Int = 5) async throws -> Quiz {
return try await client.request("/quizzes", method: "POST", body: ["knowledgeBaseId": knowledgeBaseId, "questionCount": questionCount] as [String: Any])
let body = QuizGenerateRequest(knowledgeBaseId: knowledgeBaseId, questionCount: questionCount)
return try await client.request("/quizzes", method: "POST", body: body)
}
func list(knowledgeBaseId: String? = nil) async throws -> [Quiz] {