Skip to content

Commit f403547

Browse files
authored
Merge pull request #211 from igapyon/tiga0315wbb
prompt-gen に自己レビュー出力オプションを追加します
2 parents 40651c8 + bd728e3 commit f403547

8 files changed

Lines changed: 186 additions & 33 deletions

File tree

TODO.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
- [prompt-gen][仕様検討][出力オプション候補] `Markdown出力` 系: 形式保証をどこまで共通オプション化できるか整理する(見出し順、必須項目、空欄時の書き方、箇条書き数など)
5252
- [prompt-gen][仕様検討][出力オプション候補] `幻想防止` 系: 情報不足時の挙動を共通オプション化できるか整理する(不明と書く、追加質問する、条件不足なら出力を控える等)
5353
- [prompt-gen][仕様検討][出力オプション候補] `入力前提の明示` 系: 何を根拠にしてよいか、何を入力値として扱うか、を共通オプションとしてテンプレート化できるか整理する
54-
- [prompt-gen][仕様検討][出力オプション候補] `自己点検` 系: 出力前チェックを共通オプション化できるか整理する(必須項目有無、会話外情報混入有無、形式逸脱有無など)
54+
- [prompt-gen][仕様検討][出力オプション候補] `自己レビュー` 系: 第三者レビューア視点での見直しを共通オプション化する。選択肢は `無指定` / `内部レビュー` / `レビュー結果出力` を基本とする
55+
- [prompt-gen][仕様検討][出力オプション候補] `自己レビュー` 系: レビュー観点を整理する(分かりやすさ、抜け漏れ、過不足、構成の自然さ、依頼意図との一致など)
56+
- [prompt-gen][仕様検討][出力オプション候補] `自己レビュー` 系: `レビュー結果出力` の場合は本文末尾に `自己レビュー` セクションを付ける前提で、出力粒度と書式を整理する
5557
- [prompt-gen][仕様検討][出力オプション候補] UI 形状を整理する。2値ならスイッチ、3値以上や強度差があるものはドロップダウンとし、プロンプトごとのデフォルト値を持てるようにする
5658
- [優先度高][lht-cmn] `lht-*` 全体を棚卸しし、各コンポーネントを「内部保証」または「フォールバック保証」のどちらかへ統一する
5759
- [music] `docs/music/musicxml-to-midi.html` に、ダウンロードせずその場でMIDI再生できる機能を追加する

docs/prompt/prompt-gen-src.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,15 @@
140140
<option value="desumasu">です・ます調</option>
141141
<option value="dearu">である調</option>
142142
</lht-select-help>
143+
<lht-select-help
144+
class="md-output-options__select md-output-options__select--compact"
145+
field-id="selfReview"
146+
label="自己レビュー"
147+
help-text="第三者レビューア視点での見直し方法を選択します。無指定 / 内部レビュー / レビュー結果出力 の3段階です。">
148+
<option value="unspecified">無指定</option>
149+
<option value="internal">内部レビュー</option>
150+
<option value="report">レビュー結果出力</option>
151+
</lht-select-help>
143152
<lht-select-help
144153
class="md-output-options__select md-output-options__select--compact"
145154
field-id="hallucinationGuard"

