fix(ios): QuizGenerateRequest Codable 替代 [String: Any]
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
9dfc1e1954
commit
d1b3ac160a
@ -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]
|
||||
|
||||
@ -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] {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user