|
1570 | 1570 | <option value="desumasu">です・ます調</option> |
1571 | 1571 | <option value="dearu">である調</option> |
1572 | 1572 | </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> |
1573 | 1582 | <lht-select-help |
1574 | 1583 | class="md-output-options__select md-output-options__select--compact" |
1575 | 1584 | field-id="hallucinationGuard" |
|
3725 | 3734 | const markdownFenceInstruction = "○最終的な回答は Markdown テキスト形式で出力し、さらに ~~~~ で囲まれた一塊として出力してください。markdown 内に backtick による code fence が含まれる場合があるため、外側の囲みは tilde を使ってください。"; |
3726 | 3735 | const desumasuToneInstruction = "○文体は、です・ます調で統一してください。箇条書きは体言止めでも構いません。"; |
3727 | 3736 | const dearuToneInstruction = "○文体は、である調で統一してください。箇条書きは体言止めでも構いません。"; |
| 3737 | +const internalSelfReviewInstruction = `○回答案を作成したあと、第三者のレビューアの視点に切り替えて自己レビューしてください。 |
| 3738 | +- 依頼者にとって分かりやすいか、抜け漏れがないか、過不足がないか、構成が自然かを見直してください。 |
| 3739 | +- 必要があれば本文を修正し、改善後の内容を最終回答として出力してください。 |
| 3740 | +- 自己レビューの途中経過や思考過程は出力しないでください。`; |
| 3741 | +const reportedSelfReviewInstruction = `○回答案を作成したあと、第三者のレビューアの視点に切り替えて自己レビューしてください。 |
| 3742 | +- 依頼者にとって分かりやすいか、抜け漏れがないか、過不足がないか、構成が自然かを見直してください。 |
| 3743 | +- 必要があれば本文を修正し、改善後の内容を最終回答として出力してください。 |
| 3744 | +- 最終回答の末尾に \`自己レビュー\` セクションを追加し、見直した観点と、必要に応じて修正点を簡潔に記載してください。 |
| 3745 | +- 自己レビューの途中経過や思考過程は出力せず、レビュー結果だけを簡潔に記載してください。`; |
3728 | 3746 | let currentPromptOutputOptions = { |
3729 | 3747 | hallucinationGuardLevel: "high", |
3730 | 3748 | outputMarkdownEnabled: true, |
3731 | | - outputTone: "unspecified" |
| 3749 | + outputTone: "unspecified", |
| 3750 | + selfReview: "unspecified" |
3732 | 3751 | }; |
3733 | 3752 | function setPromptOutputOptions(options) { |
3734 | 3753 | currentPromptOutputOptions = { |
3735 | 3754 | hallucinationGuardLevel: options.hallucinationGuardLevel || "none", |
3736 | 3755 | outputMarkdownEnabled: options.outputMarkdownEnabled !== false, |
3737 | | - outputTone: options.outputTone || "unspecified" |
| 3756 | + outputTone: options.outputTone || "unspecified", |
| 3757 | + selfReview: options.selfReview || "unspecified" |
3738 | 3758 | }; |
3739 | 3759 | } |
3740 | 3760 | function getPromptOutputInstructionTemplates() { |
|
3743 | 3763 | softHallucinationPreventionInstruction, |
3744 | 3764 | markdownFenceInstruction, |
3745 | 3765 | desumasuToneInstruction, |
3746 | | - dearuToneInstruction |
| 3766 | + dearuToneInstruction, |
| 3767 | + internalSelfReviewInstruction, |
| 3768 | + reportedSelfReviewInstruction |
3747 | 3769 | }; |
3748 | 3770 | } |
3749 | 3771 | function trimTrailingPromptSeparators(value) { |
|
3763 | 3785 | ? "desumasu" |
3764 | 3786 | : normalizedBody.includes(templates.dearuToneInstruction) |
3765 | 3787 | ? "dearu" |
| 3788 | + : "unspecified", |
| 3789 | + selfReview: normalizedBody.includes(templates.reportedSelfReviewInstruction) |
| 3790 | + ? "report" |
| 3791 | + : normalizedBody.includes(templates.internalSelfReviewInstruction) |
| 3792 | + ? "internal" |
3766 | 3793 | : "unspecified" |
3767 | 3794 | }; |
3768 | 3795 | } |
|
3773 | 3800 | while (changed) { |
3774 | 3801 | changed = false; |
3775 | 3802 | for (const template of [ |
| 3803 | + templates.reportedSelfReviewInstruction, |
| 3804 | + templates.internalSelfReviewInstruction, |
3776 | 3805 | templates.dearuToneInstruction, |
3777 | 3806 | templates.desumasuToneInstruction, |
3778 | 3807 | templates.markdownFenceInstruction, |
|
3808 | 3837 | else if (options.outputTone === "dearu") { |
3809 | 3838 | segments.push(dearuToneInstruction); |
3810 | 3839 | } |
| 3840 | + if (options.selfReview === "internal") { |
| 3841 | + segments.push(internalSelfReviewInstruction); |
| 3842 | + } |
| 3843 | + else if (options.selfReview === "report") { |
| 3844 | + segments.push(reportedSelfReviewInstruction); |
| 3845 | + } |
3811 | 3846 | return segments.join("\n\n"); |
3812 | 3847 | } |
3813 | 3848 | function getMarkdownFenceInstruction() { |
|
8513 | 8548 | const includeLabelPrefix = document.getElementById("includeLabelPrefix"); |
8514 | 8549 | const outputTone = document.getElementById("outputTone") || |
8515 | 8550 | (await waitForElementById("outputTone")); |
| 8551 | + const selfReview = document.getElementById("selfReview") || |
| 8552 | + (await waitForElementById("selfReview")); |
8516 | 8553 | const hallucinationGuard = document.getElementById("hallucinationGuard") || |
8517 | 8554 | (await waitForElementById("hallucinationGuard")); |
8518 | 8555 | const outputMarkdown = document.getElementById("outputMarkdown"); |
8519 | 8556 | const copyShareLinkButton = document.getElementById("copyShareLinkButton"); |
8520 | 8557 | 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) { |
8522 | 8559 | return; |
8523 | 8560 | } |
8524 | 8561 | function loadSeriesVisibilitySettings() { |
|
9068 | 9105 | return { |
9069 | 9106 | hallucinationGuardLevel: (hallucinationGuard.value || "none"), |
9070 | 9107 | outputMarkdownEnabled: outputMarkdown.checked, |
9071 | | - outputTone: (outputTone.value || "unspecified") |
| 9108 | + outputTone: (outputTone.value || "unspecified"), |
| 9109 | + selfReview: (selfReview.value || "unspecified") |
9072 | 9110 | }; |
9073 | 9111 | } |
9074 | 9112 | function inferPromptOutputOptionDefaults(definition) { |
9075 | 9113 | if (!definition) { |
9076 | 9114 | return { |
9077 | 9115 | hallucinationGuard: "none", |
9078 | 9116 | outputMarkdown: false, |
9079 | | - outputTone: "unspecified" |
| 9117 | + outputTone: "unspecified", |
| 9118 | + selfReview: "unspecified" |
9080 | 9119 | }; |
9081 | 9120 | } |
9082 | 9121 | const cached = promptOutputOptionDefaultsById.get(definition.id); |
|
9091 | 9130 | ? "high" |
9092 | 9131 | : "none", |
9093 | 9132 | outputMarkdown: definition.outputMarkdown === true, |
9094 | | - outputTone: "unspecified" |
| 9133 | + outputTone: "unspecified", |
| 9134 | + selfReview: "unspecified" |
9095 | 9135 | }; |
9096 | 9136 | promptOutputOptionDefaultsById.set(definition.id, explicitDefaults); |
9097 | 9137 | return explicitDefaults; |
|
9100 | 9140 | setPromptOutputOptions({ |
9101 | 9141 | hallucinationGuardLevel: "high", |
9102 | 9142 | outputMarkdownEnabled: true, |
9103 | | - outputTone: "unspecified" |
| 9143 | + outputTone: "unspecified", |
| 9144 | + selfReview: "unspecified" |
9104 | 9145 | }); |
9105 | 9146 | const argsForInference = {}; |
9106 | 9147 | for (const argumentDefinition of getSelectedPromptArguments(definition)) { |
|
9113 | 9154 | const defaults = { |
9114 | 9155 | hallucinationGuard: instructionProfile.hallucinationGuardMode, |
9115 | 9156 | outputMarkdown: instructionProfile.outputMarkdown, |
9116 | | - outputTone: instructionProfile.outputTone |
| 9157 | + outputTone: instructionProfile.outputTone, |
| 9158 | + selfReview: instructionProfile.selfReview |
9117 | 9159 | }; |
9118 | 9160 | promptOutputOptionDefaultsById.set(definition.id, defaults); |
9119 | 9161 | return defaults; |
|
9123 | 9165 | hallucinationGuard.value = defaults.hallucinationGuard; |
9124 | 9166 | outputMarkdown.checked = defaults.outputMarkdown; |
9125 | 9167 | outputTone.value = defaults.outputTone; |
| 9168 | + selfReview.value = defaults.selfReview; |
9126 | 9169 | } |
9127 | 9170 | function renderSelectedPromptHelp() { |
9128 | 9171 | const selectedDefinition = getSelectedPromptDefinition(); |
|
9282 | 9325 | setPromptOutputOptions({ |
9283 | 9326 | hallucinationGuardLevel: "high", |
9284 | 9327 | outputMarkdownEnabled: true, |
9285 | | - outputTone: "unspecified" |
| 9328 | + outputTone: "unspecified", |
| 9329 | + selfReview: "unspecified" |
9286 | 9330 | }); |
9287 | 9331 | const rawBody = selectedDefinition ? selectedDefinition.buildBody(commitId, subject) : ""; |
9288 | 9332 | setPromptOutputOptions(currentOptions); |
|
9398 | 9442 | promptSearch.addEventListener("input", renderCandidates); |
9399 | 9443 | includeLabelPrefix.addEventListener("change", updateOutput); |
9400 | 9444 | outputTone.addEventListener("change", updateOutput); |
| 9445 | + selfReview.addEventListener("change", updateOutput); |
9401 | 9446 | hallucinationGuard.addEventListener("change", updateOutput); |
9402 | 9447 | outputMarkdown.addEventListener("change", updateOutput); |
9403 | 9448 | copyShareLinkButton.addEventListener("click", () => { |
|
0 commit comments