docs/prompt/prompt-gen.html

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,15 @@
15701570
<option value="desumasu">です・ます調</option>
15711571
<option value="dearu">である調</option>
15721572
</lht-select-help>
1573+
<lht-select-help
1574+
class="md-output-options__select md-output-options__select--compact"
1575+
field-id="selfReview"
1576+
label="自己レビュー"
1577+
help-text="第三者レビューア視点での見直し方法を選択します。無指定 / 内部レビュー / レビュー結果出力 の3段階です。">
1578+
<option value="unspecified">無指定</option>
1579+
<option value="internal">内部レビュー</option>
1580+
<option value="report">レビュー結果出力</option>
1581+
</lht-select-help>
15731582
<lht-select-help
15741583
class="md-output-options__select md-output-options__select--compact"
15751584
field-id="hallucinationGuard"
@@ -3725,16 +3734,27 @@
37253734
const markdownFenceInstruction = "○最終的な回答は Markdown テキスト形式で出力し、さらに ~~~~ で囲まれた一塊として出力してください。markdown 内に backtick による code fence が含まれる場合があるため、外側の囲みは tilde を使ってください。";
37263735
const desumasuToneInstruction = "○文体は、です・ます調で統一してください。箇条書きは体言止めでも構いません。";
37273736
const dearuToneInstruction = "○文体は、である調で統一してください。箇条書きは体言止めでも構いません。";
3737+
const internalSelfReviewInstruction = `○回答案を作成したあと、第三者のレビューアの視点に切り替えて自己レビューしてください。
3738+
- 依頼者にとって分かりやすいか、抜け漏れがないか、過不足がないか、構成が自然かを見直してください。
3739+
- 必要があれば本文を修正し、改善後の内容を最終回答として出力してください。
3740+
- 自己レビューの途中経過や思考過程は出力しないでください。`;
3741+
const reportedSelfReviewInstruction = `○回答案を作成したあと、第三者のレビューアの視点に切り替えて自己レビューしてください。
3742+
- 依頼者にとって分かりやすいか、抜け漏れがないか、過不足がないか、構成が自然かを見直してください。
3743+
- 必要があれば本文を修正し、改善後の内容を最終回答として出力してください。
3744+
- 最終回答の末尾に \`自己レビュー\` セクションを追加し、見直した観点と、必要に応じて修正点を簡潔に記載してください。
3745+
- 自己レビューの途中経過や思考過程は出力せず、レビュー結果だけを簡潔に記載してください。`;
37283746
let currentPromptOutputOptions = {
37293747
hallucinationGuardLevel: "high",
37303748
outputMarkdownEnabled: true,
3731-
outputTone: "unspecified"
3749+
outputTone: "unspecified",
3750+
selfReview: "unspecified"
37323751
};
37333752
function setPromptOutputOptions(options) {
37343753
currentPromptOutputOptions = {
37353754
hallucinationGuardLevel: options.hallucinationGuardLevel || "none",
37363755
outputMarkdownEnabled: options.outputMarkdownEnabled !== false,
3737-
outputTone: options.outputTone || "unspecified"
3756+
outputTone: options.outputTone || "unspecified",
3757+
selfReview: options.selfReview || "unspecified"
37383758
};
37393759
}
37403760
function getPromptOutputInstructionTemplates() {
@@ -3743,7 +3763,9 @@
37433763
softHallucinationPreventionInstruction,
37443764
markdownFenceInstruction,
37453765
desumasuToneInstruction,
3746-
dearuToneInstruction
3766+
dearuToneInstruction,
3767+
internalSelfReviewInstruction,
3768+
reportedSelfReviewInstruction
37473769
};
37483770
}
37493771
function trimTrailingPromptSeparators(value) {
@@ -3763,6 +3785,11 @@
37633785
? "desumasu"
37643786
: normalizedBody.includes(templates.dearuToneInstruction)
37653787
? "dearu"
3788+
: "unspecified",
3789+
selfReview: normalizedBody.includes(templates.reportedSelfReviewInstruction)
3790+
? "report"
3791+
: normalizedBody.includes(templates.internalSelfReviewInstruction)
3792+
? "internal"
37663793
: "unspecified"
37673794
};
37683795
}
@@ -3773,6 +3800,8 @@
37733800
while (changed) {
37743801
changed = false;
37753802
for (const template of [
3803+
templates.reportedSelfReviewInstruction,
3804+
templates.internalSelfReviewInstruction,
37763805
templates.dearuToneInstruction,
37773806
templates.desumasuToneInstruction,
37783807
templates.markdownFenceInstruction,
@@ -3808,6 +3837,12 @@
38083837
else if (options.outputTone === "dearu") {
38093838
segments.push(dearuToneInstruction);
38103839
}
3840+
if (options.selfReview === "internal") {
3841+
segments.push(internalSelfReviewInstruction);
3842+
}
3843+
else if (options.selfReview === "report") {
3844+
segments.push(reportedSelfReviewInstruction);
3845+
}
38113846
return segments.join("\n\n");
38123847
}
38133848
function getMarkdownFenceInstruction() {
@@ -8513,12 +8548,14 @@
85138548
const includeLabelPrefix = document.getElementById("includeLabelPrefix");
85148549
const outputTone = document.getElementById("outputTone") ||
85158550
(await waitForElementById("outputTone"));
8551+
const selfReview = document.getElementById("selfReview") ||
8552+
(await waitForElementById("selfReview"));
85168553
const hallucinationGuard = document.getElementById("hallucinationGuard") ||
85178554
(await waitForElementById("hallucinationGuard"));
85188555
const outputMarkdown = document.getElementById("outputMarkdown");
85198556
const copyShareLinkButton = document.getElementById("copyShareLinkButton");
85208557
const promptOutput = document.getElementById("promptOutput");
8521-
if (!promptSearch || !includeLabelPrefix || !outputTone || !hallucinationGuard || !outputMarkdown || !copyShareLinkButton || !promptOutput || !promptCandidateArea || !promptArgsSection || !promptArgsContainer || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) {
8558+
if (!promptSearch || !includeLabelPrefix || !outputTone || !selfReview || !hallucinationGuard || !outputMarkdown || !copyShareLinkButton || !promptOutput || !promptCandidateArea || !promptArgsSection || !promptArgsContainer || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) {
85228559
return;
85238560
}
85248561
function loadSeriesVisibilitySettings() {
@@ -9068,15 +9105,17 @@
90689105
return {
90699106
hallucinationGuardLevel: (hallucinationGuard.value || "none"),
90709107
outputMarkdownEnabled: outputMarkdown.checked,
9071-
outputTone: (outputTone.value || "unspecified")
9108+
outputTone: (outputTone.value || "unspecified"),
9109+
selfReview: (selfReview.value || "unspecified")
90729110
};
90739111
}
90749112
function inferPromptOutputOptionDefaults(definition) {
90759113
if (!definition) {
90769114
return {
90779115
hallucinationGuard: "none",
90789116
outputMarkdown: false,
9079-
outputTone: "unspecified"
9117+
outputTone: "unspecified",
9118+
selfReview: "unspecified"
90809119
};
90819120
}
90829121
const cached = promptOutputOptionDefaultsById.get(definition.id);
@@ -9091,7 +9130,8 @@
90919130
? "high"
90929131
: "none",
90939132
outputMarkdown: definition.outputMarkdown === true,
9094-
outputTone: "unspecified"
9133+
outputTone: "unspecified",
9134+
selfReview: "unspecified"
90959135
};
90969136
promptOutputOptionDefaultsById.set(definition.id, explicitDefaults);
90979137
return explicitDefaults;
@@ -9100,7 +9140,8 @@
91009140
setPromptOutputOptions({
91019141
hallucinationGuardLevel: "high",
91029142
outputMarkdownEnabled: true,
9103-
outputTone: "unspecified"
9143+
outputTone: "unspecified",
9144+
selfReview: "unspecified"
91049145
});
91059146
const argsForInference = {};
91069147
for (const argumentDefinition of getSelectedPromptArguments(definition)) {
@@ -9113,7 +9154,8 @@
91139154
const defaults = {
91149155
hallucinationGuard: instructionProfile.hallucinationGuardMode,
91159156
outputMarkdown: instructionProfile.outputMarkdown,
9116-
outputTone: instructionProfile.outputTone
9157+
outputTone: instructionProfile.outputTone,
9158+
selfReview: instructionProfile.selfReview
91179159
};
91189160
promptOutputOptionDefaultsById.set(definition.id, defaults);
91199161
return defaults;
@@ -9123,6 +9165,7 @@
91239165
hallucinationGuard.value = defaults.hallucinationGuard;
91249166
outputMarkdown.checked = defaults.outputMarkdown;
91259167
outputTone.value = defaults.outputTone;
9168+
selfReview.value = defaults.selfReview;
91269169
}
91279170
function renderSelectedPromptHelp() {
91289171
const selectedDefinition = getSelectedPromptDefinition();
@@ -9282,7 +9325,8 @@
92829325
setPromptOutputOptions({
92839326
hallucinationGuardLevel: "high",
92849327
outputMarkdownEnabled: true,
9285-
outputTone: "unspecified"
9328+
outputTone: "unspecified",
9329+
selfReview: "unspecified"
92869330
});
92879331
const rawBody = selectedDefinition ? selectedDefinition.buildBody(commitId, subject) : "";
92889332
setPromptOutputOptions(currentOptions);
@@ -9398,6 +9442,7 @@
93989442
promptSearch.addEventListener("input", renderCandidates);
93999443
includeLabelPrefix.addEventListener("change", updateOutput);
94009444
outputTone.addEventListener("change", updateOutput);
9445+
selfReview.addEventListener("change", updateOutput);
94019446
hallucinationGuard.addEventListener("change", updateOutput);
94029447
outputMarkdown.addEventListener("change", updateOutput);
94039448
copyShareLinkButton.addEventListener("click", () => {

docs/prompt/src/prompt-gen/js/main.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ async function initializePromptPage() {
5858
const includeLabelPrefix = document.getElementById("includeLabelPrefix");
5959
const outputTone = document.getElementById("outputTone") ||
6060
(await waitForElementById("outputTone"));
61+
const selfReview = document.getElementById("selfReview") ||
62+
(await waitForElementById("selfReview"));
6163
const hallucinationGuard = document.getElementById("hallucinationGuard") ||
6264
(await waitForElementById("hallucinationGuard"));
6365
const outputMarkdown = document.getElementById("outputMarkdown");
6466
const copyShareLinkButton = document.getElementById("copyShareLinkButton");
6567
const promptOutput = document.getElementById("promptOutput");
66-
if (!promptSearch || !includeLabelPrefix || !outputTone || !hallucinationGuard || !outputMarkdown || !copyShareLinkButton || !promptOutput || !promptCandidateArea || !promptArgsSection || !promptArgsContainer || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) {
68+
if (!promptSearch || !includeLabelPrefix || !outputTone || !selfReview || !hallucinationGuard || !outputMarkdown || !copyShareLinkButton || !promptOutput || !promptCandidateArea || !promptArgsSection || !promptArgsContainer || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) {
6769
return;
6870
}
6971
function loadSeriesVisibilitySettings() {
@@ -613,15 +615,17 @@ async function initializePromptPage() {
613615
return {
614616
hallucinationGuardLevel: (hallucinationGuard.value || "none"),
615617
outputMarkdownEnabled: outputMarkdown.checked,
616-
outputTone: (outputTone.value || "unspecified")
618+
outputTone: (outputTone.value || "unspecified"),
619+
selfReview: (selfReview.value || "unspecified")
617620
};
618621
}
619622
function inferPromptOutputOptionDefaults(definition) {
620623
if (!definition) {
621624
return {
622625
hallucinationGuard: "none",
623626
outputMarkdown: false,
624-
outputTone: "unspecified"
627+
outputTone: "unspecified",
628+
selfReview: "unspecified"
625629
};
626630
}
627631
const cached = promptOutputOptionDefaultsById.get(definition.id);
@@ -636,7 +640,8 @@ async function initializePromptPage() {
636640
? "high"
637641
: "none",
638642
outputMarkdown: definition.outputMarkdown === true,
639-
outputTone: "unspecified"
643+
outputTone: "unspecified",
644+
selfReview: "unspecified"
640645
};
641646
promptOutputOptionDefaultsById.set(definition.id, explicitDefaults);
642647
return explicitDefaults;
@@ -645,7 +650,8 @@ async function initializePromptPage() {
645650
setPromptOutputOptions({
646651
hallucinationGuardLevel: "high",
647652
outputMarkdownEnabled: true,
648-
outputTone: "unspecified"
653+
outputTone: "unspecified",
654+
selfReview: "unspecified"
649655
});
650656
const argsForInference = {};
651657
for (const argumentDefinition of getSelectedPromptArguments(definition)) {
@@ -658,7 +664,8 @@ async function initializePromptPage() {
658664
const defaults = {
659665
hallucinationGuard: instructionProfile.hallucinationGuardMode,
660666
outputMarkdown: instructionProfile.outputMarkdown,
661-
outputTone: instructionProfile.outputTone
667+
outputTone: instructionProfile.outputTone,
668+
selfReview: instructionProfile.selfReview
662669
};
663670
promptOutputOptionDefaultsById.set(definition.id, defaults);
664671
return defaults;
@@ -668,6 +675,7 @@ async function initializePromptPage() {
668675
hallucinationGuard.value = defaults.hallucinationGuard;
669676
outputMarkdown.checked = defaults.outputMarkdown;
670677
outputTone.value = defaults.outputTone;
678+
selfReview.value = defaults.selfReview;
671679
}
672680
function renderSelectedPromptHelp() {
673681
const selectedDefinition = getSelectedPromptDefinition();
@@ -827,7 +835,8 @@ async function initializePromptPage() {
827835
setPromptOutputOptions({
828836
hallucinationGuardLevel: "high",
829837
outputMarkdownEnabled: true,
830-
outputTone: "unspecified"
838+
outputTone: "unspecified",
839+
selfReview: "unspecified"
831840
});
832841
const rawBody = selectedDefinition ? selectedDefinition.buildBody(commitId, subject) : "";
833842
setPromptOutputOptions(currentOptions);
@@ -943,6 +952,7 @@ async function initializePromptPage() {
943952
promptSearch.addEventListener("input", renderCandidates);
944953
includeLabelPrefix.addEventListener("change", updateOutput);
945954
outputTone.addEventListener("change", updateOutput);
955+
selfReview.addEventListener("change", updateOutput);
946956
hallucinationGuard.addEventListener("change", updateOutput);
947957
outputMarkdown.addEventListener("change", updateOutput);
948958
copyShareLinkButton.addEventListener("click", () => {

0 commit comments

Comments
 (0)