egatari 0.6.9 → 0.6.10
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/CHANGELOG.md +28 -1
- package/README.ja.md +151 -116
- package/README.md +145 -116
- package/bin/egatari.mjs +10 -7
- package/components.lock.json +12 -6
- package/components2.lock.json +151 -1
- package/kit/check-messages.mjs +123 -114
- package/kit/check.mjs +12 -8
- package/kit/core/article-messages.mjs +7 -7
- package/kit/core/build-core.mjs +8 -8
- package/kit/core/check-parity.mjs +1 -1
- package/kit/core/check-source.mjs +4 -0
- package/kit/core/colab-core.mjs +1 -1
- package/kit/core/llm-fix.mjs +15 -15
- package/kit/core/llm-insert.mjs +7 -7
- package/kit/core/llm-outline.mjs +6 -6
- package/kit/core/llm-pack-data.mjs +33 -33
- package/kit/core/narration-parse.mjs +3 -3
- package/kit/core/new-deck.mjs +1 -1
- package/kit/core/predict-steps.mjs +46 -0
- package/kit/core/template-text.mjs +2 -2
- package/kit/instruction-version.json +1 -1
- package/kit/player.json +1 -1
- package/kit/player.lock.json +2 -2
- package/kit/templates/new-deck.mjs +1 -1
- package/package.json +1 -1
- package/render/only.mjs +2 -2
- package/render/render.mjs +4 -4
- package/tools/ids.mjs +7 -7
- package/vendor/components/CATALOG.md +1 -1
- package/vendor/components/sha256/19f34ad938c3513d9268fcedb947e0049380232da2293d5c00922fe32ec1a088/README.en.md +32 -0
- package/vendor/components/sha256/19f34ad938c3513d9268fcedb947e0049380232da2293d5c00922fe32ec1a088/index.js +352 -0
- package/vendor/components/sha256/1d10fec0552198e3926b3d960046606668fa7f42f562cea539c6a16cc3e83338/README.en.md +40 -0
- package/vendor/components/sha256/1d10fec0552198e3926b3d960046606668fa7f42f562cea539c6a16cc3e83338/index.js +341 -0
- package/vendor/components-2/manifest-2.6.2.json +2104 -0
package/kit/check.mjs
CHANGED
|
@@ -55,6 +55,7 @@ import { layoutScan, metricsProbe, metricsFonts, CLIP_ATTR, ANNOT_ATTR, OVERLAP_
|
|
|
55
55
|
import { placeholderSteps, templateTextIn } from './core/template-text.mjs';
|
|
56
56
|
import { legacyVocabulary } from './core/legacy-vocab.mjs';
|
|
57
57
|
import { colorsOutsideVocabulary } from './core/color-vocab.mjs';
|
|
58
|
+
import { predictStepProblems } from './core/predict-steps.mjs';
|
|
58
59
|
import { FONTS_EXTRA_WARN, FONTS_EXTRA_PKG, FONTS_EXTRA_INSTALL } from './core/build-core.mjs';
|
|
59
60
|
import { uncoveredGlyphs } from './core/font-coverage.mjs';
|
|
60
61
|
|
|
@@ -62,7 +63,7 @@ import { uncoveredGlyphs } from './core/font-coverage.mjs';
|
|
|
62
63
|
const args = process.argv.slice(2);
|
|
63
64
|
const asJson = args.includes('--json');
|
|
64
65
|
const ti = args.indexOf('--theme'), theme = ti >= 0 ? args[ti + 1] : undefined;
|
|
65
|
-
const li = args.indexOf('--lang'), langArg = li >= 0 ? args[li + 1] : undefined; // 知らせの言葉(ja | en
|
|
66
|
+
const li = args.indexOf('--lang'), langArg = li >= 0 ? args[li + 1] : undefined; // 知らせの言葉(ja | en。既定は教材の言語)
|
|
66
67
|
const arg0 = args.find((a, i) => !a.startsWith('--') && !(ti >= 0 && i === ti + 1) && !(li >= 0 && i === li + 1));
|
|
67
68
|
if (!arg0) {
|
|
68
69
|
console.error('usage: node kit/check.mjs <deck.html | working folder> [--theme name] [--lang ja|en] [--json]');
|
|
@@ -71,7 +72,7 @@ if (!arg0) {
|
|
|
71
72
|
// 組み立てた後の 1 ファイル(.ega.html)は原稿ではない:デッキとして読むと、はみ出し・台本なし・重なりを誤って出す。断る(終了コード 2:
|
|
72
73
|
// 「エラー 0」でも「指摘あり」でもない、検査していない)。中に入った原稿を取り出して検査するのは v0.6.10
|
|
73
74
|
if (/\.ega\.html?$/i.test(arg0)) {
|
|
74
|
-
const ja = '.ega.html
|
|
75
|
+
const ja = '.ega.html は組み立てた後のファイルです。品質チェックは組み立てる前の作業フォルダか deck.html にかけてください';
|
|
75
76
|
const en = '.ega.html is a built file. Run the quality check on the source instead (the working folder or deck.html)';
|
|
76
77
|
console.error(`check: ${langArg === 'en' ? en : langArg === 'ja' ? ja : ja + '\n ' + en}`);
|
|
77
78
|
if (asJson) console.log(JSON.stringify({ ok: false, status: 'refused', reason: 'egaFile', lang: langArg === 'en' ? 'en' : 'ja', counts: { error: 0, warn: 0, info: 0 }, results: [] }, null, 2));
|
|
@@ -173,6 +174,9 @@ if (extraMissing.length) report(null, 'error', 'fontsExtraMissing', { fonts: ext
|
|
|
173
174
|
for (const x of colorsOutsideVocabulary(readRegular(src, { max: READ_LIMITS.source }).toString('utf8'))) {
|
|
174
175
|
report(null, 'info', 'colorOutside', { kind: x.kind, n: x.n, line: x.line, items: x.items, list: x.items.slice(0, 6).map((i) => i.what).join(', ') + (x.items.length > 6 ? ', …' : '') });
|
|
175
176
|
}
|
|
177
|
+
// 予想(m-predict)の段階(R-steps):答えが数の棒と同時(predictAnswerWithCount。数える前に答えが見える)、steps が答えの段階より小さい(predictAnswerNeverShown。答えが出ない)。
|
|
178
|
+
// 編集アプリも同じ関数(kit/core/check-source.mjs)
|
|
179
|
+
for (const { code, slide, ...x } of predictStepProblems(readRegular(src, { max: READ_LIMITS.source }).toString('utf8'))) report(slide, 'warn', code, x);
|
|
176
180
|
// {#id} で指したスライドの見出しと、narration.md の見出しの文字列が違う(id が勝つので、知らせるだけ)
|
|
177
181
|
const byKey = new Map(built.slides.map((s, i) => [s.key, { ...s, i }]));
|
|
178
182
|
for (const sec of built.segs.sections || []) {
|
|
@@ -293,7 +297,7 @@ let browserPhase = false;
|
|
|
293
297
|
const crashed = (e) => {
|
|
294
298
|
if (!browserPhase) { console.error(e && e.stack ? e.stack : String(e)); process.exit(1); } // ブラウザの前の例外は今までどおり(終了コード 1)
|
|
295
299
|
try { fs.rmSync(tmpDir, { recursive: true, force: true }); } catch { /* 消せなくてよい */ }
|
|
296
|
-
console.error((ML === 'en' ? 'check did not finish: the headless browser failed to launch or crashed (this is not "0 errors").\n' : '
|
|
300
|
+
console.error((ML === 'en' ? 'the quality check did not finish: the headless browser failed to launch or crashed (this is not "0 errors").\n' : '品質チェックが終わっていない:ヘッドレスのブラウザが起動できないか、途中で落ちた(「エラー 0」ではない)。\n') + String(e && e.message ? e.message : e));
|
|
297
301
|
if (asJson) console.log(JSON.stringify({ ok: false, status: 'crashed', lang: ML, counts: { error: 0, warn: 0, info: 0 }, results: [] }, null, 2));
|
|
298
302
|
process.exit(2);
|
|
299
303
|
};
|
|
@@ -512,7 +516,7 @@ for (const f of await scanBalance(page, meta)) {
|
|
|
512
516
|
}
|
|
513
517
|
|
|
514
518
|
// ================================================================ B. 口述原稿
|
|
515
|
-
phase = 'B
|
|
519
|
+
phase = 'B 台本';
|
|
516
520
|
const narrInfo = await page.evaluate((metaList) => {
|
|
517
521
|
const out = [];
|
|
518
522
|
// static のスライド(表紙など。段階は 0 だけ)も段階 0 の口述原稿を見る
|
|
@@ -683,7 +687,7 @@ await page.goto(url);
|
|
|
683
687
|
await page.waitForFunction(() => window.DECK && DECK.ready, null, { timeout: 15000 });
|
|
684
688
|
|
|
685
689
|
// ================================================================ F. 注目の演出
|
|
686
|
-
phase = 'F
|
|
690
|
+
phase = 'F 強調';
|
|
687
691
|
const markInfo = await page.evaluate(() => {
|
|
688
692
|
const out = [];
|
|
689
693
|
DECK.slides.forEach((s, i) => {
|
|
@@ -694,7 +698,7 @@ const markInfo = await page.evaluate(() => {
|
|
|
694
698
|
});
|
|
695
699
|
return out;
|
|
696
700
|
});
|
|
697
|
-
const fmtT = (x) => (x === null || x === Infinity ? '
|
|
701
|
+
const fmtT = (x) => (x === null || x === Infinity ? 'ステップの終わり' : `${(+x).toFixed(2)} s`);
|
|
698
702
|
for (const { i, key, marks } of markInfo) {
|
|
699
703
|
const sk = key.slice(meta[i].key.length + 1);
|
|
700
704
|
for (const m of marks) if (!m.found) report(i, 'warn', 'markMissing', { id: m.id }, sk);
|
|
@@ -804,10 +808,10 @@ if (asJson) {
|
|
|
804
808
|
const keys = [...groups.keys()].sort((a, b) => a - b);
|
|
805
809
|
const EN = ML === 'en';
|
|
806
810
|
const MARK = EN ? { error: 'error', warn: 'warning', info: 'info' } : { error: 'エラー', warn: '警告', info: '情報' };
|
|
807
|
-
const stepOf = (s) => (s === null ? '' : EN ? (s === 'concl' ? 'conclusion: ' : `step ${s}: `) : (s === 'concl' ? '
|
|
811
|
+
const stepOf = (s) => (s === null ? '' : EN ? (s === 'concl' ? 'conclusion: ' : `step ${s}: `) : (s === 'concl' ? '結論のステップ:' : `ステップ ${s}:`));
|
|
808
812
|
for (const key of keys) {
|
|
809
813
|
const id = key >= 0 && meta[key] && meta[key].id;
|
|
810
|
-
const label = key === -1 ? (EN ? '■ Whole
|
|
814
|
+
const label = key === -1 ? (EN ? '■ Whole lesson' : '■ 教材全体') : `■ ${key + 1}: ${titleOf(key)}${id ? ` (${id})` : ''}`;
|
|
811
815
|
console.log(label);
|
|
812
816
|
const items = groups.get(key).sort((a, b) => SEV_RANK[a.sev] - SEV_RANK[b.sev]);
|
|
813
817
|
for (const r of items) console.log(` [${MARK[r.sev]}] ${stepOf(r.step)}${cliHints(r.what)}`);
|
|
@@ -17,8 +17,8 @@ const WHY_LABEL = {
|
|
|
17
17
|
};
|
|
18
18
|
const WHY_SOL = { ja: { missing: 'がない', 'not-exercise': 'は問(:::{exercise})でない', twice: 'の解答が 2 つ目(1 つの問に 1 つまで)' }, en: { missing: 'does not exist', 'not-exercise': 'is not an exercise', twice: 'already has a solution (one per exercise)' } };
|
|
19
19
|
const WHY_STEP = {
|
|
20
|
-
ja: (a) => (a.why === 'slide' ? 'のスライドがない' : a.why === 'not-id' ? '
|
|
21
|
-
en: (a) => (a.why === 'slide' ? ': no such slide' : a.why === 'not-id' ? ': the slide
|
|
20
|
+
ja: (a) => (a.why === 'slide' ? 'のスライドがない' : a.why === 'not-id' ? 'のスライドにスライドの id がない(npm run ids で id を付ける)' : a.why === 'concl' ? 'のスライドに結論のステップがない' : `のステップがない${a.max !== undefined ? `(0〜${a.max})` : ''}`),
|
|
21
|
+
en: (a) => (a.why === 'slide' ? ': no such slide' : a.why === 'not-id' ? ': the slide has no slide id (add ids with npm run ids)' : a.why === 'concl' ? ': the slide has no conclusion step' : `: no such step${a.max !== undefined ? ` (0–${a.max})` : ''}`),
|
|
22
22
|
};
|
|
23
23
|
const ENC = { ja: { bom: '先頭に BOM がある(BOM なしの UTF-8 にする)', crlf: '改行が CRLF(LF にする)', nfc: 'Unicode の NFC になっていない(NFC で保存する)' }, en: { bom: 'starts with a BOM (save as UTF-8 without BOM)', crlf: 'has CRLF line endings (use LF)', nfc: 'is not in Unicode NFC (save it normalized to NFC)' } };
|
|
24
24
|
|
|
@@ -45,7 +45,7 @@ export const ARTICLE_MESSAGES = {
|
|
|
45
45
|
articleSectionId: { ja: (a) => `節${quoteJa(a.heading)}(## の見出し)に id がない:npm run ids で (sec-…)= の行を付ける(自分で書かない)`, en: (a) => `the section “${a.heading}” (a ## heading) has no id: run npm run ids to add its (sec-…)= line (do not write ids by hand)` },
|
|
46
46
|
articleSectionIdForm: { ja: (a) => `節の id「${a.label}」が決まりの形(sec- と英小文字・2〜7 の 6 字)でない:その (…)= の行を消して npm run ids で付け直す(参照も直す)`, en: (a) => `the section id “${a.label}” is not of the required form (sec- and 6 characters a–z, 2–7): delete its (…)= line, run npm run ids and update references to it` },
|
|
47
47
|
articleLabel: { ja: (a) => `名前「${a.label}」:${WHY_LABEL.ja[a.why]}`, en: (a) => `the label “${a.label}” ${WHY_LABEL.en[a.why]}` },
|
|
48
|
-
articleCiteKey: { ja: (a) =>
|
|
48
|
+
articleCiteKey: { ja: (a) => `引用キー「${a.key}」が引用キーの書式に合わない(英数字と _、間に . : - 。64 字まで)`, en: (a) => `the citation key “${a.key}” does not match the citation key pattern (letters, digits, _, separated by . : -; up to 64)` },
|
|
49
49
|
articleCitePrefix: { ja: (a) => `[@${a.key}] の前に字(${a.prefix})がある:字は角かっこの外に書く`, en: (a) => `text before the key in the citation of ${a.key} (“${a.prefix}”): write the text outside the brackets` },
|
|
50
50
|
articleCiteNarrativeLocator: { ja: (a) => `地の文の引用 @${a.key} の後ろに所在(ページなど)がある:[@${a.key}, p. 3] と書く`, en: (a) => `a narrative citation @${a.key} followed by a locator: write [@${a.key}, p. 3]` },
|
|
51
51
|
articleImagePath: { ja: (a) => `画像「${a.url}」が作業フォルダの中のパスでない(URL・絶対パス・.. は使えない):画像を作業フォルダに置き、images/… のように書く`, en: (a) => `the image “${a.url}” is not a path in the working folder (no URLs, absolute paths or ..): put the image in the folder and write e.g. images/…` },
|
|
@@ -89,19 +89,19 @@ export const ARTICLE_MESSAGES = {
|
|
|
89
89
|
articleSolution: { ja: (a) => `解答の問「${a.label}」${WHY_SOL.ja[a.why]}`, en: (a) => `the solution's exercise “${a.label}” ${WHY_SOL.en[a.why]}` },
|
|
90
90
|
articleTerm: { ja: (a) => (a.glossary ? `用語「${a.term}」が用語集にない:用語集に足すか、字を合わせる` : `用語「${a.term}」を使っているが用語集(:::{glossary})がない`), en: (a) => (a.glossary ? `the term “${a.term}” is not in the glossary: add it or match the spelling` : `the term “${a.term}” is used but there is no glossary (:::{glossary})`) },
|
|
91
91
|
articleStep: { ja: (a) => `ステップへのリンク ${a.value} ${WHY_STEP.ja(a)}`, en: (a) => `the step link ${a.value}${WHY_STEP.en(a)}` },
|
|
92
|
-
articleCite: { ja: (a) => (a.why === 'no-references' ? `引用 @${a.key} があるが文献のファイル(references.json)がない` :
|
|
92
|
+
articleCite: { ja: (a) => (a.why === 'no-references' ? `引用 @${a.key} があるが文献のファイル(references.json)がない` : `引用キー @${a.key} が references.json にない`), en: (a) => (a.why === 'no-references' ? `the citation @${a.key} needs a bibliography, but there is no references.json` : `the citation key @${a.key} is not in references.json`) },
|
|
93
93
|
articleReferences: { ja: (a) => `references.json が読めない(${a.why}):CSL-JSON の配列にする`, en: (a) => `cannot read references.json (${a.why}): it must be a CSL-JSON array` },
|
|
94
94
|
articleImage: { ja: (a) => `画像 ${a.path} が作業フォルダにない`, en: (a) => `the image ${a.path} is not in the working folder` },
|
|
95
95
|
articleDataArticle: { ja: (a) => `スライド ${a.slide} の data-article の節「${a.section}」が本文にない`, en: (a) => `slide ${a.slide}: data-article names “${a.section}”, which is not a section of the article` },
|
|
96
96
|
articleCitations: { ja: (a) => (a.why === 'list' ? `egatari.json の metadata.citations.list「${a.value}」が違う(end・chapter・none のどれか)` : 'egatari.json の metadata.citations が object でない({"style": "apa", "list": "end"} のように書く)'), en: (a) => (a.why === 'list' ? `egatari.json metadata.citations.list “${a.value}” is not one of end, chapter, none` : 'egatari.json metadata.citations is not an object (write e.g. {"style": "apa", "list": "end"})') },
|
|
97
97
|
articleCiteStyle: { ja: (a) => `引用の書式「${a.style}」はこの Studio にない:${a.fallback} で組んだ(使える書式:${a.styles.join('・')}。style はそのまま残す)`, en: (a) => `this Studio does not have the citation style “${a.style}”: used ${a.fallback} instead (available: ${a.styles.join(', ')}; style is kept as written)` },
|
|
98
98
|
articleCiteListChapter: { ja: () => 'metadata.citations.list が chapter だが、本文が章に分かれていない(article/ の章のファイルのときだけ):end にする', en: () => 'metadata.citations.list is chapter, but the article has no chapters (only with chapter files in article/): use end' },
|
|
99
|
-
articleCiteEngine: { ja: (a) => `引用を書式で組めなかった(${a.why}
|
|
99
|
+
articleCiteEngine: { ja: (a) => `引用を書式で組めなかった(${a.why}):引用キーの字のまま書いた。references.json の項目を確かめる`, en: (a) => `could not format citations (${a.why}); wrote the citation keys instead: check the items in references.json` },
|
|
100
100
|
articleUncited: { ja: (a) => `本文で引いていない文献が ${a.count} 件ある(${a.keys.join('・')}${a.count > a.keys.length ? ' …' : ''}):一覧には出ない`, en: (a) => `${a.count} reference(s) never cited (${a.keys.join(', ')}${a.count > a.keys.length ? ', …' : ''}); they are not listed` },
|
|
101
101
|
articleLinksShape: { ja: (a) => `egatari.json の articleLinks の形が違う(${a.why}):その項目を消し、npm run ids で付け直す`, en: (a) => `egatari.json articleLinks has the wrong shape (${a.why}): remove it and run npm run ids to record the links again` },
|
|
102
|
-
articleLinkStale: { ja: (a) => `スライドと本が合っていないかもしれません:スライド ${a.slide} と節${quoteJa(a.heading || a.section)}(${a.section})。つないだ後に${a.changed === 'article' ? '節' : a.changed === 'slide' ? '
|
|
102
|
+
articleLinkStale: { ja: (a) => `スライドと本が合っていないかもしれません:スライド ${a.slide} と節${quoteJa(a.heading || a.section)}(${a.section})。つないだ後に${a.changed === 'article' ? '節' : a.changed === 'slide' ? 'スライドか台本' : '節とスライドの両方'}が変わった。読み比べて、合っていれば npm run ids -- --confirm-links で確かめた印を付ける(字は自動では直さない)`, en: (a) => `slides and book may not match: slide ${a.slide} and the section “${a.heading || a.section}” (${a.section}); ${a.changed === 'article' ? 'the section' : a.changed === 'slide' ? 'the slide or its script' : 'both the section and the slide'} changed after they were linked. Compare them; if they still agree, run npm run ids -- --confirm-links (nothing is changed automatically)` },
|
|
103
103
|
articleLinkUnconfirmed: { ja: (a) => `スライドと節のつながり ${a.count} 組がまだ記録されていない(${a.pairs.join('、')}${a.count > a.pairs.length ? ' …' : ''}):npm run ids で記録すると、後でどちらかが変わったときに知らせる`, en: (a) => `${a.count} slide–section link(s) are not recorded yet (${a.pairs.join(', ')}${a.count > a.pairs.length ? ', …' : ''}): run npm run ids to record them, so that later changes on either side are reported` },
|
|
104
|
-
articleLinkUnlinked: { ja: (a) => `egatari.json の articleLinks に、もうつながっていない組が ${a.count} 組ある(${a.pairs.join('、')}${a.count > a.pairs.length ? ' …' : ''}):
|
|
104
|
+
articleLinkUnlinked: { ja: (a) => `egatari.json の articleLinks に、もうつながっていない組が ${a.count} 組ある(${a.pairs.join('、')}${a.count > a.pairs.length ? ' …' : ''}):Egatari ファイルに書き出すときに外す`, en: (a) => `egatari.json articleLinks records ${a.count} pair(s) that are no longer linked (${a.pairs.join(', ')}${a.count > a.pairs.length ? ', …' : ''}); they are dropped when the Egatari file is written` },
|
|
105
105
|
articleSummary: { ja: (a) => `本文:ファイル ${a.files}、節 ${a.sections}、名前 ${a.labels}`, en: (a) => `article: ${a.files} file(s), ${a.sections} section(s), ${a.labels} label(s)` },
|
|
106
106
|
articleSectionUnlinked: { ja: (a) => `節${quoteJa(a.heading)}(${a.section})がどのスライドともつながっていない({step} のリンクか、スライドの data-article で結ぶ)`, en: (a) => `the section “${a.heading}” (${a.section}) is linked to no slide (add a {step} link or name it in a slide's data-article)` },
|
|
107
107
|
};
|
package/kit/core/build-core.mjs
CHANGED
|
@@ -111,7 +111,7 @@ export function annotate(src, dev, warn = []) {
|
|
|
111
111
|
secs.forEach((s, i) => {
|
|
112
112
|
if (keyOf[i]) return;
|
|
113
113
|
let key = s.explicit;
|
|
114
|
-
if (key) { key = free(key); warn.push(`slide key: 「${s.explicit}」が重複している(data-key / id)。2 つ目以降を「${key}」にした`); }
|
|
114
|
+
if (key) { key = free(key); warn.push(`slide key: スライドの id「${s.explicit}」が重複している(data-key / id)。2 つ目以降を「${key}」にした`); }
|
|
115
115
|
else {
|
|
116
116
|
key = (s.h ? normalizeKey(inner(src, s.h)) : '') || `s${i + 1}`;
|
|
117
117
|
if (taken.has(key)) key = free(key);
|
|
@@ -179,10 +179,10 @@ export function analyzeSlideIds(src) {
|
|
|
179
179
|
for (const s of slides) {
|
|
180
180
|
const where = `スライド ${s.index + 1}(${s.line} 行目)`;
|
|
181
181
|
if (s.id !== null && !isSlideId(s.id)) problems.push({ sev: 'error', slide: s.index, msg: `slide id: ${where}の id「${s.id}」が規則に合わない(英字で始まり、英数字・_・- が続く 64 字まで)` });
|
|
182
|
-
if (s.id !== null && docIds.has(s.id)) problems.push({ sev: 'error', slide: s.index, msg: `slide id: ${where}の id「${s.id}」がほかの id と重なる:${docIds.get(s.id)}(スライドの id
|
|
182
|
+
if (s.id !== null && docIds.has(s.id)) problems.push({ sev: 'error', slide: s.index, msg: `slide id: ${where}の id「${s.id}」がほかの id と重なる:${docIds.get(s.id)}(スライドの id と強調の目印は同じ名前空間)` });
|
|
183
183
|
if (byKey.has(s.key)) {
|
|
184
184
|
const o = byKey.get(s.key);
|
|
185
|
-
problems.push({ sev: 'error', slide: s.index, msg: `slide key: ${where}
|
|
185
|
+
problems.push({ sev: 'error', slide: s.index, msg: `slide key: ${where}のスライドの id「${s.key}」がスライド ${o.index + 1}(${o.line} 行目)と重なる(どちらかの <section> に id を付ける。npm run ids は重なりを直さない)` });
|
|
186
186
|
} else byKey.set(s.key, s);
|
|
187
187
|
}
|
|
188
188
|
return { slides, docIds, problems };
|
|
@@ -1013,7 +1013,7 @@ export function build(env0, srcPath, opts = {}) {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
if (env.exists(local)) {
|
|
1015
1015
|
if (env.within(local, deckDir)) file = local;
|
|
1016
|
-
else { warn.push(`refused:
|
|
1016
|
+
else { warn.push(`refused: パーツ ${tag} の components/${name}/index.js が作業フォルダの外を指している(シンボリックリンクなど。読まない)`); continue; }
|
|
1017
1017
|
} else if (lib && env.exists(lib)) {
|
|
1018
1018
|
if (pick.note) warn.push(pick.note);
|
|
1019
1019
|
const y = yankedInfo(lock, pick.version);
|
|
@@ -1021,10 +1021,10 @@ export function build(env0, srcPath, opts = {}) {
|
|
|
1021
1021
|
// 置き換え先の版が手元にあるか・index.js の同一性の hash が変わるか(編集アプリが組み直しの知らせに使う)
|
|
1022
1022
|
const lc = lock.components[name], ok = !!lc && lc.versions.includes(y.replacement);
|
|
1023
1023
|
yankedUsed.push({ tag, name, version: pick.version, replacement: y.replacement, reason: y.reason, date: y.date, replacementAvailable: ok, sha256Changes: ok ? lc.sha256[pick.version] !== lc.sha256[y.replacement] : null });
|
|
1024
|
-
warn.push(`yanked: ${tag} ${pick.version} was withdrawn by the component registry on ${y.date} (replacement ${y.replacement}; ${y.reason}). It is built as recorded, never replaced silently. To rebuild with ${y.replacement}, set "${name}": "${y.replacement}" under components in egatari.json (the editor has a button) /
|
|
1024
|
+
warn.push(`yanked: ${tag} ${pick.version} was withdrawn by the component registry on ${y.date} (replacement ${y.replacement}; ${y.reason}). It is built as recorded, never replaced silently. To rebuild with ${y.replacement}, set "${name}": "${y.replacement}" under components in egatari.json (the editor has a button) / パーツライブラリが取り下げた版:記録のまま組む。黙って置き換えない`);
|
|
1025
1025
|
}
|
|
1026
1026
|
if (env.within(lib, compRoot)) { file = lib; componentVersions[name] = pick.version; }
|
|
1027
|
-
else { warn.push(`refused:
|
|
1027
|
+
else { warn.push(`refused: パーツライブラリのパーツ ${tag} が vendor/components/ の外を指している(読まない)`); continue; }
|
|
1028
1028
|
}
|
|
1029
1029
|
if (!file) { warn.push(`component not found: ${tag}`); continue; }
|
|
1030
1030
|
// 注釈の場所は、原稿のフォルダの部品ならそこから、部品庫ならリポジトリから(端末ごとのパスを出力に書かない)
|
|
@@ -1046,7 +1046,7 @@ export function build(env0, srcPath, opts = {}) {
|
|
|
1046
1046
|
for (const w of segs.warnings || []) warn.push(`narration: ${w}`);
|
|
1047
1047
|
const keySet = new Set(slides.map((s) => s.key));
|
|
1048
1048
|
// 鍵がどのスライドにも合わない節(## 見出し)。段階のない節も知らせる
|
|
1049
|
-
for (const s of segs.sections || segs) if (!keySet.has(s.key ?? s.slideKey)) warn.push(`narration: スライドが見つからない「## ${innerJa(s.heading || s.key || s.slideKey)}
|
|
1049
|
+
for (const s of segs.sections || segs) if (!keySet.has(s.key ?? s.slideKey)) warn.push(`narration: スライドが見つからない「## ${innerJa(s.heading || s.key || s.slideKey)}」(スライドの id「${s.key ?? s.slideKey}」、narration.md ${s.line} 行目)`);
|
|
1050
1050
|
const narration = narrationMap(segs, !!opts.dev);
|
|
1051
1051
|
const marks = marksMap(segs);
|
|
1052
1052
|
checkMarks(html, segs, warn);
|
|
@@ -1265,7 +1265,7 @@ function buildParts2(env, { P, ROOT, deckDir, html, used, lock2, catalogue, pins
|
|
|
1265
1265
|
for (const tag of used) {
|
|
1266
1266
|
const lf = P.join(deckDir, 'components', tag.slice(2), 'index.js');
|
|
1267
1267
|
if (!env.exists(lf)) continue;
|
|
1268
|
-
if (!env.within(lf, deckDir)) { warn.push(`refused:
|
|
1268
|
+
if (!env.within(lf, deckDir)) { warn.push(`refused: パーツ ${tag} の components/${tag.slice(2)}/index.js が作業フォルダの外を指している(シンボリックリンクなど。読まない)`); refused.add(tag); continue; }
|
|
1269
1269
|
const code = env.readText(lf), rd = readDefineMeta(code), where = P.relative(deckDir, lf).split(P.sep).join('/');
|
|
1270
1270
|
if (!rd) { legacy.push(tag); continue; } // egatariParts.define がない:1.x の部品(DECK.define)
|
|
1271
1271
|
// meta は字のまま読めなければ書かない(§6.1:組み立ては動かさずに name・version・requires・element を読み、索引に記録する)
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
export const IN_EDITOR = Object.freeze([
|
|
12
12
|
// 原稿の文字列から(kit/core/check-source.mjs)
|
|
13
13
|
'slideId', 'legacyDataKey', 'legacyIndex', 'legacyColorClass', 'legacyStepAttr', 'legacyLectureMode', 'colorOutside', 'narrHeadingDiffers',
|
|
14
|
-
'narrNote', 'narrFormula', 'turnLong', 'narrLang',
|
|
14
|
+
'narrNote', 'narrFormula', 'turnLong', 'narrLang', 'predictAnswerWithCount', 'predictAnswerNeverShown',
|
|
15
15
|
// app/main.js・app/llm.js(作業場所の原稿と台本から)
|
|
16
16
|
'refVoice', 'audioStale', 'narrPlaceholder', 'templateText', 'readingExpr', 'readingSeveral',
|
|
17
17
|
// 体裁の検査(kit/core/layout-scan.mjs。bodyBottom・bodyRight は EDITOR_ALIAS)
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
// 編集アプリ(app/main.js の checkResults)がプレビューの答え(app/frame-shim.js)に足す。Node にもブラウザにも依存しない(純粋な ESM)
|
|
3
3
|
// sourceFindings({deck, narration, voiceLang}) → [{i(スライドの番号か null), sev, code, a(kit/check-messages.mjs の値), step(段階の鍵か null)}]
|
|
4
4
|
// I:id の書式・重なり(slideId)、旧来の鍵(legacyDataKey・legacyIndex)、1.0 の語彙にない書き方(legacyColorClass・legacyStepAttr・legacyLectureMode)、
|
|
5
|
+
// 予想(m-predict)の答えが数の棒と同時(predictAnswerWithCount)・steps が小さく答えが出ない(predictAnswerNeverShown)、
|
|
5
6
|
// テーマの色の語彙の外の色(colorOutside、情報)、{#id} の見出しとスライドの見出しの違い(narrHeadingDiffers、情報)
|
|
6
7
|
// B:{note:} の書き損じ(narrNote)、式らしい台本(narrFormula)、長すぎる 1 ターン(turnLong、情報)、台本の言語がスライドと違う(narrLang、情報)
|
|
7
8
|
// コマンド版は台本の段階を実行系(DECK.NARRATION)から取る。ここは narration.md から取り、どのスライドにも合わない節は見ない(それは組み立ての知らせ)
|
|
8
9
|
import { analyzeSlideIds, isJapanese } from './build-core.mjs';
|
|
9
10
|
import { legacyVocabulary } from './legacy-vocab.mjs';
|
|
10
11
|
import { colorsOutsideVocabulary } from './color-vocab.mjs';
|
|
12
|
+
import { predictStepProblems } from './predict-steps.mjs';
|
|
11
13
|
import { parseNarration, normalizeKey, noteProblems } from './narration-parse.mjs';
|
|
12
14
|
import { narrationLang, textLang, formulaLike, formulaText } from './narration-lint.mjs';
|
|
13
15
|
|
|
@@ -26,6 +28,8 @@ export function sourceFindings({ deck, narration = '', voiceLang } = {}) {
|
|
|
26
28
|
for (const x of colorsOutsideVocabulary(deck)) {
|
|
27
29
|
add(null, 'info', 'colorOutside', { kind: x.kind, n: x.n, line: x.line, items: x.items, list: x.items.slice(0, 6).map((v) => v.what).join(', ') + (x.items.length > 6 ? ', …' : '') });
|
|
28
30
|
}
|
|
31
|
+
// 予想(m-predict)の段階(R-steps。kit/core/predict-steps.mjs、kit/check.mjs と同じ):'predictAnswerWithCount'(答えが数の棒と同時)・'predictAnswerNeverShown'(答えが出ない)
|
|
32
|
+
for (const { code, slide, ...x } of predictStepProblems(deck)) add(slide, 'warn', code, x);
|
|
29
33
|
const text = String(narration || '');
|
|
30
34
|
if (!text.trim()) return out;
|
|
31
35
|
const segs = parseNarration(text);
|
package/kit/core/colab-core.mjs
CHANGED
|
@@ -45,7 +45,7 @@ export const JOB = Object.freeze({ tag: 'tts-job', recordsTag: 'tts-records', v:
|
|
|
45
45
|
export const COLAB = Object.freeze({
|
|
46
46
|
repo: 'egatari/egatari-studio', notebook: 'colab/egatari-tts.ipynb',
|
|
47
47
|
videoNotebook: 'colab/egatari-video.ipynb', // 動画(MP4)を作るノート(CPU のランタイム。#131)
|
|
48
|
-
ref: 'v0.6.
|
|
48
|
+
ref: 'v0.6.10', // バッジの URL は版のタグに固定する(リリースの手順で替える。RELEASING.md)
|
|
49
49
|
pause: 0.35,
|
|
50
50
|
models: Object.freeze({ irodori: 'irodori-tts-500m-v3', kokoro: 'kokoro-82m-v1.0' }),
|
|
51
51
|
// 後処理の版(records の recipe.processing は PROCESSING に '+colab<ノートブックの版>' を付けたもの):ノートブック(colab/egatari_tts.py)の後処理は audio-core.mjs と同じ数。数を変えたら名前も変える
|
package/kit/core/llm-fix.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 「AI への修正依頼」の文章を作る(編集アプリの品質チェックの板。app/llm.js)。Node にもブラウザにも依存しない(純粋な ESM)
|
|
2
2
|
// 規格の文章は、AI への指示の共通の本体(kit/core/llm-pack.mjs の commonBody。docs/authoring-with-llms.md と同じ)の「- **R-名前** …」の行から、
|
|
3
|
-
//
|
|
3
|
+
// パーツの説明は、教材で使っているパーツのもの(componentNotes。指示に入っているものと同じ文章)を載せる。
|
|
4
4
|
// 依頼の形は指示の §5(修正依頼)に合わせる:指摘(規格の名前付き)、その規格の文章、今のファイル。返事は 2 つの囲み
|
|
5
5
|
//
|
|
6
6
|
// guideRules(guide) → Map(R-名前 → 文章)
|
|
@@ -44,7 +44,7 @@ compData: ['R-components'], consoleError: ['R-components'],
|
|
|
44
44
|
};
|
|
45
45
|
const BY_TEXT = [
|
|
46
46
|
[/スライドが見つからない|slide not found|no slide/i, ['R-headings']],
|
|
47
|
-
[
|
|
47
|
+
[/ステップの指定|段階の番号|口述原稿の段階|step key|step label/i, ['R-narr-steps']],
|
|
48
48
|
[/^mark: |目印/, ['R-marks']],
|
|
49
49
|
[/式は読まず|reads? an equation/i, ['R-formula']],
|
|
50
50
|
[/読みの指定/, ['R-reading']],
|
|
@@ -64,17 +64,17 @@ const L = {
|
|
|
64
64
|
en: {
|
|
65
65
|
head: 'Fix request for an Egatari lesson (deck.html + narration.md). The instructions you followed are the Egatari authoring guide; the standards are quoted below.',
|
|
66
66
|
ask: 'Fix only the findings listed. Keep everything else as it is, and keep every id="…" and {#…} exactly (R-noids). Do not use Canvas, slide-making or file features: reply in the body of your chat message with exactly two fenced code blocks, ```deck.html and ```narration.md (R-output).',
|
|
67
|
-
askPartial: (n) => `The
|
|
68
|
-
problems: 'Findings', rules: 'Standards', components: '
|
|
69
|
-
where: (p) => (p.i === null || p.i === undefined ? 'Whole
|
|
67
|
+
askPartial: (n) => `The lesson is long, so only the ${n} slide(s) with problems are included below. Reply with the same two blocks, but put only those <section> elements in the deck.html block (no <html>, keep their ids) and only their sections in the narration.md block (keep the {#id} headings) (R-output).`,
|
|
68
|
+
problems: 'Findings', rules: 'Standards', components: 'Parts used in this lesson (from the instructions)', files: 'Current files', partialFiles: 'Current slides with problems',
|
|
69
|
+
where: (p) => (p.i === null || p.i === undefined ? 'Whole lesson' : `Slide ${p.i + 1}${p.id ? ` (id ${p.id})` : ''}${p.title ? ` “${p.title}”` : ''}`),
|
|
70
70
|
sev: { error: 'error', warn: 'warning' },
|
|
71
71
|
},
|
|
72
72
|
ja: {
|
|
73
73
|
head: 'Egatari の教材(deck.html と narration.md)の修正依頼です。書くときに従った指示は Egatari の書き方の指示(authoring guide)で、規格の文章は下に引いています。',
|
|
74
|
-
ask: '挙げた指摘だけを直してください。ほかは変えず、id="…" と {#…} はすべてそのまま残してください(R-noids)。Canvas・スライド作成・ファイルの機能は使わず、チャットの返事の本文に、ちょうど 2
|
|
75
|
-
askPartial: (n) =>
|
|
76
|
-
problems: '指摘', rules: '規格', components: '
|
|
77
|
-
where: (p) => (p.i === null || p.i === undefined ? '
|
|
74
|
+
ask: '挙げた指摘だけを直してください。ほかは変えず、id="…" と {#…} はすべてそのまま残してください(R-noids)。Canvas・スライド作成・ファイルの機能は使わず、チャットの返事の本文に、ちょうど 2 つの灰色の枠(コードブロック) ```deck.html と ```narration.md を書いてください(R-output)。',
|
|
75
|
+
askPartial: (n) => `教材が長いので、問題のあるスライド ${n} 枚だけを下に載せています。返事は同じ 2 つのコードブロックで、deck.html のコードブロックにはそのスライドの <section> だけを(<html> なしで、id はそのまま)、narration.md のコードブロックにはその節だけを({#id} の見出しのまま)入れてください(R-output)。`,
|
|
76
|
+
problems: '指摘', rules: '規格', components: 'この教材で使っているパーツ(指示の説明)', files: '今のファイル', partialFiles: '問題のあるスライド(今のもの)',
|
|
77
|
+
where: (p) => (p.i === null || p.i === undefined ? '教材全体' : `スライド ${p.i + 1}${p.id ? `(id ${p.id})` : ''}${p.title ? quoteJa(p.title) : ''}`),
|
|
78
78
|
sev: { error: 'エラー', warn: '警告' },
|
|
79
79
|
},
|
|
80
80
|
};
|
|
@@ -91,8 +91,8 @@ export function amountOf(p, lang = 'en') {
|
|
|
91
91
|
const line = d && typeof d === 'object' && Number.isFinite(+d.line) && +d.line > 0 ? +d.line : LINE;
|
|
92
92
|
if (!Number.isFinite(px)) return '';
|
|
93
93
|
const over = Math.ceil(px - lim), lines = Math.max(1, Math.ceil(over / line));
|
|
94
|
-
return ja ? `本文を ${over} px(${line} px の行でおよそ ${lines}
|
|
95
|
-
: `cut ${over} px from the body (about ${lines} line${lines > 1 ? 's' : ''} of ${line} px): drop lines, make the
|
|
94
|
+
return ja ? `本文を ${over} px(${line} px の行でおよそ ${lines} 行)減らす(行を削るか、パーツを ${over} px 低くするか、次のスライドに移す)`
|
|
95
|
+
: `cut ${over} px from the body (about ${lines} line${lines > 1 ? 's' : ''} of ${line} px): drop lines, make the part ${over} px lower, or move content to a new slide`;
|
|
96
96
|
}
|
|
97
97
|
if (p.code === 'bodyRight' || p.code === 'overflowRight') {
|
|
98
98
|
const px = pick('px', 0), lim = pick('lim', 1) || limitsOf(DM).right;
|
|
@@ -111,16 +111,16 @@ export function amountOf(p, lang = 'en') {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
// 返事が途中で切れて取り込めなかったとき(kit/core/llm-import.mjs の unclosed)の依頼
|
|
114
|
-
//
|
|
114
|
+
// コードブロックがなかったとき(no-blocks:ファイル・キャンバス・添付で返したなど)も、この関数で送り直しを頼む(err.code === 'no-blocks')
|
|
115
115
|
export function cutOffRequest(err, lang = 'en') {
|
|
116
116
|
if (err && err.code === 'no-blocks') {
|
|
117
117
|
return lang === 'ja'
|
|
118
|
-
? '
|
|
118
|
+
? '前の返事には灰色の枠(コードブロック)がありませんでした。ファイル・キャンバス・添付では出さず、チャットの返事の本文に、2 つのコードブロック ```deck.html と ```narration.md を書いて送り直してください。どちらも最後まで書いて閉じてください(R-output)。\n'
|
|
119
119
|
: 'Your previous reply had no code blocks. Do not output files, a canvas or attachments: write both code blocks, ```deck.html and ```narration.md, in the body of your chat message, complete and closed (R-output).\n';
|
|
120
120
|
}
|
|
121
121
|
const file = err.kind === 'deck' ? 'deck.html' : err.kind === 'narration' ? 'narration.md' : null;
|
|
122
122
|
return lang === 'ja'
|
|
123
|
-
? `前の返事は途中で切れていました${file ? `(${file}
|
|
123
|
+
? `前の返事は途中で切れていました${file ? `(${file} の灰色の枠(コードブロック)が閉じていません)` : ''}。${file === 'narration.md' ? 'narration.md のコードブロックだけを、最初から最後まで書いて閉じた形で送り直してください(deck.html は受け取りました)。' : `同じ教材を、枚数を減らした短い形で、2 つの${file ? 'コードブロック' : '灰色の枠(コードブロック)'} \`\`\`deck.html と \`\`\`narration.md をどちらも閉じて送り直してください。`}コードブロックの途中で終わらないでください(R-output)。
|
|
124
124
|
`
|
|
125
125
|
: `Your previous reply was cut off${file ? ` (the ${file} block is not closed)` : ''}. ${file === 'narration.md' ? 'Send only the narration.md block again, complete and closed (the deck.html block arrived).' : 'Send the lesson again in a shorter form (fewer slides), as two closed blocks, ```deck.html and ```narration.md.'} Never stop in the middle of a block (R-output).
|
|
126
126
|
`;
|
|
@@ -150,7 +150,7 @@ export function buildFixRequest({ problems, deck, narration = '', lang = 'en', l
|
|
|
150
150
|
}
|
|
151
151
|
const want = new Set(slideIds);
|
|
152
152
|
const deckPart = partial ? secs.filter((s) => want.has(s.id)).map((s) => deck.slice(s.start, s.end)).join('\n\n') : '';
|
|
153
|
-
//
|
|
153
|
+
// 載せる教材(長ければ問題のスライドだけ)で使っているパーツの説明
|
|
154
154
|
const comps = componentsIn(partial ? deckPart : deck);
|
|
155
155
|
if (comps.length) out.push('', `## ${M.components}`, '', componentNotes(comps, lang === 'ja' ? 'ja' : 'en'));
|
|
156
156
|
if (partial) {
|
package/kit/core/llm-insert.mjs
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
// insertRequest({deck, narration, after, n, wish, lang}) → 文字列
|
|
5
5
|
// 「スライド X の後ろに続きの n 枚」(n が 1 なら「ここに 1 枚」)を頼む短い文。頼む文を短く保つよう、今のデッキの全体は
|
|
6
|
-
//
|
|
6
|
+
// 付けず、スライドの見出しの一覧と、足す場所の前のスライド(とその台本の節)だけを添える。after:0 から。-1 なら先頭(前のスライドなし)
|
|
7
7
|
// insertSlides({deck, narration, patchDeck, patchNarration, after, lang, rand}) → {deck, narration, ids: [新しい id…], at(最初の新しいスライドの番号)}
|
|
8
8
|
// 返事のスライド(<section class="slide">。id は付けない約束だが、付いていても新しく付け直す)を after 番目の後ろに順に入れ、
|
|
9
|
-
// スライドの一覧の「足す」(kit/core/slide-ops.mjs)と同じに id を付け(newIdFor
|
|
10
|
-
// 「## 見出し {#id}
|
|
9
|
+
// スライドの一覧の「足す」(kit/core/slide-ops.mjs)と同じに id を付け(newIdFor)、台本の節を同じ順で入れる(見出しの行は
|
|
10
|
+
// 「## 見出し {#id}」)。台本の節は、見出しが同じものを先に、なければ順に対応させる。節のないスライドには仮の行(✎)を入れる
|
|
11
11
|
import { slideChunks, insertSlide, insertSection, newIdFor } from './slide-ops.mjs';
|
|
12
12
|
import { headingLine, parseHeading } from './narration-core.mjs';
|
|
13
13
|
import { sectionsOf, narrSections } from './llm-import.mjs';
|
|
@@ -25,7 +25,7 @@ const L = {
|
|
|
25
25
|
here: '← この後ろに足す',
|
|
26
26
|
near: '## 足す場所の前のスライド(参考。返さない)',
|
|
27
27
|
reply: '## 返し方',
|
|
28
|
-
replyText: '足すスライドだけを返してください。```deck.html
|
|
28
|
+
replyText: '足すスライドだけを返してください。```deck.html の灰色の枠(コードブロック)に <section class="slide"> だけを並べ(<!DOCTYPE>・<html>・<head> は付けない。id は書かない)、```narration.md のコードブロックに、そのスライドの台本の節(## 見出し と [0] からの行)を同じ順で書きます。ほかのスライドは返しません。',
|
|
29
29
|
},
|
|
30
30
|
en: {
|
|
31
31
|
head: '# Please add slides',
|
|
@@ -38,7 +38,7 @@ const L = {
|
|
|
38
38
|
here: '← add after this one',
|
|
39
39
|
near: '## The slide before the new ones (for reference; do not send it back)',
|
|
40
40
|
reply: '## How to reply',
|
|
41
|
-
replyText: 'Send only the new slides: in a ```deck.html block, only the <section class="slide"> elements (no <!DOCTYPE>, <html> or <head>; no ids), and in a ```narration.md block their
|
|
41
|
+
replyText: 'Send only the new slides: in a ```deck.html block, only the <section class="slide"> elements (no <!DOCTYPE>, <html> or <head>; no ids), and in a ```narration.md block their script sections (## heading and the lines from [0]) in the same order. Do not send the other slides back.',
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
44
|
const fence = (name, body) => '````' + name + '\n' + String(body).replace(/\s+$/, '') + '\n````';
|
|
@@ -72,7 +72,7 @@ export function insertSlides({ deck, narration = '', patchDeck, patchNarration =
|
|
|
72
72
|
if (!secs.length) return { deck, narration, ids: [], at: -1 };
|
|
73
73
|
const n0 = slideChunks(deck).slides.length;
|
|
74
74
|
const at0 = Math.max(-1, Math.min(n0 - 1, after ?? n0 - 1));
|
|
75
|
-
//
|
|
75
|
+
// 台本の節(見出しと行)
|
|
76
76
|
const N = patchNarration ? narrSections(String(patchNarration).replace(/\r\n?/g, '\n')) : { lines: [], out: [] };
|
|
77
77
|
const pool = N.out.map((s) => ({ heading: parseHeading(N.lines[s.start].replace(/^##\s+/, '')).heading.trim(), lines: N.lines.slice(s.start + 1, s.end), used: false }));
|
|
78
78
|
let out = deck, narr = narration ?? '';
|
|
@@ -87,7 +87,7 @@ export function insertSlides({ deck, narration = '', patchDeck, patchNarration =
|
|
|
87
87
|
const sec = pool.find((p) => !p.used && h && p.heading === h) || pool.find((p) => !p.used);
|
|
88
88
|
let body;
|
|
89
89
|
if (sec) { sec.used = true; body = sec.lines.slice(); while (body.length && !body[body.length - 1].trim()) body.pop(); }
|
|
90
|
-
if (!body || !body.some((l) => /^\s*\[(\d+|concl)\]/.test(l))) body = [`[0] ${placeholderLine(lang === 'ja' ? '
|
|
90
|
+
if (!body || !body.some((l) => /^\s*\[(\d+|concl)\]/.test(l))) body = [`[0] ${placeholderLine(lang === 'ja' ? 'このスライドの台本' : 'script for this slide')}`];
|
|
91
91
|
const keys = slideChunks(out).slides.map((x) => x.key);
|
|
92
92
|
narr = insertSection(narr, keys, id, [headingLine({ key: id, id, heading: h }), ...body]);
|
|
93
93
|
});
|
package/kit/core/llm-outline.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// 長いデッキを 2 回に分けてチャットの AI に頼む(編集アプリの「新規作成…」。app/llm.js)。Node にもブラウザにも依存しない(純粋な ESM)
|
|
2
2
|
// 1 回目(構成案):枚数が OUTLINE_OVER を超えたら、頼む文の最後に「構成案だけを返す」を付ける。返事は ```outline の囲み 1 つ
|
|
3
3
|
// (Markdown の表:番号・見出し・要点(1 行))。parseOutline で読む
|
|
4
|
-
// 2 回目から(バッチ):構成案の BATCH 枚ずつ(「構成案の 7〜12
|
|
4
|
+
// 2 回目から(バッチ):構成案の BATCH 枚ずつ(「構成案の 7〜12 枚目」)。頼む文は構成案の全体と、足す場所の前のスライド(とその台本)を添える。
|
|
5
5
|
// 最初のバッチは deck.html の全体(<!DOCTYPE html> から)、次からはスライドの挿入(kit/core/llm-insert.mjs)と同じく足すスライドだけ
|
|
6
6
|
// 構成案は設定のファイル(egatari.json)の studio.outline に置く({v: 1, next, rows})。設定のファイルは作業フォルダにも 1 ファイルの原稿にも
|
|
7
7
|
// 必ず入るので、どちらの形でも教材と一緒に動く(別のファイル(outline.md など)は組み立てが読まないので 1 ファイルに入らない)。
|
|
@@ -36,7 +36,7 @@ const L = {
|
|
|
36
36
|
ja: {
|
|
37
37
|
outlineHead: '# まず構成案だけを返してください',
|
|
38
38
|
outlineText: (n) => `この教材は ${n} 枚あるので、2 回に分けて作ります。今回は deck.html と narration.md はまだ書かず、構成案だけを返してください(R-outline)。` +
|
|
39
|
-
'```outline
|
|
39
|
+
'```outline の灰色の枠(コードブロック) 1 つに、Markdown の表を書きます。列は「番号」「見出し」「要点(1 行)」で、スライドごとに 1 行、全スライドを順に並べます。コードブロックの外には 1 行の添え書きだけ。',
|
|
40
40
|
tableHead: '| 番号 | 見出し | 要点 |',
|
|
41
41
|
batchHead: (a, b) => `# 構成案の ${a}〜${b} 枚目を作ってください`,
|
|
42
42
|
batchFirst: (a, b, n) => `構成案(全 ${n} 枚)の ${a}〜${b} 枚目を、ちょうど ${b - a + 1} 枚作ってください。規格(R-…)と出力の形(R-output)は AI への指示のとおりで、deck.html は <!DOCTYPE html> からの全体を書きます。残りのスライドは後で頼みます。`,
|
|
@@ -45,8 +45,8 @@ const L = {
|
|
|
45
45
|
outlineList: '## 構成案(全体。返さない)', range: (a, b) => `← 今回は ${a}〜${b} 枚目`,
|
|
46
46
|
near: '## 足す場所の前のスライド(参考。返さない)',
|
|
47
47
|
reply: '## 返し方',
|
|
48
|
-
replyFirst: '```deck.html
|
|
49
|
-
replyNext: '足すスライドだけを返してください。```deck.html
|
|
48
|
+
replyFirst: '```deck.html の灰色の枠(コードブロック)に deck.html の全体(今回のスライドだけ)を、```narration.md のコードブロックにその台本を書きます。',
|
|
49
|
+
replyNext: '足すスライドだけを返してください。```deck.html の灰色の枠(コードブロック)に <section class="slide"> だけを並べ(<!DOCTYPE>・<html>・<head> は付けない。id は書かない)、```narration.md のコードブロックに、そのスライドの台本の節(## 見出し と [0] からの行)を同じ順で書きます。',
|
|
50
50
|
},
|
|
51
51
|
en: {
|
|
52
52
|
outlineHead: '# First, send only the outline',
|
|
@@ -60,8 +60,8 @@ const L = {
|
|
|
60
60
|
outlineList: '## The outline (all of it; do not send it back)', range: (a, b) => `← this time: ${a}–${b}`,
|
|
61
61
|
near: '## The slide before the new ones (for reference; do not send it back)',
|
|
62
62
|
reply: '## How to reply',
|
|
63
|
-
replyFirst: 'In a ```deck.html block write the whole deck.html (with only these slides), and in a ```narration.md block their
|
|
64
|
-
replyNext: 'Send only the new slides: in a ```deck.html block, only the <section class="slide"> elements (no <!DOCTYPE>, <html> or <head>; no ids), and in a ```narration.md block their
|
|
63
|
+
replyFirst: 'In a ```deck.html block write the whole deck.html (with only these slides), and in a ```narration.md block their script.',
|
|
64
|
+
replyNext: 'Send only the new slides: in a ```deck.html block, only the <section class="slide"> elements (no <!DOCTYPE>, <html> or <head>; no ids), and in a ```narration.md block their script sections (## heading and the lines from [0]) in the same order.',
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
const M = (lang) => L[lang === 'ja' ? 'ja' : 'en'];
|