taeaiai commited on
Commit ·
b0792f2
1
Parent(s): b303353
Simplify UI: keep only content textarea
Browse files- static/index.html +5 -32
static/index.html
CHANGED
|
@@ -128,31 +128,8 @@
|
|
| 128 |
<section class="panel">
|
| 129 |
<h2>입력</h2>
|
| 130 |
|
| 131 |
-
<label for="doc-type">문서 유형</label>
|
| 132 |
-
<select id="doc-type">
|
| 133 |
-
<option value="협조요청">협조 요청</option>
|
| 134 |
-
<option value="공지/안내">공지/안내</option>
|
| 135 |
-
<option value="요청">요청</option>
|
| 136 |
-
<option value="회신">회신</option>
|
| 137 |
-
<option value="보고">보고</option>
|
| 138 |
-
</select>
|
| 139 |
-
|
| 140 |
-
<div class="row">
|
| 141 |
-
<div>
|
| 142 |
-
<label for="recipient">수신</label>
|
| 143 |
-
<input id="recipient" type="text" placeholder="예: 각 부서장">
|
| 144 |
-
</div>
|
| 145 |
-
<div>
|
| 146 |
-
<label for="sender">발신명의</label>
|
| 147 |
-
<input id="sender" type="text" placeholder="예: 총무팀장">
|
| 148 |
-
</div>
|
| 149 |
-
</div>
|
| 150 |
-
|
| 151 |
-
<label for="title">제목 (선택)</label>
|
| 152 |
-
<input id="title" type="text" placeholder="비워두면 내용으로부터 생성">
|
| 153 |
-
|
| 154 |
<label for="prompt">내용 요점</label>
|
| 155 |
-
<textarea id="prompt" placeholder="예: 5.13(수) 부사장 회의 참석 요청, 9~10시, 본사 회의실"></textarea>
|
| 156 |
|
| 157 |
<div class="btnrow">
|
| 158 |
<button id="generate" disabled>로딩 중...</button>
|
|
@@ -200,13 +177,7 @@ const SYSTEM_PROMPT = `당신은 한국 행정 공문 작성 전문가입니다.
|
|
| 200 |
- 군더더기 없이 핵심만, 추측 금지`;
|
| 201 |
|
| 202 |
function buildUserPrompt() {
|
| 203 |
-
|
| 204 |
-
if ($('recipient').value.trim()) parts.push(`[수신] ${$('recipient').value.trim()}`);
|
| 205 |
-
if ($('sender').value.trim()) parts.push(`[발신명의] ${$('sender').value.trim()}`);
|
| 206 |
-
if ($('title').value.trim()) parts.push(`[제목] ${$('title').value.trim()}`);
|
| 207 |
-
parts.push('[내용 요점]');
|
| 208 |
-
parts.push($('prompt').value.trim());
|
| 209 |
-
return parts.join('\n');
|
| 210 |
}
|
| 211 |
|
| 212 |
function stripMarkdown(text) {
|
|
@@ -326,7 +297,9 @@ $('download-docx').addEventListener('click', async () => {
|
|
| 326 |
setStatus('docx 라이브러리 로딩 실패 (네트워크 확인)', true);
|
| 327 |
return;
|
| 328 |
}
|
| 329 |
-
|
|
|
|
|
|
|
| 330 |
const safeTitle = title.replace(/[\\/:*?"<>|]/g, '_').slice(0, 50);
|
| 331 |
|
| 332 |
const { Document, Paragraph, TextRun, Packer } = window.docx;
|
|
|
|
| 128 |
<section class="panel">
|
| 129 |
<h2>입력</h2>
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
<label for="prompt">내용 요점</label>
|
| 132 |
+
<textarea id="prompt" rows="10" placeholder="예: 5.13(수) 부사장 회의 참석 요청, 9~10시, 본사 회의실. 전 부서장 참석 필요. 회의 자료 5.12까지 제출."></textarea>
|
| 133 |
|
| 134 |
<div class="btnrow">
|
| 135 |
<button id="generate" disabled>로딩 중...</button>
|
|
|
|
| 177 |
- 군더더기 없이 핵심만, 추측 금지`;
|
| 178 |
|
| 179 |
function buildUserPrompt() {
|
| 180 |
+
return $('prompt').value.trim();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
}
|
| 182 |
|
| 183 |
function stripMarkdown(text) {
|
|
|
|
| 297 |
setStatus('docx 라이브러리 로딩 실패 (네트워크 확인)', true);
|
| 298 |
return;
|
| 299 |
}
|
| 300 |
+
// 출력 첫 줄의 "제목 ..." 부분에서 파일명 추출 시도, 없으면 "공문"
|
| 301 |
+
const firstTitleMatch = outputEl.textContent.match(/^제목\s+(.+)$/m);
|
| 302 |
+
const title = (firstTitleMatch ? firstTitleMatch[1] : '공문').trim();
|
| 303 |
const safeTitle = title.replace(/[\\/:*?"<>|]/g, '_').slice(0, 50);
|
| 304 |
|
| 305 |
const { Document, Paragraph, TextRun, Packer } = window.docx;
|