슬라이드 마법사: 코드에 박힌 mistral 모델명 제거(활성 provider 기본 모델을 따름) + 헤더에 모델 선택창 추가

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Sonnet 5.5 committed 2026-10-19 14:51:02 +09:00
1 parent e870c3c7ec
commit 0ba0b8195f
2 files changed
+25 -3

No files matched your search

+1
View File
@@ -331,6 +331,7 @@ body{background:var(--bg);color:var(--text);font-family:'Segoe UI',system-ui,san
<button class="theme-btn" id="tbtn-light" onclick="setTheme('light')">☀️ 라이트</button>
<button class="theme-btn" id="tbtn-warm" onclick="setTheme('warm')">🌿 웜</button>
</div>
<select id="wiz-model" class="theme-btn" title="슬라이드 생성·번역에 쓸 모델" onchange="wizModelChanged(this)" style="max-width:190px;margin-left:8px"><option value="">기본</option></select>
<div class="steps">
<span class="step-hint">← 번호 클릭으로 이동</span>
<div class="sdot active" id="sd1" onclick="goStep(1)"><div class="n">1</div>논문 검색</div>
+24 -3
View File
@@ -741,7 +741,7 @@ async function translateAbstract() {
bodyEl.textContent='번역 중...';
try {
const msg='다음 영문 의학 논문 초록을 자연스러운 한국어로 번역해주세요:\n\n'+abEn;
const r=await fetch('/api/chat',{method:'POST',credentials:'include',headers:{'Content-Type':'application/json','Accept':'text/event-stream'},body:JSON.stringify({message:msg,sessionId:'translate-abstract',model:'mistral-large-3:675b-cloud'})});
const r=await fetch('/api/chat',{method:'POST',credentials:'include',headers:{'Content-Type':'application/json','Accept':'text/event-stream'},body:JSON.stringify({message:msg,sessionId:'translate-abstract',...wizModelBody()})});
if(!r.ok) throw new Error('API '+r.status);
const reader=r.body.getReader(),dec=new TextDecoder();
let buf='',reply='';
@@ -792,10 +792,31 @@ function splitChunks(text, size) {
return chunks;
}
// 모델 선택: 비워 두면 서버의 활성 provider 기본 모델을 따른다(모델 이름을 코드에 박지 않는다 —
// provider가 바뀌면 옛 이름이 그대로 API로 가서 실패한다). 선택값은 이 브라우저에만 저장.
const WIZ_MODEL_KEY='pptx_wizard_model';
function wizModel(){try{return localStorage.getItem(WIZ_MODEL_KEY)||'';}catch{return '';}}
function wizModelBody(){const m=wizModel();return m?{model:m}:{};}
function wizModelChanged(sel){try{if(sel.value)localStorage.setItem(WIZ_MODEL_KEY,sel.value);else localStorage.removeItem(WIZ_MODEL_KEY);}catch{}}
async function loadWizModels(){
const sel=document.getElementById('wiz-model'); if(!sel)return;
try{
const pr=await fetch('/api/settings/provider',cr()); const pd=await pr.json();
const tr=await fetch('/api/models/test',{...jh(),method:'POST',body:JSON.stringify({llm:pd.llm})}); const td=await tr.json();
const models=(td.models||[]).map(m=>typeof m==='string'?m:(m.name||String(m)));
const mr=await fetch('/api/settings/model',cr()); const md=mr.ok?await mr.json():{};
const own=wizModel();
if(own&&!models.includes(own)){try{localStorage.removeItem(WIZ_MODEL_KEY);}catch{}} // provider가 바뀌어 없어진 모델
const cur=wizModel();
sel.innerHTML='<option value="">기본'+(md.primary?' ('+esc(md.primary)+')':'')+'</option>'+models.map(m=>`<option value="${esc(m)}"${m===cur?' selected':''}>${esc(m)}</option>`).join('');
}catch{}
}
loadWizModels();
async function chatStream(msg, sessionId) {
const r = await fetch('/api/chat', {method:'POST', credentials:'include',
headers:{'Content-Type':'application/json','Accept':'text/event-stream'},
body: JSON.stringify({message: msg, sessionId, direct: true, model: 'mistral-large-3:675b-cloud', ...(_presenterSkill?{skillContext:_presenterSkill}:{})})});
body: JSON.stringify({message: msg, sessionId, direct: true, ...wizModelBody(), ...(_presenterSkill?{skillContext:_presenterSkill}:{})})});
if (!r.ok) throw new Error('API ' + r.status);
const reader = r.body.getReader(), dec = new TextDecoder();
let buf = '', reply = '';
@@ -1666,7 +1687,7 @@ async function generateOutline() {
const prompt=`[PPTX 워크플로 시작]\n요청: ${topic}\nPMCIDs: ${pmcids}\n템플릿: ${tmpl}${skin?'\n배경 스킨: '+skin:''}\n슬라이드 수: ${slides}장\n\n=== 논문 내용 ===\n${contentBlocks.join('\n\n---\n')}\n\n=== 추출된 이미지 ===\n${imgList||'없음'}\n\n위 논문 내용과 이미지를 활용해 슬라이드 아웃라인을 \`\`\`pptx-outline 블록으로 출력해주세요. create_presentation은 아직 호출하지 마세요.`;
try{
const r=await fetch('/api/chat',{method:'POST',credentials:'include',headers:{'Content-Type':'application/json','Accept':'text/event-stream'},body:JSON.stringify({message:prompt,history:[],useTools:true,model:'mistral-large-3:675b-cloud',...(_presenterSkill?{skillContext:_presenterSkill}:{})})});
const r=await fetch('/api/chat',{method:'POST',credentials:'include',headers:{'Content-Type':'application/json','Accept':'text/event-stream'},body:JSON.stringify({message:prompt,history:[],useTools:true,...wizModelBody(),...(_presenterSkill?{skillContext:_presenterSkill}:{})})});
if(!r.ok) throw new Error('API '+r.status);
const reader=r.body.getReader(),dec=new TextDecoder();
let buf='',reply='';