@eliceio/cdk-cli 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -16
- package/es/cli.js +1 -1
- package/es/commands/create/index.js +1 -0
- package/es/commands/create/scaffold.d.ts +1 -1
- package/es/commands/create/scaffold.js +1 -1
- package/es/core/config.d.ts +36 -0
- package/es/core/config.js +234 -6
- package/es/core/quiz-check.js +123 -4
- package/es/dev/grading.d.ts +26 -4
- package/es/dev/grading.js +66 -11
- package/es/dev/mock-api.d.ts +6 -1
- package/es/dev/mock-api.js +45 -6
- package/es/rules/answers.d.ts +1 -0
- package/es/rules/answers.js +8 -0
- package/es/rules.json.js +1 -1
- package/package.json +2 -2
- package/rules.json +1 -1
- package/skills/_shared/always.md +1 -1
- package/skills/_shared/references/02-design-the-material.md +8 -7
- package/skills/_shared/references/03-create-the-project.md +10 -9
- package/skills/_shared/references/12-upload-with-the-material-mcp.md +5 -5
- package/skills/_shared/references/16-using-the-survey-template.md +158 -0
- package/skills/elice-content-create/SKILL.md +2 -2
- package/skills/elice-content-edit/SKILL.md +2 -2
- package/skills/elice-content-publish/SKILL.md +1 -1
- package/templates/_shared/lib/cdk-mock.d.ts +22 -3
- package/templates/_shared/lib/cdk-mock.js +78 -11
- package/templates/_shared/lib/elice-content.d.ts +17 -1
- package/templates/_shared/lib/elice-content.js +47 -5
- package/templates/blank/template.json +1 -1
- package/templates/document/template.json +2 -2
- package/templates/quiz/README.md +26 -1
- package/templates/quiz/core/behaviors.d.ts +5 -0
- package/templates/quiz/core/behaviors.js +16 -1
- package/templates/quiz/core/model.d.ts +78 -1
- package/templates/quiz/core/model.js +219 -4
- package/templates/quiz/screens/edit.js +244 -55
- package/templates/quiz/screens/learn.js +137 -27
- package/templates/quiz/styles.css +258 -5
- package/templates/quiz/template.json +1 -1
- package/templates/quiz/ui/templates/edit.d.ts +1 -0
- package/templates/quiz/ui/templates/edit.js +67 -8
- package/templates/quiz/ui/templates/page.js +34 -0
- package/templates/quiz/ui/templates/text.js +15 -2
- package/templates/quiz/ui/texts.js +61 -0
- package/templates/steps/template.json +1 -1
- package/templates/survey/README.md +112 -0
- package/templates/survey/commentary.txt +2 -0
- package/templates/survey/core/behaviors.d.ts +14 -0
- package/templates/survey/core/behaviors.js +115 -0
- package/templates/survey/core/dom.d.ts +13 -0
- package/templates/survey/core/dom.js +83 -0
- package/templates/survey/core/editor.d.ts +80 -0
- package/templates/survey/core/editor.js +720 -0
- package/templates/survey/core/markdown.d.ts +21 -0
- package/templates/survey/core/markdown.js +298 -0
- package/templates/survey/core/model.d.ts +83 -0
- package/templates/survey/core/model.js +209 -0
- package/templates/survey/core/rich-text.d.ts +18 -0
- package/templates/survey/core/rich-text.js +469 -0
- package/templates/survey/edit.html +26 -0
- package/templates/survey/gitignore +4 -0
- package/templates/survey/index.html +26 -0
- package/templates/survey/metadata.json +9 -0
- package/templates/survey/package.json +13 -0
- package/templates/survey/screens/edit.js +345 -0
- package/templates/survey/screens/learn.js +100 -0
- package/templates/survey/styles.css +1264 -0
- package/templates/survey/template.json +12 -0
- package/templates/survey/ui/templates/edit.d.ts +27 -0
- package/templates/survey/ui/templates/edit.js +656 -0
- package/templates/survey/ui/templates/index.d.ts +3 -0
- package/templates/survey/ui/templates/index.js +3 -0
- package/templates/survey/ui/templates/learn.js +147 -0
- package/templates/survey/ui/templates/page.js +19 -0
- package/templates/survey/ui/texts.d.ts +3 -0
- package/templates/survey/ui/texts.js +116 -0
- package/templates/survey/ui/theme.css +42 -0
- package/templates/video/template.json +1 -1
|
@@ -31,6 +31,8 @@ export interface SubmitResult {
|
|
|
31
31
|
score: number | null;
|
|
32
32
|
/** partial_pattern 문항별 맞음 (answer_key 순서, 없는 답은 false). pattern · rubric · 채점 없음은 [] (옛 서버는 없음) */
|
|
33
33
|
answerCorrectness?: boolean[];
|
|
34
|
+
/** 문항별 결과 (서버 question_results, 문항 순서): score는 받은 점수, 만점일 때만 isCorrect. per_question · partial_pattern만, 그 밖은 [] (옛 서버는 없음) */
|
|
35
|
+
questionResults?: { score: number; isCorrect: boolean }[];
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export interface Navigation {
|
|
@@ -140,7 +142,21 @@ export type GraderType = 'pattern' | 'rubric';
|
|
|
140
142
|
export type Grading =
|
|
141
143
|
| { type: 'pattern'; answer_key?: string }
|
|
142
144
|
| { type: 'partial_pattern'; answer_key: string[]; scores: number[] }
|
|
143
|
-
| { type: 'rubric'; rubric?: string }
|
|
145
|
+
| { type: 'rubric'; rubric?: string }
|
|
146
|
+
/**
|
|
147
|
+
* 문항별 채점 (정규식 · AI 채점 섞음, 서버 #65). 답은 문자열 배열, questions 자리 = 답 자리.
|
|
148
|
+
* 문항 점수는 floor(채점기 점수 0~100 × score / 100), 합은 100에서 자름, 합이 pass_score(1~100, 없으면 100) 이상이면 완료
|
|
149
|
+
*/
|
|
150
|
+
| {
|
|
151
|
+
type: 'per_question';
|
|
152
|
+
questions: {
|
|
153
|
+
score: number;
|
|
154
|
+
grader:
|
|
155
|
+
| { type: 'pattern'; answer_key: string }
|
|
156
|
+
| { type: 'rubric'; rubric: string; question?: string };
|
|
157
|
+
}[];
|
|
158
|
+
pass_score?: number;
|
|
159
|
+
};
|
|
144
160
|
|
|
145
161
|
/** @deprecated Grading을 쓴다 */
|
|
146
162
|
export type GradingPart = Grading;
|
|
@@ -65,6 +65,13 @@ const MESSAGES = {
|
|
|
65
65
|
content_empty: '학습 자료를 준비하고 있어요',
|
|
66
66
|
content_empty_description: '준비가 완료되면 이곳에서 볼 수 있어요',
|
|
67
67
|
external_service_error: '채점하지 못했어요. 제출이 저장되지 않았으니 다시 제출해 주세요.',
|
|
68
|
+
// 서버 502 MATERIAL_GRADING_FAILED (SDK는 이 코드를 몰라 request_failed로 넘김): AI 채점 실패. 제출은 저장되지 않음
|
|
69
|
+
grading_failed: 'AI 채점을 하지 못했어요. 제출이 저장되지 않았으니 잠시 뒤 다시 제출해 주세요.',
|
|
70
|
+
// 같은 코드 · reason refused: AI 입력 가드가 답 안의 지시문(예: "이전 지시 무시")을 보고 채점을 거절
|
|
71
|
+
grading_refused:
|
|
72
|
+
'AI가 답에 들어 있는 지시 문장 때문에 채점하지 않았어요. 채점에 대한 지시처럼 보이는 문장을 빼고 다시 제출해 주세요.',
|
|
73
|
+
// 서버 409 MATERIAL_CREDIT_DISABLED · MATERIAL_CREDIT_INSUFFICIENT: AI 채점 크레딧을 쓸 수 없음. 제출은 저장되지 않음
|
|
74
|
+
grading_credit: 'AI 채점에 쓸 크레딧이 없어 채점하지 못했어요. 교육자에게 알려 주세요.',
|
|
68
75
|
screen_not_supported: '이 화면에서는 할 수 없는 일입니다.',
|
|
69
76
|
navigation_timeout: '수업 페이지 정보를 받지 못했습니다. 잠시 뒤 다시 시도해 주세요.',
|
|
70
77
|
permission_denied: '권한이 없습니다.',
|
|
@@ -78,6 +85,7 @@ const MESSAGES = {
|
|
|
78
85
|
// 서버 422 VALIDATION_ERROR (SDK는 이 코드를 몰라 request_failed로 넘김): 학생 제출 · 편집 화면 저장
|
|
79
86
|
submit_invalid: '이 자료의 채점 설정과 답 모양이 맞지 않아 제출하지 못했어요. 교육자에게 알려 주세요.',
|
|
80
87
|
save_scores_too_low: '배점 합계는 100점 이상이어야 합니다.',
|
|
88
|
+
save_too_many_rubrics: 'AI 채점 문제는 10개까지 둘 수 있습니다.',
|
|
81
89
|
save_length_mismatch: '문항별 정답과 점수의 개수가 맞지 않아요.',
|
|
82
90
|
save_regex_invalid: '정답 형식이 올바르지 않아요.',
|
|
83
91
|
save_invalid: '저장할 내용의 형식이 올바르지 않아요.',
|
|
@@ -133,6 +141,8 @@ const typesOf = err => {
|
|
|
133
141
|
/** 저장 422 VALIDATION_ERROR: 서버 detail type → 문구 (type이 없거나 모르면 save_invalid) */
|
|
134
142
|
const SAVE_VALIDATION_MESSAGES = {
|
|
135
143
|
partial_pattern_scores_too_low: 'save_scores_too_low',
|
|
144
|
+
per_question_scores_too_low: 'save_scores_too_low',
|
|
145
|
+
per_question_too_many_rubrics: 'save_too_many_rubrics',
|
|
136
146
|
partial_pattern_length_mismatch: 'save_length_mismatch',
|
|
137
147
|
regex_answer_key_invalid: 'save_regex_invalid',
|
|
138
148
|
};
|
|
@@ -152,6 +162,14 @@ function toContentError(err, action) {
|
|
|
152
162
|
return new ContentError('material_draft_not_ready', MESSAGES.material_draft_not_ready, err);
|
|
153
163
|
if (serverCode === 'MATERIAL_GRADING_REQUIRED')
|
|
154
164
|
return new ContentError('material_grading_required', MESSAGES.material_grading_required, err);
|
|
165
|
+
// AI 채점(rubric · per_question) 실패: 502 MATERIAL_GRADING_FAILED (reason refused는 입력 가드 거절), 409 크레딧 없음.
|
|
166
|
+
// 어느 쪽이든 서버는 제출을 저장하지 않는다
|
|
167
|
+
if (serverCode === 'MATERIAL_GRADING_FAILED')
|
|
168
|
+
return reasonsOf(err).includes('refused')
|
|
169
|
+
? new ContentError('grading_refused', MESSAGES.grading_refused, err)
|
|
170
|
+
: new ContentError('grading_failed', MESSAGES.grading_failed, err);
|
|
171
|
+
if (serverCode === 'MATERIAL_CREDIT_DISABLED' || serverCode === 'MATERIAL_CREDIT_INSUFFICIENT')
|
|
172
|
+
return new ContentError('grading_credit', MESSAGES.grading_credit, err);
|
|
155
173
|
// 422 VALIDATION_ERROR: 제출은 채점 설정과 답 모양이 맞지 않음(예: partial_pattern인데 문자열 답), 저장은 detail type별
|
|
156
174
|
if (serverCode === 'VALIDATION_ERROR' && action === 'submit')
|
|
157
175
|
return new ContentError('validation_error', MESSAGES.submit_invalid, err);
|
|
@@ -182,7 +200,9 @@ const MATERIAL_PATH = /\/materials\/[0-9a-f-]{36}\//i;
|
|
|
182
200
|
|
|
183
201
|
/**
|
|
184
202
|
* 저장된 채점 설정을 서버 모양(2026-11-11 결정)으로: `{ type: 'pattern', answer_key }` ·
|
|
185
|
-
* `{ type: 'partial_pattern', answer_key: string[], scores: number[] }` · `{ type: 'rubric', rubric }
|
|
203
|
+
* `{ type: 'partial_pattern', answer_key: string[], scores: number[] }` · `{ type: 'rubric', rubric }` ·
|
|
204
|
+
* `{ type: 'per_question', questions: [{ score, grader: { type: 'pattern', answer_key } | { type: 'rubric', rubric, question? } }], pass_score? }`
|
|
205
|
+
* (서버 #65) · 1.11.0 개발 중 제안 `{ type: 'items', items, pass_score? }`(서버는 받지 않음, 퀴즈 편집 화면이 per_question으로 다시 씀).
|
|
186
206
|
* 옛 SDK(G129 해결 전)는 settings 안 키까지 camelCase로 바꿔 answer_key가 answerKey로 왔다. 그 SDK로 빌드한 자료를 위해 둘 다 받는다.
|
|
187
207
|
* partial_pattern 배열은 복사해 둔다 (값은 그대로, 검사는 validatePartialGrading).
|
|
188
208
|
* 채점 방식이 아닌 값(옛 on_access · on_submit 등)이면 null
|
|
@@ -200,6 +220,26 @@ export function normalizeGrading(grading) {
|
|
|
200
220
|
};
|
|
201
221
|
if (grading.type === 'rubric')
|
|
202
222
|
return { type: 'rubric', ...(typeof grading.rubric === 'string' ? { rubric: grading.rubric } : {}) };
|
|
223
|
+
// 문항별 채점 (정규식 · AI 채점 섞음). 문항 · 채점기는 복사해 둔다 (값은 그대로)
|
|
224
|
+
if (grading.type === 'per_question')
|
|
225
|
+
return {
|
|
226
|
+
type: 'per_question',
|
|
227
|
+
questions: Array.isArray(grading.questions)
|
|
228
|
+
? grading.questions.map(q =>
|
|
229
|
+
q && typeof q === 'object'
|
|
230
|
+
? { ...q, ...(q.grader && typeof q.grader === 'object' ? { grader: { ...q.grader } } : {}) }
|
|
231
|
+
: q
|
|
232
|
+
)
|
|
233
|
+
: [],
|
|
234
|
+
...(grading.pass_score === undefined ? {} : { pass_score: grading.pass_score }),
|
|
235
|
+
};
|
|
236
|
+
// 1.11.0 개발 중 제안 items (서버는 받지 않음). 읽기만: 항목은 복사해 둔다 (값은 그대로)
|
|
237
|
+
if (grading.type === 'items')
|
|
238
|
+
return {
|
|
239
|
+
type: 'items',
|
|
240
|
+
items: Array.isArray(grading.items) ? grading.items.map(item => (item && typeof item === 'object' ? { ...item } : item)) : [],
|
|
241
|
+
...(grading.pass_score === undefined ? {} : { pass_score: grading.pass_score }),
|
|
242
|
+
};
|
|
203
243
|
return null;
|
|
204
244
|
}
|
|
205
245
|
|
|
@@ -497,7 +537,7 @@ export async function start(options) {
|
|
|
497
537
|
* settings.grading으로 그대로(배열도 바꾸지 않고) 같이 저장하고,
|
|
498
538
|
* 주지 않으면 저장된 채점 설정을 그대로 둔다
|
|
499
539
|
* @param {Record<string, unknown>} next
|
|
500
|
-
* @param {{ type: 'pattern' | 'partial_pattern' | 'rubric', answer_key?: string | string[], scores?: number[], rubric?: string }} [nextGrading]
|
|
540
|
+
* @param {{ type: 'pattern' | 'partial_pattern' | 'rubric' | 'per_question', answer_key?: string | string[], scores?: number[], rubric?: string, questions?: object[], pass_score?: number }} [nextGrading]
|
|
501
541
|
*/
|
|
502
542
|
async saveContent(next, nextGrading) {
|
|
503
543
|
if (screen !== 'edit')
|
|
@@ -742,9 +782,11 @@ function resultText(r) {
|
|
|
742
782
|
* 점수가 없으면 null (useSubmit · useAutoSubmit 공통)
|
|
743
783
|
*/
|
|
744
784
|
function pastScore(app) {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
785
|
+
// 제출한 적이 있을 때만. on_access 자료는 열기만 해도 서버가 100점 · 완료를 기록하므로(submitCount 0) 점수만으로 보지 않는다
|
|
786
|
+
const r = app.result;
|
|
787
|
+
if (!r || r.score === null || r.score === undefined) return null;
|
|
788
|
+
if (typeof r.submitCount === 'number' && r.submitCount < 1) return null;
|
|
789
|
+
return { score: r.score, isCorrect: r.score === 100 };
|
|
748
790
|
}
|
|
749
791
|
|
|
750
792
|
/** 답 하나를 내고 결과를 화면에 알린다 (useSubmit · useAutoSubmit 공통). 오류는 ContentError로 던진다 */
|
package/templates/quiz/README.md
CHANGED
|
@@ -115,7 +115,32 @@ app.useSave({ getContent, validate });
|
|
|
115
115
|
- `partial_pattern`이면 서버가 문항별 맞음(`answer_correctness`)을 주고, 학생 화면은 제출 직후와 다시 열 때(마지막 제출 기록) 문항마다 정답 · 오답을 표시합니다. 100점보다 낮으면 제출 바 위에 점수 · "아쉬워요!" · "틀린 문제를 다시 풀어 보세요." · 마스코트 상자를 보이고(100점이면 없음), 직접 배점이면 문제 머리에 "N점" 회색 알약을 보입니다 (600px 이상은 제목 오른쪽 끝, 좁은 화면은 제목 위 한 줄). 키트 점수 줄의 정답 · 오답 문장은 두 방식 모두 감춥니다. `pattern`은 문항이 하나면 그 카드에 정답 · 오답, 여러 문항이면 모두 맞았을 때만 정답을 표시하고 틀린 것이 있으면 제출 바 위에 "틀린 문제가 있습니다. 다시 한번 풀어보세요."를 보입니다.
|
|
116
116
|
- 학생은 모든 문항에 답해야 제출할 수 있습니다 (두 방식 모두).
|
|
117
117
|
- **주관식 정답 입력 방식** (1.10.0, 연주님 2026-11-19, ADR 0013): 주관식 카드의 "정답 입력 방식" 세그먼트에서 **직접 입력**(허용 답을 줄마다, 그중 하나만 맞아도 정답) 또는 **정규 표현식**(예: `[Aa]pples?|사과`)을 고릅니다. 정규식 칸 아래 **채점 테스트**에 답을 적으면 "일치합니다. 정답으로 채점됩니다." / "일치하지 않습니다. 오답으로 채점됩니다."가 보입니다. 채점 테스트는 서버(Python `regex`)와 같게 맞춰 봅니다 (`\w` · `\d`는 유니코드, `.`은 줄바꿈만 뺌, 앞뒤 공백은 자름). 맨 앞 `^` · 맨 끝 `$`는 떼고, 맨 앞 `(?i)`는 `(?i:…)`로 바꿔 저장합니다. 서버와 브라우저가 다르게 읽는 문법(`;` · 가운데 플래그 · 역참조 · 이름 그룹 · `[^]` · `\p{…}` · `\b` · `\Z` 등, 목록은 ADR 0013)은 저장을 막습니다. 정규식 방식은 왕복 · 오답 검사를 하지 않고(작성자가 일부러 넓게 쓸 수 있음) 빈 답도 맞는 식이면 안내만 합니다. 정규식 → 직접 입력으로 바꿀 때 글자만으로 된 `a|b`가 아니면 정규식을 지우고 "정규식을 지웠습니다."(되돌리기)를 보입니다.
|
|
118
|
-
- **답 형식 꼬리표** (1.10.0, ADR 0013): 편집 화면은 저장할 때 공개 settings에 `"answerFormat": 2` · `"requires": { "quiz": "1.10.0" }`와 주관식 문항마다 `"answerMode": "list" | "regex"`를 둡니다. 학생 화면은 `answerFormat`이 2면 주관식 답을 원문으로, 없으면(1.9.x 이하가 저장한 자료) 예전처럼 `encodeURIComponent`로 보냅니다. 그래서 옛 자료는 다시 저장하지 않아도 그대로 맞게 채점되고, 편집 화면에서 저장하면 정답이 새 형식으로 다시 쓰입니다. 더 새 템플릿이 저장한 퀴즈(`answerFormat` 3 이상)는 편집 화면 맨 위에 알리고 정답을 저장하지 않습니다. **zip을 1.9.x 이하로 되돌릴 때는 편집 화면에서 다시 저장해야 합니다** (옛 화면은 꼬리표를 읽지 못해 한글 · 공백 · `%` · `;` 답이 오답, 정규식 문항은 글자 답으로 읽힘). 되돌렸다가 다시 1.10으로 올릴 때도 1.10 편집 화면에서 다시 저장합니다. settings를 직접 쓸 때는 꼬리표와 정답 형식을 같이 맞춥니다.
|
|
118
|
+
- **답 형식 꼬리표** (1.10.0, ADR 0013): 편집 화면은 저장할 때 공개 settings에 `"answerFormat": 2` · `"requires": { "quiz": "1.10.0" }`와 주관식 문항마다 `"answerMode": "list" | "regex"`를 둡니다. 학생 화면은 `answerFormat`이 2면 주관식 답을 원문으로, 없으면(1.9.x 이하가 저장한 자료) 예전처럼 `encodeURIComponent`로 보냅니다. 그래서 옛 자료는 다시 저장하지 않아도 그대로 맞게 채점되고, 편집 화면에서 저장하면 정답이 새 형식으로 다시 쓰입니다. 더 새 템플릿이 저장한 퀴즈(1.10은 `answerFormat` 3 이상, 1.11은 4 이상)는 편집 화면 맨 위에 알리고 정답을 저장하지 않습니다. **zip을 1.9.x 이하로 되돌릴 때는 편집 화면에서 다시 저장해야 합니다** (옛 화면은 꼬리표를 읽지 못해 한글 · 공백 · `%` · `;` 답이 오답, 정규식 문항은 글자 답으로 읽힘). 되돌렸다가 다시 1.10으로 올릴 때도 1.10 편집 화면에서 다시 저장합니다. settings를 직접 쓸 때는 꼬리표와 정답 형식을 같이 맞춥니다.
|
|
119
|
+
- **AI 채점 (1.11.0, 서버 `per_question`, elice-material #65)**: 주관식 카드의 "정답 입력 방식"에 **AI 채점**이 있습니다. 고르면 **채점 기준** 칸(문제마다 10,000자까지, 학생에게는 보이지 않음, placeholder는 예시 채점 기준)과 **채점 기준 작성 가이드**가 열리고, 배점은 문제 카드 머리의 배점 칸에서 정합니다 (문제가 하나면 100점). 배점이 100점이 아니면 채점 기준 칸 아래에 "이 문제의 배점은 N점입니다. 배점에 맞게 환산되어 채점됩니다."가 보입니다. AI 채점 문제가 하나라도 있으면 퀴즈 전체를 문제별 채점 `per_question`으로 저장하고, 맨 위 "부분 채점 허용"은 켜진 채 잠기며 그 상자 안(문제가 하나면 따로 상자)에 **통과 점수** 칸이 생깁니다. 통과 점수는 늘 같이 저장합니다 (비우면 100). AI 채점 문제는 10개까지입니다. AI 채점 문제가 없으면 예전과 똑같이 `pattern` · `partial_pattern`으로 저장합니다 (`answerFormat` 2 · `requires` 1.10.0 그대로).
|
|
120
|
+
|
|
121
|
+
```jsonc
|
|
122
|
+
// settings (공개 값). answerFormat 3: 1.10 편집 화면은 answerFormat이 2보다 크면 정답을 저장하지 않으므로 이 자료의 채점 설정을 덮어쓰지 못한다
|
|
123
|
+
"gradingType": "per_question", "answerFormat": 3, "requires": { "quiz": "1.11.0" }, "passScore": 60, "pointsMode": "custom",
|
|
124
|
+
"questions": [{ "id": "q1", "type": "select_one", "points": 30, … },
|
|
125
|
+
{ "id": "q2", "type": "text", "answerMode": "list", "points": 20, … },
|
|
126
|
+
{ "id": "q3", "type": "text", "answerMode": "rubric", "points": 50, … }],
|
|
127
|
+
// settings.grading 값 (학생에게 안 감). questions 순서 = 답 배열 순서 = 문제 순서
|
|
128
|
+
{
|
|
129
|
+
"type": "per_question",
|
|
130
|
+
"questions": [
|
|
131
|
+
{ "score": 30, "grader": { "type": "pattern", "answer_key": "^q1=b$" } },
|
|
132
|
+
{ "score": 20, "grader": { "type": "pattern", "answer_key": "^q2=(?:weight|Weight)$" } },
|
|
133
|
+
{ "score": 50, "grader": { "type": "rubric", "rubric": "과적합 · 일반화를 모두 설명하면 만점 …", "question": "과적합과 일반화의 관계를 설명하세요." } }
|
|
134
|
+
],
|
|
135
|
+
"pass_score": 60
|
|
136
|
+
}
|
|
137
|
+
// 학생 답 (partial_pattern처럼 배열, AI 채점 문제 자리는 `문항id=` 없이 답 글만)
|
|
138
|
+
["q1=b", "q2=weight", "과적합은 …"]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`grader.question`은 AI가 채점 기준과 같이 읽는 문제 글입니다: 질문 + 지문을 서식 없는 글로(그림은 설명 글만) 2,000자까지 자릅니다. 서버는 AI 채점 문제를 제출마다 한 번에 묶어 채점하고(빈 답은 AI 없이 0점), 문제 점수는 `floor(AI 점수 0~100 × 배점 / 100)`, 합은 100에서 자릅니다. `is_correct`는 100점일 때만 참이고, 완료(on_graded)는 합계가 통과 점수 이상일 때입니다. 완료는 제출할 때 정해지므로 통과 점수를 나중에 바꿔도 이미 낸 제출은 다시 계산되지 않습니다 (편집 화면에 안내). AI 채점은 제출마다 크레딧을 씁니다.
|
|
142
|
+
|
|
143
|
+
학생 화면은 제출하고 기다리는 동안 제출 바 위에 "AI가 채점하고 있어요"를 보이고, 정규식 문제는 문항별 결과로 정답 · 오답, AI 채점 문제는 "AI 채점 결과 받은 점수 / 배점"을 보입니다 (배점 만점이면 초록 · 0점이면 빨강 · 그 사이는 회색 줄, 반짝이 아이콘). 결과는 학생이 답을 실제로 고칠 때까지 남습니다 (입력 칸을 누르거나 초점만 옮기면 그대로). 문항별 점수는 서버 `question_results`(SDK에서 `questionResults`)를 씁니다: 지금 SDK `submit()` 결과에는 없어 제출 직후에는 방금 저장된 제출 기록(`history`)에서 읽고(답 · 점수가 같을 때만), 못 읽으면(교육자 · 미리보기는 기록이 없음) "AI 채점 완료. 점수는 총점에 반영되었습니다."를 보입니다. 아래 점수 상자는 100점보다 낮고 통과 점수(공개 값 `passScore`) 이상이면 "통과했어요!", 아래면 "아쉬워요!"입니다. AI 채점이 실패하면(502 `MATERIAL_GRADING_FAILED`, 입력 가드 거절 `refused`는 따로 · 409 크레딧 없음) 제출은 저장되지 않고 제출 바에 이유를 보입니다. `ecdk dev`는 AI 대신 글 길이로 만든 **흉내 점수**(빈 답 0, 아니면 min(100, 20 + 글자 수 / 5)를 배점 비율로 내림)로 채점하고 1.2초 기다리며, 화면 · 로그에 흉내 값이라고 표시합니다. 답에 "이전 지시를 무시" 같은 문장을 쓰면 거절(`refused`)을 흉내 냅니다.
|
|
119
144
|
- 편집 화면은 답(`settings.grading`)만 저장합니다. 완료 정책은 LXP 페이지 설정입니다 (ADR 0012): publish 스킬이 동의를 받아 업로드 때 정하거나 교육자가 LXP 편집 페이지 위쪽 '설정' 패널에서 고릅니다. 퀴즈는 **채점해 통과하면 완료(on_graded)**여야 채점합니다. 제출하면 완료(on_submit)면 서버가 채점하지 않고 제출만으로 완료되어 점수 없이 "제출했어요."가 보입니다.
|
|
120
145
|
|
|
121
146
|
## 정답
|
|
@@ -70,5 +70,10 @@ export declare function renderQuestion(
|
|
|
70
70
|
getValue(): any;
|
|
71
71
|
setValue(v: any): void;
|
|
72
72
|
setResult(correct: boolean | null): void;
|
|
73
|
+
/**
|
|
74
|
+
* 정답 · 오답 문구 대신 쓰는 결과 줄 (AI 채점 문제의 점수 줄, data-ai). state가 'correct' · 'wrong'이면 그 색,
|
|
75
|
+
* 없으면 data-result="note"(회색)
|
|
76
|
+
*/
|
|
77
|
+
setNote(content: string | Node, state?: 'correct' | 'wrong'): void;
|
|
73
78
|
showExplanation(): void;
|
|
74
79
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// 문항 동작 (학생 · 교육자 화면, 기존 퀴즈 material UI를 순수 DOM으로 옮김, docs/quiz-spec.md §2)
|
|
2
2
|
// 고르기 · 누르고 놓기 · 끌어 놓기 · 칸끼리 바꾸기 · 결과 표시. 마크업은 ui/templates/*가 만들고,
|
|
3
3
|
// 여기서는 클래스가 아니라 data-role · data-option · data-slot · data-group으로만 요소를 찾는다.
|
|
4
|
-
// 각 문항은 { el, getValue(), setValue(v), setResult(correct | null), showExplanation() }을 돌려준다.
|
|
4
|
+
// 각 문항은 { el, getValue(), setValue(v), setResult(correct | null), setNote(content, state), showExplanation() }을 돌려준다.
|
|
5
5
|
// ui/를 직접 불러오지 않는다: 템플릿과 문구는 화면(screens/)이 넘겨 준다 (ui/templates/index.js).
|
|
6
6
|
import { lock, part, parts, present } from './dom.js';
|
|
7
7
|
import { shuffled } from './model.js';
|
|
@@ -53,6 +53,7 @@ export function renderQuestion(q, index, opts) {
|
|
|
53
53
|
if (state) card.dataset.result = state;
|
|
54
54
|
else delete card.dataset.result;
|
|
55
55
|
if (!result) return;
|
|
56
|
+
delete result.dataset.ai;
|
|
56
57
|
if (!state) {
|
|
57
58
|
result.hidden = true;
|
|
58
59
|
delete result.dataset.result;
|
|
@@ -62,6 +63,20 @@ export function renderQuestion(q, index, opts) {
|
|
|
62
63
|
result.dataset.result = state;
|
|
63
64
|
result.hidden = false;
|
|
64
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* 정답 · 오답 문구 대신 쓰는 결과 줄 (AI 채점 문제의 "AI 채점 결과 받은 점수 / 배점"). content는 글이나 요소, 결과 줄에 data-ai.
|
|
68
|
+
* state 'correct' · 'wrong'이면 문항과 결과 줄에 그 색 (연주님 디자인: 만점 초록 · 0점 빨강),
|
|
69
|
+
* 없으면 결과 줄은 data-result="note"(회색)이고 문항에는 data-result를 두지 않는다. 지우려면 setResult(null)
|
|
70
|
+
*/
|
|
71
|
+
setNote(content, state) {
|
|
72
|
+
// 만점 correct(초록) · 0점 wrong(빨강) · 그 밖 note(회색): 카드의 답 칸 테두리도 같은 색
|
|
73
|
+
card.dataset.result = state ?? 'note';
|
|
74
|
+
if (!result) return;
|
|
75
|
+
result.replaceChildren(content);
|
|
76
|
+
result.dataset.result = state ?? 'note';
|
|
77
|
+
result.dataset.ai = '';
|
|
78
|
+
result.hidden = false;
|
|
79
|
+
},
|
|
65
80
|
showExplanation() {
|
|
66
81
|
if (explanation) explanation.hidden = false;
|
|
67
82
|
},
|
|
@@ -44,6 +44,8 @@ export declare function buildAnswerKey(
|
|
|
44
44
|
): string;
|
|
45
45
|
/** 주관식 정답 입력 방식이 정규식인지 (answerMode 'regex') */
|
|
46
46
|
export declare function isRegexMode(q: any): boolean;
|
|
47
|
+
/** 주관식 정답 입력 방식이 AI 채점인지 (answerMode 'rubric', 1.11.0) */
|
|
48
|
+
export declare function isRubricMode(q: any): boolean;
|
|
47
49
|
/** 작성자 정규식 → 서버 정답 조각(body) · 채점 테스트용 식(test, u 플래그) · 바꾼 것(notes) 또는 막는 문법(error) */
|
|
48
50
|
export declare function compileTextRegex(source: string): {
|
|
49
51
|
body?: string;
|
|
@@ -103,7 +105,82 @@ export declare const PARTIAL: 'partial_pattern';
|
|
|
103
105
|
export declare function gradingTypeOf(
|
|
104
106
|
content: unknown,
|
|
105
107
|
grading: unknown
|
|
106
|
-
): 'pattern' | 'partial_pattern';
|
|
108
|
+
): 'pattern' | 'partial_pattern' | 'per_question';
|
|
109
|
+
/** 정규식 · AI 채점을 섞은 문항별 채점 방식 이름 (1.11.0, 서버 #65) */
|
|
110
|
+
export declare const PER_QUESTION: 'per_question';
|
|
111
|
+
/** 1.11.0 개발 중의 옛 제안 이름 (읽기만) */
|
|
112
|
+
export declare const ITEMS: 'items';
|
|
113
|
+
/** per_question 채점 설정을 저장한 settings가 필요한 템플릿 버전 */
|
|
114
|
+
export declare const REQUIRES_PER_QUESTION: { quiz: string };
|
|
115
|
+
/** per_question 퀴즈의 답 형식 (settings answerFormat 3, 1.10 편집 화면이 덮어쓰지 못하게) */
|
|
116
|
+
export declare const ANSWER_FORMAT_PER_QUESTION: 3;
|
|
117
|
+
/** 이 판이 읽는 가장 새 답 형식 */
|
|
118
|
+
export declare const ANSWER_FORMAT_MAX: 3;
|
|
119
|
+
/** AI 채점 기준 최대 글자 수 (문항마다) */
|
|
120
|
+
export declare const RUBRIC_MAX: number;
|
|
121
|
+
/** AI에 같이 보내는 문제 글 최대 글자 수 */
|
|
122
|
+
export declare const RUBRIC_QUESTION_MAX: number;
|
|
123
|
+
/** per_question 문항 수 상한 */
|
|
124
|
+
export declare const PER_QUESTION_MAX: number;
|
|
125
|
+
/** AI 채점 문항 수 상한 (서버 10개) */
|
|
126
|
+
export declare const RUBRIC_QUESTIONS_MAX: number;
|
|
127
|
+
/** per_question 문항 하나 (자리 = 답 배열 자리 = 문항 순서) */
|
|
128
|
+
export interface GradingQuestion {
|
|
129
|
+
score: number;
|
|
130
|
+
grader:
|
|
131
|
+
| { type: 'pattern'; answer_key: string }
|
|
132
|
+
| { type: 'rubric'; rubric: string; question?: string };
|
|
133
|
+
}
|
|
134
|
+
/** per_question 채점 설정 (서버 GradingPerQuestion). pass_score는 1~100 (없으면 100) */
|
|
135
|
+
export interface PerQuestionGrading {
|
|
136
|
+
type: 'per_question';
|
|
137
|
+
questions: GradingQuestion[];
|
|
138
|
+
pass_score?: number;
|
|
139
|
+
}
|
|
140
|
+
/** AI 채점 문항이 하나라도 있는지 (있으면 per_question으로 저장) */
|
|
141
|
+
export declare function usesPerQuestion(questions: any[] | undefined): boolean;
|
|
142
|
+
/** per_question으로 읽는 채점 방식인지 (옛 제안 items 포함) */
|
|
143
|
+
export declare function isPerQuestionType(type: unknown): boolean;
|
|
144
|
+
/** 문항별 답 → per_question 답 배열 (정규식 문항 "q1=b", AI 채점 문항은 답 글만) */
|
|
145
|
+
export declare function joinQuestionAnswers(questions: any[], values: unknown[], format?: number): string[];
|
|
146
|
+
/** per_question 답 배열의 자리별 문항 id (지금 문항과 맞지 않으면 null) */
|
|
147
|
+
export declare function questionAnswerIds(questions: any[], answer: unknown): string[] | null;
|
|
148
|
+
/** 마크다운 → AI에 보낼 글 (서식 기호 · 그림 주소를 뗌) */
|
|
149
|
+
export declare function plainText(source: unknown): string;
|
|
150
|
+
/** AI 채점 문항의 문제 글 (질문 + 지문, RUBRIC_QUESTION_MAX자까지) */
|
|
151
|
+
export declare function questionText(q: any): string;
|
|
152
|
+
/** 문항별 정답 · 배점 → per_question 채점 설정 */
|
|
153
|
+
export declare function buildPerQuestionGrading(
|
|
154
|
+
questions: any[],
|
|
155
|
+
key: Record<string, any>,
|
|
156
|
+
scores: number[],
|
|
157
|
+
format?: number,
|
|
158
|
+
passScore?: number
|
|
159
|
+
): PerQuestionGrading;
|
|
160
|
+
/** per_question(옛 items도) 채점 설정 → 문항별 정답 · 배점 · 통과 점수. 모양이 다르면 null */
|
|
161
|
+
export declare function parsePerQuestionGrading(
|
|
162
|
+
questions: any[],
|
|
163
|
+
grading: unknown
|
|
164
|
+
): { key: Record<string, any>; scores: unknown[]; passScore?: number } | null;
|
|
165
|
+
/** per_question 채점 설정 검사 (서버 규칙). 문제가 없으면 null */
|
|
166
|
+
export declare function validatePerQuestionGrading(
|
|
167
|
+
grading: unknown,
|
|
168
|
+
answerKeyMax?: number
|
|
169
|
+
): {
|
|
170
|
+
index: number;
|
|
171
|
+
code:
|
|
172
|
+
| 'count'
|
|
173
|
+
| 'score'
|
|
174
|
+
| 'pattern'
|
|
175
|
+
| 'patternMax'
|
|
176
|
+
| 'rubric'
|
|
177
|
+
| 'rubricMax'
|
|
178
|
+
| 'questionMax'
|
|
179
|
+
| 'rubricCount'
|
|
180
|
+
| 'kind'
|
|
181
|
+
| 'total'
|
|
182
|
+
| 'passScore';
|
|
183
|
+
} | null;
|
|
107
184
|
/** 문항별 답 → 제출할 문자열 배열 (partial_pattern) */
|
|
108
185
|
export declare function joinAnswerList(
|
|
109
186
|
questions: any[],
|